Working with Previous/Current values in Flow Designer

Rick Mann
Tera Expert

I'm building a simple flow where I'm creating an incident record if the email address of a user record (sys_user) changes. I have a question on how to use previous and current values from the Trigger record to build the description in my Create Incident Record action. 

I want my description to say something like this: 

"The email address for Abel Tuter has changed from <previous email value> to <current email value>.  Please review subscriptions as needed."

This post states that the previous values should be accessible. The "FDChangeDetails" data pill is grayed out when I try to access it from my "Create Incident Action". Is there another way I should be accessing the data?

Thanks.

 

find_real_file.png

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

Commonly, I've seen someone loop through that object. So the object (Changed Fields) -- which is accessible. Here's a post on how to do that: see correct answer here: https://community.servicenow.com/community?id=community_question&sys_id=0aa94af9db6594101cd8a345ca96...

And then there's an alternative way (which isn't ideal, but I wanted to throw it out there): https://community.servicenow.com/community?id=community_article&sys_id=bf896bf3db58c5502454e6be13961...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi, @Rick Mann 

Thanks for marking my reply as Helpful.

If it also helps guide you Correctly, please also mark it as Correct.

Thanks and take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Richard Hine
Tera Guru
Tera Guru

Rick,

When I had to do this previously, I used a flow variable and scripting in a 'Set Flow Variables' action.

I defined the flow variable as JSON, as the array content is an object.

The set flow variables action had this in it (you would likely want to switch for email_address):-

find_real_file.png

You can obviously create and set multiple flow variables according to your needs in this action.

Each flow variable then holds a JSON object of known format:-

{
"previous_display_value":"",
"previous_value":"",
"current_display_value":"",
"current_value":"",
"field_name":""
}

Which you can then simply access as an object (In this example a log statement):-

find_real_file.png

It means you can quickly extract what you need a single action and then those elsewhere in your flow without having to use FD for each loops.

Hope this helps,

Richard