flow designer if else condition help

RudhraKAM
Tera Guru

Can someone help me how to achieve this, we have a user-defined table in which we have a field called state when that record is created we have a trigger on that table which should create an incident, when creating incident we need to set the state to whatever the record on the user-defined table. The user-defined state value and name are different , how to achieve this ?

 

if u_usertable_state = assigned then  create the incident in assigned state ( can we write any script for this ) 

find_real_file.png

1 ACCEPTED SOLUTION

Here you go..
 
var ans;
var stat = fd_data.trigger.current.u_usertable_state;
if(stat == '1')
{
ans = '2';
}
else if(stat == '2')
{
ans = '3';
}
return ans;

View solution in original post

7 REPLIES 7

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Rudhra,

I am not sure on the use case to create incident from user record. That said, you can use Flow Designer inline script to handle the mapping i.e return the choice value of the state depending on the incoming choice value. https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/concept...

Thanks Pradeep for the reply , 

 

Can you please help me with the script 

Table is 

u_usertable_state =  assigned(1 is the value ) then  create the incident in assigned state  2(assigned) 

 

else state = work in progress (2 is the value) then create incident in working  in progress state ( 3 is the value

Here you go..
 
var ans;
var stat = fd_data.trigger.current.u_usertable_state;
if(stat == '1')
{
ans = '2';
}
else if(stat == '2')
{
ans = '3';
}
return ans;

Thanks pradeep , this is erroring out , this is the table on which flow is triggered (u_usertable_state) and do we need to add .value ? ( I tried that too it is not working ) how to log this ?