How can I get a UI action on agent workspace interaction to directly open a specific catalog item?

georgeprad
Mega Expert

On agent workspace I have a UI action to create request from an interaction. But this UI action opens the service catalog and then the agency has to select a form from the catalog. Instead of this I want the UI action to open a specific form i have created for this and i want the details captured in the interaction to be copied on to this item like the create incident UI action does. Can anyone help me with this? I tried the setRedirectUrl but this did not work. Not sure how to achieve this. 

1 ACCEPTED SOLUTION

T_Prashaanth
Mega Guru

Found the way for this ,it worked.Create a ui action with Workspace Client Script:

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 the catalog item' ,'-1', params); });

}

Mark it correct if this is useful.

View solution in original post

13 REPLIES 13

Hi @T.Prashaanth I just tested it trying to accomplish same thing to open a specific catalog Item via UI Action on Workspace but for cmdb_ci_computer.

 

Do you have any idea if same approach would works?

 

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 = "cmdb_ci_computer"; params.sysparm_parent_sys_id = g_form.getUniqueValue(); g_service_catalog.openCatalogItem('sc_cat_item', '65dabe49d1c0950062a9fabb7186ffc7' ,'-1', params); });

}

 

georgeprad
Mega Expert

Hi Prashaanth

That's brilliant thank you. I was putting the sys_id in the wrong place. This works perfectly! Do you think it would be possible to copy the field values from the interaction to the catalog item you are opening via this UI action? 

Regards

Pradeep

I believe you can do it using the params values and then use those params values in catalog client  script to update values in the form.

Since you will want to pass interaction values to the the catalog item form .You can make use of this to do that.

https://community.servicenow.com/community?id=community_question&sys_id=3dcb8042dbc44818fff8a345ca96...

SebastianB
Tera Guru

Hey,
that is exactly I looked for. But I have one additional question. How can I transfer the "Opened for" User Information to the "Requested by" of the Request Item?

Any ideas?

Thanks and best Regards
Sebastian