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 6

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

6 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 6

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.

Avatar

Level 3

Hi Kelly,

 

I am trying to trigger a scenario based on any time a custom form is updated. It seems you are achieving something similar here.

 

Could you show/tell me how you set up your trigger to start when a custom form is updated?

 

Thank you

Avatar

Level 2

Hi Eric,

 

I set up Watch Events in Fusion based on changes to a Form, which is a CategoryID in Fusion.

The CategoryID in Fusion = the Form ID in Workfront.
Not exactly the best way because Fusion only sees changes on the topmost form on an object.

Hope this helps.

Screenshot 2024-11-19 at 10.16.55 AM.png