- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:03 PM
Hi,
I have catalog item, where I need to sent send notification based on the selected request type
Lets say if the request type - New/ change
if new
Watch list - A & B
If Change
Watch list - C & D
This watch list field needs to be hidden for End user's
Watchlist - List collector(sys_user)
Can some one help with the client script to set these values by default based on request type?
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:56 PM
Hello,
Is the watchlist field a variable on the catalog item or a field on RITM.
If it's a field on RITM you can use a BR or a run script in the workflow itself as below:-
var request=current.variabales.request_type;
if(request=='new')
{
current.watch_list='enter sys_id of the suers comma seperated';
current.update();
}
Please mark answer correct/helpful based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:37 PM
Hi kamali
You want to set watchlist values for your RITM based on variable values?
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 12:27 AM
Just configure it in your workflow if this requirement is for single catalog item.
1. Write a run-script after begin activity,use below code to map watchlist values.
2. Store the users sys_id's in a property and use getproperty to get the values.
var request=current.variabales.request_type;
if(request=='new')
{
current.watch_list= gs.getProperty('property1'); //property1 stores users sysid's
}
else
{
current.watch_list= gs.getProperty('property2');//property2 stores users sysid's
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:41 PM
Hi,
Client scripts are preferred only when we want to show something to user based on some action. In your case watchlist is hidden for users then better to go for BR.
You could write BR on RITM table and check for request type variable value and set watchlist value.
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:56 PM
Hello,
Is the watchlist field a variable on the catalog item or a field on RITM.
If it's a field on RITM you can use a BR or a run script in the workflow itself as below:-
var request=current.variabales.request_type;
if(request=='new')
{
current.watch_list='enter sys_id of the suers comma seperated';
current.update();
}
Please mark answer correct/helpful based on Impact