- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2022 02:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-01-2022 03:30 AM
Hi,
You can achieve in 2 ways
To display the all the fields when form loaded. We can use Display Business rule and onload client script to shows those field values.
1. create Display Business Rule with below code
(function executeRule(current, previous /*null when async*/) {
//using g_scratchpad variable store value and pass to client
g_scratchpad.mail = current.caller_id.email;
g_scratchpad.companyname = current.caller_id.company.name;
g_scratchpad.mobile = current.caller_id.mobile_phone;
g_scratchpad.managername = current.caller_id.manager.name;
})(current, previous);
2. create a onload Client Script with below code.
function onLoad() {
g_form.addInfoMessage("Caller's email is " +g_scratchpad.mail);
g_form.addInfoMessage("Caller's mobile number is " +g_scratchpad.mobile);
g_form.addInfoMessage("Caller's Company is " +g_scratchpad.companyname);
g_form.addInfoMessage("Caller's Manager Name is " +g_scratchpad.managername);
}
-----------------------------------------or------------------------------------------------------------
Create Display Business rule:
var mail = current.caller_id.email;
gs.addInfoMessage("this is email " +mail);
var companyname = current.caller_id.company.name;
gs.addInfoMessage("this is company " +companyname);
var mobile = current.caller_id.mobile_phone;
gs.addInfoMessage("this is mobile " +mobile);
var managername = current.caller_id.manager.name;
gs.addInfoMessage("this is manager " +managername);
Hope it helps!!
Please Mark ā Correct/helpful, if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2022 07:33 AM
Can we store multiple values in one gscratchpad
instead of creating multiple objects?