How to get current value in Flow Designer, help with inline script?

astanley
Tera Contributor

Hi all,

 

I currently am creating an automated termination flow. What I have so far:

Trigger: "end date" on sys_user record changes

The first thing I added was to set flow variable value to current:

I created the flow variable "End Date" and am using the "end date" field on the triggered user record

astanley_1-1666288359117.png

where this is the script I used:
var endDate = fd_data.trigger.current.u_end_date;
return endDate
 
I am trying to have this end date be used later in the flow where I submit a catalog item. However, for the catalog item, it keeps giving me the previous value of the end date field. I want to create a flow variable so that I can use the date that the end date is changed to.
 
 
Second question I have is, how can I get the class value for the cmdb_ci table?
The next action I created was a lookup action to see if the user (that triggered the flow) has any configuration items assigned to them:
astanley_2-1666288797812.png

 

I was using this data pill to populate the catalog item variable, however the records return the sys id.

The "class" field on the [cmdb_ci] table is the only one that makes sense for the catalog item question. So I tried to create a loop and set a flow variable to the class name:

astanley_3-1666289070392.png
astanley_4-1666289577469.png
astanley_5-1666289601066.png

 

And this is the scripted condition I used:

var ci = fd_data.trigger.ci_item.sys_class_name;
return ci;
 
It didn't work so I'm wondering how I can get these scripts to work or if there is a better option I am not considering? Thanks!
1 ACCEPTED SOLUTION

So, for the change details, you'll only be able to access by doing a for...each loop against "changed Fields" - then you'll have an if to look for the field name for the end date. If it matches, then set your flow variable to the current value of that found entry.

View solution in original post

7 REPLIES 7

So, for the change details, you'll only be able to access by doing a for...each loop against "changed Fields" - then you'll have an if to look for the field name for the end date. If it matches, then set your flow variable to the current value of that found entry.

Thank you this worked!

You're welcome!