- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 01:09 AM
Interactions have an UI action for creating requests - 'Create Request'
I would like the interaction to be closed when this button is clicked. I have been able to do this on the create incident and associate record UI actions but am not able to do this on the Create Request UI action. The difference between these are that the Create Incident and Associate Record have scripts in both sections (workspace and outside) whereas the Create Request UI action only has script in the workspace client section. Below is the script I have in there at the moment. I have modified this slightly to open a particular catalog item. I just want the interaction to close once I click the button. I have tried g_form to change the state of the interaction and save this but it does not make this change to the interaction and when it did, the remainder of the script didn't work and it did not open the catalog item.
function onClick() {
var result = g_form.submit('sysverb_ws_save');
if (!result) { // failed form submission
return;
}
result.then(function() {
var params ={};
params.sysparm_parent_table = "interaction";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item','sys_id of item', '-1', params);
});
}
I have a deadline fast approaching on this project so your help would be very much appreciated. Thank you.
Solved! Go to Solution.
- Labels:
-
Agent Workspace
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 07:25 AM
I managed to do this by changing the script as below. Not sure if this is recommended. Please comment if you have a better method.
One of the other requirements was to change the assigned_to on the interaction to the current user. I was not able to do this using g_form. Please let me know if you have a solution for this as well. Thank you.
function onClick(g_form) {
g_form.setValue('state', 'closed_complete');
g_form.save();
// var result = g_form.submit('sysverb_ws_save');
// if (!result) { // failed form submission
// return;
// }
// result.then(function() {
var params = {};
params.sysparm_parent_table = "interaction";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item', '1afd64881b23c0106956535c2e4bcba6', '-1', params);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2020 07:25 AM
I managed to do this by changing the script as below. Not sure if this is recommended. Please comment if you have a better method.
One of the other requirements was to change the assigned_to on the interaction to the current user. I was not able to do this using g_form. Please let me know if you have a solution for this as well. Thank you.
function onClick(g_form) {
g_form.setValue('state', 'closed_complete');
g_form.save();
// var result = g_form.submit('sysverb_ws_save');
// if (!result) { // failed form submission
// return;
// }
// result.then(function() {
var params = {};
params.sysparm_parent_table = "interaction";
params.sysparm_parent_sys_id = g_form.getUniqueValue();
g_service_catalog.openCatalogItem('sc_cat_item', '1afd64881b23c0106956535c2e4bcba6', '-1', params);
}