
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 07:56 AM
Afternoon,
I am hoping someone can help me finish this off.
We have an order guide with 10 catalog items. The user selects which items they want to order using a list collector variable. 9 of the items follow the standard ritm/task workflow route, but item 10 isnt ordered, they can collect it form reception. As it's part of the 'portfolio', we still want to show it as an option. However, what we would like is if the user selects this item then an alert pops up to tell them to go to reception, and ideally it doesnt get added to the right bucket. The script below manages the alert, but when you click on the item, and ok the alert, the item is still added to the right bucket, and if they dont remove it then any additional item the user adds says its collected from reception as well. Is there anything I can add after the alert to clear the value from the right bucket??
function onChange(control, oldValue, newValue, isLoading) {
var flg= 'false';
var str= newValue.toString();
var arr= str.split(',');
for(var i=0; i<arr.length; i++ ){
if(arr[i] == '3e1093661b105914ce1564a2b24bcb7d'){ //sys id of item 10
flg= 'true';
break;
}
}
if(flg == 'true'){
alert('This item is available for collection from Reception.');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 02:56 AM
You can modify your code:
if(flg == 'true'){
alert('This item is available for collection from Reception.');
var ind = arr.indexOf('3e1093661b105914ce1564a2b24bcb7d');
arr.splice(ind,1);
g_form.setValue('your list field name',arr.join(','));
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 08:13 AM
Hello,
Can you write return false in the if loop and try ?
if(flg == 'true'){
alert('This item is available for collection from Reception.');
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 08:21 AM
Thanks Mohith. I added the line but it still adds the item to the bucket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2022 08:22 AM
then can we try this ?
if(flg == 'true'){
g_form.setValue('your list collector field name',oldValue);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 01:20 AM
That works. Thankyou