
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-26-2022 03:32 PM
Requirement: In Agent WorkSpace if the ServiceDesk technician is on the Interaction Page. Give them an option to Navigate to a New Incident or a New Catalog Item with prefilled data that he/she already selected while talking to the Customer on the phone.
This will save Agent Time while creating a new Incident/Request.
Proposed Solution: Created two custom fields on the Interaction page as below-
- Requested Support for (as Choice)
- Select Catalog Item (Visible only if Choice 'Create Request' is selected in 'Requested Support for')
The field 'Requested Support for' has few values for Agent to select (the Type of Service caller is requesting)
A UI Policy: Catalog Item Create
is created to show the control 'Select Catalog Item' only if 'Requested support for' is 'Create Request'
The interaction page may look like this and upon Agent's Save (or any UI Action) click, call a Client Script to build a URL for Request transfer.
For testing purposes, I did that on 'onSubmit' of the Interaction.
function onSubmit() {
//Type appropriate comment here, and begin script below
var supportFor = g_form.getValue("u_requested_support_for").toString();
if (supportFor == 'Create Request') {
fncsTranferToRequest();
//Close record after save with BR
}
}
function fncsTranferToRequest() {
var maintainItemSysId = g_form.getValue('u_select_catalog_item'),
interactionSysId = g_form.getUniqueValue(),
openedFor = g_form.getValue("opened_for"),
type = g_form.getValue("type");
var params = {};
//params.sysparm_parenttable = "interaction";
//params.sysparm_interactionSysId = interactionSysId;
params.sysparm_openedfor = openedFor;
params.sysparm_type = type;
g_service_catalog.openCatalogItem('sc_cat_item', maintainItemSysId, params);
}
The URL may look like this and we need to parse the parameters for further processing.
We can write a Catalog Client Script to any of the Catalog Items and parse the URL to populate the values which were transferred from Interaction to Catalog Item via URL parameters.
Catalog Client Script: Pull details from Interaction
- Applies to: A Catalog Item Type: onLoad
- UI Type: Mobile / Service Portal Catalog Item: ServiceNow Support
function onLoad() {
//Type appropriate comment here, and begin script below
var url = top.document.URL;
var onbehalfPattern = new RegExp('(?<=openedfor\/)(.*)(?=\/sysparm)');
var onbehalf = onbehalfPattern.exec(url).toString();
alert(onbehalf);
g_form.setValue('requested_for', parseData(onbehalf));//'fa66eed42ff72010238d309cf699b6f4');
var typePattern = new RegExp('(?<=type\/)(.*)');
var type = typePattern.exec(url);
alert(type);
if (type) {
g_form.setValue('contact_type', type[0]);
}
}
function parseData(i_input) {
var returnStr = "";
if (i_input != "") {
i_input = i_input + '';
var arrInput = i_input.split("/");
returnStr = arrInput[0].toString();
if(returnStr.indexOf(',') > -1){
var arrReturnStr = returnStr.split(',');
returnStr = arrReturnStr[0].toString();
}
}
return returnStr;
}
Finally, the data is transferred to the Catalog form, here Agent can fill in the other required variables before Ordering it 🙂