Modify the Customer Fact Sheet button functionality in SOW for incident and catalog task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone, I have this form action in SOW and I need to do this: Modify the Customer Fact Sheet button functionality in SOW for the Incident and Catalog task so that when clicked, it goes into Related records to show the related list (of course, once it has been added).
Does anyone know how to make this change? The current code is implemented as a client script:
function onClick() {
var gaUser = new GlideAjax('UserUtils');
gaUser.addParam('sysparm_name', 'getUserCompany')
gaUser.addParam('sysparm_user_sysid', g_form.getValue('caller_id'));
gaUser.getXMLAnswer(getCompany);
function getCompany(result) {
if (result) {
g_aw.openRecord('core_company', result);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi @Maria Lucia da,
I'm assuming you're on Service Operations Workspace (not classic Agent Workspace) and this UI action is set up with a Workspace Client Script, same as what you pasted. If that's the case, the g_aw.openRecord call is exactly what's yanking the agent into a brand new core_company tab, so pull that out and swap in this instead:
function onClick(g_form) {
var gaUser = new GlideAjax('UserUtils');
gaUser.addParam('sysparm_name', 'getUserCompany');
gaUser.addParam('sysparm_user_sysid', g_form.getValue('caller_id'));
gaUser.getXMLAnswer(function(result) {
if (result) {
g_form.showRelatedList('incident.company');
}
});
}The part that actually matters here is showRelatedList, that's a standard GlideForm method and it also works from workspace client scripts, it scrolls to and expands a related list on the current form instead of navigating anywhere. The string you pass isn't the table name, it's the related list's internal name in table.field format, you'll find the exact one under System UI > Related Lists. Get that wrong and the call just silently does nothing, which is the thing that trips people up first time.
Two things have to be true before this works though:
- The related list has to exist: there's no out of the box "company's other incidents" list, so you'll need to build one filtered by company or account off Incident, same idea as caller-based related lists
- It has to be added to the workspace view: on the SOW record page go to Form Header, Configure, Related Lists and add it there, it won't show up just because the list definition exists
Same pattern applies for Catalog Task, just point the related list and the onClick script at sc_task instead of incident.
One real gotcha: showRelatedList expands the list inline in the existing Related Records panel, it doesn't create it as its own dedicated tab, if you actually want a separate tab for it in SOW 4.2 and later you're looking at extending sn_sow_record.SOWRouteUtil and overriding getRelatedListConfig instead, which is a bigger lift than a simple button swap.
Thank you,
Vikram Karety
Octigo Solutions INC