Comparing New State values vs Old State values | Community
Skip to main content
Level 3
October 14, 2024
Solved

Comparing New State values vs Old State values

  • October 14, 2024
  • 1 reply
  • 1079 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sven-iX

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.

1 reply

Sven-atClient
Level 3
October 15, 2024

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
Level 3
October 15, 2024

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

      }

}

Sven-iX
Community Advisor
Sven-iXCommunity AdvisorAccepted solution
Community Advisor
October 15, 2024

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.