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 compare two variable values in if condition ?

varma2
Mega Sage

Hi All,

 

I need to compare two variable value in if condition on workflow.

 

I have reference variable  ( Name_Requested_for ) and string variable ( assigned to) if both variable values not same it need to trigger TASK.

 

Please suggest.

Thanks all.

Varma

1 REPLY 1

Mohith Devatte
Tera Sage
Tera Sage

Hello,

try this 

answer =ifScript();
function ifScript()
{
if(current.variables.Name_Requested_for.getDisplayValue()==current.variables.assigned_to)

{

return 'yes';

}
else
{
return 'no';
}
}

PLEASE MARK MY NASWER CORRECT IF THIS HELPS YOU