cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Triggering a computed field

Fair
4-Participant

Triggering a computed field

 I have several computed fields that do not need to be dynamic, but they need to be updated/computed every time an item changes State or a specific field is updated.  For example.

1. When "due date" is entered, a field called Days until due date needs to compute.  

2. When "State" is changed to "In Review", Days in Review needs to compute.

These computed values are used to set range fields of Red Yellow Green to indicate status.

 

So, how do I trigger the computed fields to compute. 

I would be OK with it computing for a given item every time it is saved. Don't know how to do this either.

1 REPLY 1
bcollins-2
10-Marble
(To:Fair)

There is a way to do this with a trigger script. If you do then you can set the field to never compute on its own, unless you want redundancy. If you look in the javadocs for Integrity script beans you'll see a class called ScriptFieldBean, which has a method computeHistoryNow. This method can be called without a parameter to compute a static computation field as a whole, or with a parameter which is an array of ID numbers for the items which need to update.

 

To get the ScriptFieldBean you need to call the getFieldBean method of the server bean.

 

Example:

var fb = sb.getFieldBean("Some Field");

var ids = [111,222,333];

fb.computeHistoryNow(ids);

Announcements


Top Tags