Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to use Requested for field of Requested item in Flow Designer Its giving Error that Undefined.

Balaraju K B
Tera Expert

Hi Team,

I have a requirement that Based on Requester's last name starting Alphabet i Need to assign the catalog task to Specific Assignment Group (they have given 3 Assigment Groups)

Condition :

(if lastname (A-I or N) ASSIGMENT GROUP 1)

(if lastname (J-Q or R ASSIGNMENT GROUP 2)

(if lastname (S-Z ASSIGNMENT GROUP 3)

This script is wirking fine in Workflow but its not working in Flow designer

In Flow designer it's showing undefined input 'assignment_group' error

How can i implement this below script in Flow designer. 

var lastname=current.request.requested_for.last_name;
var split_lastname=lastname.substr(0,1);
if(split_lastname.toLowerCase()=='a'||'b'||'c'||'d'||'e'||'f'||'g'||'h'||'i'||'n')
{
task.assignment_group='802cb4b3db069850e783f3671d961969';//Assignment grp 1 
}

else if(split_lastname.toLowerCase()=='j'||'k'||'l'||'m'||'o'||'p'||'q'||'r')
{
task.assignment_group='b14c7877db069850e783f3671d9619f0';//Assignment grp 2

}
else if(split_lastname.toLowerCase()=='s'||'t'||'u'||'v'||'w'||'x'||'y'||'z')
{
task.assignment_group='875cf4f3db069850e783f3671d96193c';//Assignment Group 3

}

 

Thanks in Advance

Balaraju

1 ACCEPTED SOLUTION

HI,

Couple of improvements to script.


For example:

var lastname=current.request.requested_for.last_name; Replace it with

var lastname=fd_data.trigger.current.request.requested_for.last_name;


Thanks,

Ashutosh

View solution in original post

6 REPLIES 6

@Balaraju K B 

Can you share the updated script so that it would be helpful to others as well

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Balaraju K B 

Hope you are doing good.

 

Did you got a chance to check on the solution provided to resolve your query?

If your query is resolved please mark appropriate answer as correct and helpful & close the thread.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader