- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 04:03 AM
Hi Community,
When incident record is opened, caller Id’s email should visible in the top of the form. How to achieve it
Thanks,
Prakhar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 04:41 AM
Hi @prakhar_yadav ,
The best practice to achieve this functionality is by using the g_scratchpad.
Please follow the below steps to configure this:
- Create a Display Business Rule as below
(function executeRule(current, previous /*null when async*/ ) {
if(current.isNewRecord()){
return;
}
// Populating the g_scratchpad value with the Caller's Email id
g_scratchpad.caller_email = current.caller_id.email.getValue();
})(current, previous);
- Create a onLoad Client Script as below
function onLoad() {
if(g_form.isNewRecord()){
return;
}
// Displaying Caller's Email in a Info messgae
if(g_scratchpad.caller_email){
g_form.addInfoMessage("Caller's Email: " + g_scratchpad.caller_email);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 04:41 AM
Hi @prakhar_yadav ,
The best practice to achieve this functionality is by using the g_scratchpad.
Please follow the below steps to configure this:
- Create a Display Business Rule as below
(function executeRule(current, previous /*null when async*/ ) {
if(current.isNewRecord()){
return;
}
// Populating the g_scratchpad value with the Caller's Email id
g_scratchpad.caller_email = current.caller_id.email.getValue();
})(current, previous);
- Create a onLoad Client Script as below
function onLoad() {
if(g_form.isNewRecord()){
return;
}
// Displaying Caller's Email in a Info messgae
if(g_scratchpad.caller_email){
g_form.addInfoMessage("Caller's Email: " + g_scratchpad.caller_email);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 04:56 AM
@prakhar_yadav Here are the steps, using which you can add caller Id's email on top of the incident form.
1. Configure the form layout
Search the caller field in the slush bucket in the Available fields side.
Click to expand the related fields and choose email and take it to the selected fields section
This is how it should look when taken to the right side.
Adjust the position of the caller.email to top of the form.
Save the changes and this is how it looks when the layout is saved.
Please mark the response an accepted solution if it addresses your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 05:54 AM
Hello @prakhar_yadav ,
As per the best practices, you can use client callable script include & client script.
Script Include;
var GetEmail = Class.create();
GetEmail.prototype = Object.extendsObject(AbstractAjaxProcessor, {
demoTest: function() {
var user = this.getParameter("sysparm_caller_id");
var gr = new GlideRecord('sys_user');
gr.addQuery("sys_id",user);
gr.query();
if(gr.next()){
return gr.email;
}
},
type: 'GetEmail'
});
Client script;
function onload(){
var ga = new GlideAjax('GetEmail');
ga.addParam("sysparm_name","demoTest");
alert("test");
ga.addParam("sysparm_caller_id",g_form.getValue("caller_id"));
alert("test1");
ga.getXML(callback);
function callback(response){
alert('test');
var answer = response.responseXML.documentElement.getAttribute("answer");
alert("Email is " +answer);
}
Please mark my answer as accepted solution and give thumbs up, if it helps you.