
- 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-18-2022 02:43 AM
I notice that if you select say items 1 and 2 (which require orders) and then item 10, then click ok on the alert message, the oldValue command removes item1 and item 2 as well. Is there any way of stopping this behaviour so that only item 10 is removed?

- 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-18-2022 04:01 AM
Perfect, thanks Aman

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 05:35 AM
Hey
I think you marked your own response as correct.
DO you mind marking my response as correct, if this worked for you.
Thanks
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2022 04:09 AM
Please mark the one of the appropriate answers given by me or Aman