- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 01:15 AM
Hi All,
I am having multiple if conditions such as if Keyboard needed is selected as Yes, then in the run script , I want to consume a keyboard record and assign to requester.
If mouse needed is selected as Yes, then in the run script , I want to consume a mouse record and assign to requester.
If Webcam needed is selected as Yes, then in the run script , I want to consume a webcam record and assign to requester.
So, for the keyboard, the item name is Ergo Keyboard 123, for the mouse, the item name is Mouse CPA1
So, I am thinking to use a single run script but pass these values from if condition to run script. How it is possible.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 06:09 PM - edited 02-08-2024 06:10 PM
Hi @Renu9 in this cases, instead of while/switch, create a run script and check all the variable value and store it in different scratchpad variables/activity result and in next run script you can check these
if (current.variables.var_name == 'value1') {
activity.result = 'value1';
} else if (current.variables.var_name == 'value2') {
activity.result = 'value2';
}
else if (current.variables.var_name == 'value2' && current.variables.var_name == 'value1') {
activity.result = 'value3';
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 01:44 AM
Hello @Renu9 ,
// Add your condition to check
if (condition) {
// Dynamic value when condition is true
var dynamicValue = "Dynamic Value 1";
} else {
// Dynamic value when condition is false
var dynamicValue = "Dynamic Value 2";
}
// Use the dynamicValue in your script
gs.info("Dynamic Value: " + dynamicValue);
Replace 'condition', "Dynamic Value 1", and "Dynamic Value 2" with your actual conditions and dynamic values.
If this will helps to resolve your issue then please mark helpful and accept as solution.
Thanks & Regards,
Sayali Gurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 07:29 AM
I need to put multiple if conditions in the workflow and all should point to same run script
Can you please let me know where we can give the condition and pass the dynamic values?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 07:46 AM
Hi @Renu9 in that case go for switch statement where you can have multiple dynamic values to pass to your run script.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 07:56 AM
Hi @Harish KM In this case, switch shows the choices for that variable.
But in my case. If keyboard is selected as 'Ergo Keyboard 123', then run script should execute.
If mouse is selected as 'Mouse CPA1', then run script should execute. As a sample below. I want to execute all if statements. How can it be acheived. Single run script but dynamic value should be passed each time.