In Workflow , I am trying to put an If Condition , but it's not working as per expectation

sonalpriyanka95
Kilo Expert

Hi Team ,

I am trying to imply an workflow where it should runs events when , it met conditions like Lost item is either mifi device, byod device, issued mobile or issued surface device , or all of them or any of these combination basically , so however , In this case I tried both the ways , it's not working , the condition works when only one of these option is selected but when more than 1 option selected workflow doesn't work .

 

Please Suggest me further how I can achieve it .

1 ACCEPTED SOLUTION

@sonalpriyanka95 

please share script here and not screenshot.

did you give correct variable name and correct record sysIds?

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

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@sonalpriyanka95 

is that a list collector or reference variable?

If list collector then I will suggest to use advanced script and use this and give correct sysId of records

answer = ifScript();

function ifScript() {
    var arr = current.variables.variableName.toString().split(',');
    if (arr.indexOf('sysId1') > -1 || arr.indexOf('sysId2') > -1 || arr.indexOf('sysId3') > -1 || arr.indexOf('sysId4') > -1)
        return 'yes';
    else
        return 'no';
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

sonalpriyanka95
Kilo Expert

yeah , it an list collector , however the above script didn't worked. sharing screenshot of WF 

@sonalpriyanka95 

please share script here and not screenshot.

did you give correct variable name and correct record sysIds?

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

sonalpriyanka95
Kilo Expert

Thanks It worked , however now facing some other issue in Workflow,

 

Even if condition evaluates true still it directing to NO , not executing the task