- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I am working on Service Operations Workspace (SOW) in the Australia release and would like to customize the Caller Card displayed in the Record Information sidebar.
Currently, the Caller Card shows:
- Caller Name
- Title
- Department
- Time Zone
Example:
My requirement is to replace the Time Zone field with a custom Site field Value from the User record .Priyanshu Anand
ServiceNow Developer - IT
02:43:23 America/Los_Angeles
Attaching image for reference -Documentation reviewed -
I have already reviewed the following ServiceNow documentation related to customizing the side panel:
The documentation explains how to configure and customize the side panel, but I could not find information on how the Caller Card fields are sourced or how to replace an existing field (such as Time Zone) with a custom field.
Any guidance, examples, or documentation references would be greatly appreciated.
Thanks,
Priyanshu Anand
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @PriyanshuA92384 ,
In my case, I replaced the Time Zone field with the User's Email field. Since you want to use a custom field, update the configuration with your custom field name.
1.Navigate to Script Includes and open the SOWIncidentInfo Script Include.
2.Update the script field with following script and save the record.
Replace the User Email field used in the script with your custom field name.
var SOWIncidentInfo = Class.create();
SOWIncidentInfo.prototype = Object.extendsObject(sn_sow_inc.SOWIncidentInfoSNC, {
getCallerInfo: function() {
var result = {};
var caller = {};
var callerRef;
if (this._gr.getTableName() == 'interaction')
callerRef = this._gr.opened_for.getRefRecord();
else
callerRef = this._gr.caller_id.getRefRecord();
caller.sysId = callerRef.getUniqueValue();
caller.avatar = callerRef.avatar ? "/" + callerRef.avatar + ".iix?t=small" : "";
if (this._gr.getTableName() == 'interaction')
caller.name = this._gr.getDisplayValue("opened_for");
else
caller.name = this._gr.getDisplayValue("caller_id");
// caller.timeZone = gs.getProperty('glide.sys.default.tz') || 'America/Los_Angeles';
// caller.timeZoneValue = gs.getProperty('glide.sys.default.tz') || 'America/Los_Angeles';
if (callerRef.title)
caller.title = callerRef.getDisplayValue("title");
if (callerRef.department)
caller.department = callerRef.getDisplayValue("department");
var locationRef = callerRef.location.getRefRecord();
if (locationRef && locationRef.city)
caller.city = locationRef.getDisplayValue("city");
// if (callerRef.time_zone) {
// caller.timeZone = callerRef.getDisplayValue("time_zone");
// caller.timeZoneValue = callerRef.getValue("time_zone");
// }
//Here repalce with your custom field
if(callerRef.email)
{
caller.email = callerRef.getDisplayValue("email");
}
if (callerRef.vip)
caller.vip = [{
"label": gs.getMessage("VIP"),
"color": "critical"
}];
result.caller = caller;
if (this._gr.getTableName() == 'interaction')
result.fieldsInfo = this.getFieldsInfo(this.FIELDS.SOURCE);
else
result.secondaryInfo = this.getFieldsInfo(this.FIELDS.SOURCE);
return result;
},
type: 'SOWIncidentInfo'
});
3.Navigate to UI builder and Under Page collections tab, Select SOW - sidebar tabs top
4.Now duplicate the page variant of Record Information SNC
5.Now make the Record Information SNC Variant Inactive(uncheck active) and click on save.
6.Open the Record Information SNC Copy in editor mode and in the client scripts open Set Record information primary details.
7.In the script comment out the 4 lines related to time zone and add the following script as shown in the image below and click on apply then Click on save .
if (api.data.record_information.output.sourceInfo.callerInfo.caller.email) {
subHeadingList.push(api.data.record_information.output.sourceInfo.callerInfo.caller.email);
}9.Final result: The Time Zone field is replaced with the User Email field.
10.Using the same approach, you can add any other required fields if needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @PriyanshuA92384 ,
Thank you! Glad you found it useful.
If you are able to modify for request then do same configs for RequestedItemInfo Script Include to get reflected for RITM.
1.For request use RequestInfo Script Include
2.For RITM use RequestedItemInfo Script Include
Note: Use the same function(getSourceInfo, getOpenedByInfo) definitions used in RequestInfo for RequestedItemInfo functions.
Example:In my case I am displaying email of Requested for and Opened by
RequestInfo Script Include:
var RequestInfo = Class.create();
RequestInfo.prototype = Object.extendsObject(sn_sow_req.RequestInfoSNC, {
getSourceInfo: function() {
//Added the extra script here
var requestorInfo = this.getRequestedForInfo();
requestorInfoGr = this._gr.requested_for.getRefRecord();
requestorInfo.email = requestorInfoGr.getDisplayValue("email");
var result = {
requestorInfo: requestorInfo,
sourceHeading: sn_i18n.Message.getMessage("sn_sow_req", "Requested for"),
name: this._gr.getDisplayValue('requested_for'),
vip: requestorInfo.vip,
assigneeDetails: [{
label: this._gr['opened_by'].getLabel(),
value: {
type: "string",
value: this._gr.getDisplayValue('opened_by')
}
}]
};
return result;
},
getOpenedByInfo: function() {
var openedByInfo = {};
var openedByGr = this._gr.opened_by.getRefRecord();
openedByInfo = this._catalogSOWUtil.getRequestedUserInfo(openedByGr);
openedByInfo.vip = openedByGr.vip ? true : false;
openedByInfo.sysId = openedByGr.getUniqueValue();
//Added the extra script here
openedByInfo.email = openedByGr.getDisplayValue("email");
var result = {
userInfo: openedByInfo,
heading: sn_i18n.Message.getMessage("sn_sow_req", "Opened by"),
name: openedByGr.getDisplayValue('name'),
vip: openedByInfo.vip,
};
return result;
},
type: 'RequestInfo'
});
RequestedItemInfo Script Include:
var RequestedItemInfo = Class.create();
RequestedItemInfo.prototype = Object.extendsObject(sn_sow_req.RequestedItemInfoSNC, {
getSourceInfo: function() {
var requestorInfo = this.getRequestedForInfo();
//Added the extra script here
requestorInfoGr = this._gr.requested_for.getRefRecord();
requestorInfo.email = requestorInfoGr.getDisplayValue("email");
var result = {
requestorInfo: requestorInfo,
sourceHeading: sn_i18n.Message.getMessage("sn_sow_req", "Requested for"),
name: this._gr.getDisplayValue('requested_for'),
vip: requestorInfo.vip,
assigneeDetails: [{
label: this._gr['opened_by'].getLabel(),
value: {
type: "string",
value: this._gr.getDisplayValue('opened_by')
}
}]
};
return result;
},
getOpenedByInfo: function() {
var openedByInfo = {};
var openedByGr = this._gr.opened_by.getRefRecord();
openedByInfo = this._catalogSOWUtil.getRequestedUserInfo(openedByGr);
openedByInfo.vip = openedByGr.vip ? true : false;
openedByInfo.sysId = openedByGr.getUniqueValue();
//Added the extra script here
openedByInfo.email = openedByGr.getDisplayValue("email");
var result = {
userInfo: openedByInfo,
heading: sn_i18n.Message.getMessage("sn_sow_req", "Opened by"),
name: openedByGr.getDisplayValue('name'),
vip: openedByInfo.vip
};
return result;
},
type: 'RequestedItemInfo'
});
Now the email is added for Requested for and Opened by in both Request and RITM.
Request:
RITM:
If my response helped, please mark it as correct and accept as solution.
Regards,
Rakesh