OOB Business Rule - Incident Functions - Need Clarification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2022 01:42 PM - edited 12-24-2022 01:43 PM
Hi
I am practicing client script - to populate caller_id in incident table to logged in user.
When I tried it didnt work, it getting populated automatically using the OOB business rule "incident functions" - I guess.
https://XXXservice-now.com/nav_to.do?uri=sys_script.do?sys_id=68c334efc0a80164016c1bce9b634660
I was trying to read and understand what the code. there are few methods like gs.action and action.get("sysparm_collection") in the function which is pretty new for me - can someone guide me and help me understand the code.
function incidentGetCaller() {
if (gs.hasRole("itil")) {
var action = gs.action;
var table = action.get("sysparm_collection");
if (table != "sys_user")
return null;
var userID = action.get("sysparm_collectionID");
return userID;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2022 09:59 PM - edited 12-24-2022 10:02 PM
Hi @J_31 ,
Not sure about that business rule but you can use default value on dictionary of caller filed to populate logged in user.
javascript:gs.getUserID()
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2022 10:59 PM
Hi @J_31,
As Pavan suggested, you can use the default value and it will update the logged in user name as default.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2022 08:52 PM
Hi @J_31 ,
You can use default value of caller field to populate logged in user please use below code.
javascript:gs.getUserID()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2023 02:16 AM
Hi @J_31 ,
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar