- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 02:10 AM
Hi
How would i Show Alert message on creating an incident record it should display the caller's location. By using g_scratchpad in BusinessRule and client script..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 03:43 AM
@Rajkumar Bommal - ah apologies, it was the caller's location not the current user.š
If so, you can update the BR to
(function executeRule(current, previous /*null when async*/ ) {
var userGr = new GlideRecord("sys_user");
userGr.get(current.getValue('caller_id'));
g_scratchpad.currentLocation = userGr.getDisplayValue('location');
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 02:42 AM
Hi @Rajkumar Bommal,
You would first create a Business Rule as the following:
- Table: incident
- When: display
- Script:
(function executeRule(current, previous /*null when async*/ ) {
var userGr = new GlideRecord("sys_user");
userGr.get(gs.getUserID());
g_scratchpad.currentLocation = userGr.getDisplayValue('location');
})(current, previous);
And the client script will be:
- Table: Incident
- Type: onLoad
- Script:
function onLoad() {
alert(g_scratchpad.currentLocation );
}
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 03:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 03:07 AM
Does the user have a location associated with the account?
Works fine in my PDI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-28-2024 03:10 AM
Yes User have location