Expand my Community achievements bar.

SOLVED

Comparing New State values vs Old State values

Avatar

Level 2

Hi,

I have 2 questions.

 

1. I have a Fusion Scenario that starts with an Adobe Workfront Watch Event that triggers every time a form is updated on an Issue.
    I'm trying to compare the New State values and Old State values and then get a list of the fields that were changed.

 

2.  I'm also trying to use the Adobe Workfront Custom API module to get the fields on a form that is attached to an Issue that contains a specific string.

     For instance, I have multiple fields with names like:

     'Marketing Distribution - Amazon'

     'Marketing Distribution - DirecTV'

     'Marketing Distribution - Google'

     ..............

     I want to use the Custom API call to get all fields that contain 'Marketing Distribution'.

 

thanks for the help,

Kelly

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi @Kelly_StarzEnt 

 

take a look at the attached blueprint. 

 

The caveat is that in order to compare I do a toString() on the value. That's fine unless the value is a collection, or array of collections. 

 

So you likely will need to do some customizing or filtering as to which attribute change you want to act on.

View solution in original post

4 Replies

Avatar

Level 3

Hi @Kelly_StarzEnt 

 

  1. you'll need to do the compare after the event handler: For example a setMultipleVariables module where you set "hasFieldX changed" to newState.fieldX = oldState.fieldX. Then you can set filters/routes based on which checks show the field(s) changed. 

  2. In your custom API call, add query string arguments
    • fields: *
    • name=Marketing Dsitribution -
    • name_Mod=cicontains

Avatar

Level 2

Thanks Sven, I will give this a try.

For item 1, do you know if there is a way to iterate through all the form fields and see what changed?  Instead of targeting a specific field?

 

Something like:

for (x = 0; x < formFields.numItems; ++x) {

      var thisField = formFields[x];

      if (newState.thisField != oldState.thisField) {

            //A change was detected

      }

}

Avatar

Correct answer by
Level 5

Hi @Kelly_StarzEnt 

 

take a look at the attached blueprint. 

 

The caveat is that in order to compare I do a toString() on the value. That's fine unless the value is a collection, or array of collections. 

 

So you likely will need to do some customizing or filtering as to which attribute change you want to act on.