To check Variables 'Requested for' equals OR Not equals to 'Request for' on Confirmation box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 06:54 AM
Team,
I have requirement per below screenshots.
Currently Second checkout confirmation box is enable and taking logged in users in field 'Request for', the variable 'Requested for' on cat item is also set to populate logged in user.
Now when the user submits the request and Confirmation box pops up and the user changes the name from currently logged in user to any other user, it creates issue on associated REQ & RITM record to understand.
We cannot disable the Second checkout box also cannot use 'Run Script' wf activity to Update the REQ's Reqested for field.
Per my understanding, the 'Request for' on the Confirmation box is populating the Requested for field on the sc_request table.
Now I require to add an activity (maybe 'if') just after the start of the workflow that
If the cat item form Variable 'Requested for' value is EQUALS to 'Request for' of the Confirmation box, then it triggers for next step of flow
and If the cat item form Variable 'Requested for' value is NOT EQUALS to 'Request for' of the Confirmation box, then it triggers the Notification to 'Opened by/Requestor' to cancel this Request.
can anyone please help me with the script to check this for?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 07:01 AM
Hi @rishabh31 ,
You can use a IF activity here under which u can check the advanced section & write this below script:
if(current,variables.requested_for == current.requested_for){
answer = 'yes';
}else{
answer = 'no';
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 07:47 AM
Hi @Danish Bhairag2 Sir, Not working as expected, requesting to please test this in your PDI.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 08:30 PM
if you are using workflow editor, the syntax is already present in the if script activity when you click the advanced box. Your if condition should be as below:
answer = ifScript();
function ifScript() {
if (current.variables.your_requested_for_variable == curent.requested_for) {
return 'yes';
}
return 'no';
}
I feel that the form you are producing is not the best from a process point of view.
you have a requested for field on your main catalog item,
then another separate requested for field on your cart checkout.
both of which default to current logged in user and both can be changed by the person filling out the form. And you wait until after request submission to check if they align.
It might be better to remove the 'requested for' field from the catalog item so it is only present in the cart. Then at least you only have the one field and you don't need to worry about comparing them.
Also since this request is for having the account disabled, is it wise to populate it with the current logged in user? is your process that a user needs to request to have their own account disabled? typically i would expect this to be performed by someone else (e.g. HR staff or manager). You might end up with the wrong people getting their account disabled.