Difference between revisions of "The Musings of Chin - Template Formulas"

From SmartWiki
Jump to: navigation, search
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Chin's Musings #1 - Let's learn about Template Formulas:
+
Chin's inaugural Musings entry provides a helpful rundown of [[Template Formulas]] and how they allow you to update field values on any object.
  
What?
+
[[Category:Chin’s Musings]][[Category:Universal Tracking Application]][[Category:Expert Tips and Tricks]]
Template Formulas provide a method for updating standard/customfield values on an object behind the scenes upon saving. They let you perform extra calculations after saving an object. They can be handy because they let you:
 
  
1) update an object and perform calculations after it's been saved (i.e. support ticket subjects, say you want to combine an autonumber field with the L1 subject but when you first create the L1 the autonumber hasn't been reserved and stored yet until after you save).
+
=Let's learn about Template Formulas:=
  
2) affect objects at different levels (i.e. a L2 formula can be used to update a L1, an L1 formula can be used to aggregate its contacts).
+
==What?==
 +
Template Formulas provide a method for updating [[Standard_Field|standard]] or [[Custom_Field|custom field]] values on an object behind the scenes upon saving. They let you perform extra calculations after saving an object. They can be handy because they let you:
  
3) easily perform difficult calculations with MySQL functionality and avoid heavy scripting (i.e. perform business day calculations).
+
# update an object and perform calculations after it has been saved (i.e. support ticket subjects, say you want to combine an [[Autonumber|autonumber field]] with the L1 subject but, when you first create the L1, the autonumber hasn't been reserved and stored yet until after you save).
 +
# affect objects at different levels (i.e. a L2 formula can be used to update a L1, an L1 formula can be used to aggregate its contacts).
 +
# easily perform difficult calculations with MySQL functionality and avoid heavy scripting (i.e. perform business day calculations).
  
Where?
+
==Where?==
The configuration settings can be found on most entities now, such as UTA L1, L2, L3, transactions, contact roles, company categories.
+
The configuration settings can be found on most entities now, such as [[UTA|UTA]] L1, L2, L3, transactions, contact roles or company categories.
  
How?
+
==How?==
 
You must specify valid MySQL syntax within the settings box, and each line is ended with a semi-colon. Each line is processed sequentially and in order after saving an object.
 
You must specify valid MySQL syntax within the settings box, and each line is ended with a semi-colon. Each line is processed sequentially and in order after saving an object.
  
When?
+
==When?==
Template Formulas run after an object is saved and uses the newly saved field values for their calculations. They are also chained such that when saving a L3 the formulas run in the order of L3 global formula, L3 type formula, L2 global formula, L2 type formula, L1 global formula, L1 type formula. When deleting a L3, the formulas for the L2 and L1 are also run.
+
Template Formulas run after an object is saved and uses the newly saved field values for their calculations. They are also [[The Musings of Chin - SmartSimple's Order of Operations|chained]] such that when saving a L3 the formulas run in the order of L3 global formula, L3 type formula, L2 global formula, L2 type formula, L1 global formula, L1 type formula. When deleting a L3, the formulas for the L2 and L1 are also run.
  
Signs when they may be needed
+
==Signs when they may be needed==
-When you have to save an object twice to get it to correctly calculate something.
+
* When you have to save an object twice to get it to correctly calculate something.
  
Disclaimer
+
<pre style="white-space: pre-wrap;
-Template Formulas are run by the server, so for performance considerations should not be abused. A Template Formula should only be used when a calculation can not be achieved on the page with calculated value custom fields, or when trying to update a field that does not exist on the page (i.e. at L2 you wish to update a L1 field).
+
white-space: -moz-pre-wrap;
 +
white-space: -pre-wrap;
 +
white-space: -o-pre-wrap;
 +
word-wrap: break-word;">Disclaimer: Template Formulas are run by the server, so for performance considerations should not be abused.  
 +
A Template Formula should only be used when a calculation can not be achieved on the page with calculated value custom fields, or when trying to update a field that does not exist on the page (i.e. at L2 you wish to update a L1 field).</pre>
 +
 
 +
==See Also==
 +
* [[Template_/_Type_Formula|Template Formulas]]

Latest revision as of 15:43, 15 January 2015

Chin's inaugural Musings entry provides a helpful rundown of Template Formulas and how they allow you to update field values on any object.

Let's learn about Template Formulas:

What?

Template Formulas provide a method for updating standard or custom field values on an object behind the scenes upon saving. They let you perform extra calculations after saving an object. They can be handy because they let you:

  1. update an object and perform calculations after it has been saved (i.e. support ticket subjects, say you want to combine an autonumber field with the L1 subject but, when you first create the L1, the autonumber hasn't been reserved and stored yet until after you save).
  2. affect objects at different levels (i.e. a L2 formula can be used to update a L1, an L1 formula can be used to aggregate its contacts).
  3. easily perform difficult calculations with MySQL functionality and avoid heavy scripting (i.e. perform business day calculations).

Where?

The configuration settings can be found on most entities now, such as UTA L1, L2, L3, transactions, contact roles or company categories.

How?

You must specify valid MySQL syntax within the settings box, and each line is ended with a semi-colon. Each line is processed sequentially and in order after saving an object.

When?

Template Formulas run after an object is saved and uses the newly saved field values for their calculations. They are also chained such that when saving a L3 the formulas run in the order of L3 global formula, L3 type formula, L2 global formula, L2 type formula, L1 global formula, L1 type formula. When deleting a L3, the formulas for the L2 and L1 are also run.

Signs when they may be needed

  • When you have to save an object twice to get it to correctly calculate something.
Disclaimer: Template Formulas are run by the server, so for performance considerations should not be abused. 
A Template Formula should only be used when a calculation can not be achieved on the page with calculated value custom fields, or when trying to update a field that does not exist on the page (i.e. at L2 you wish to update a L1 field).

See Also