UI Action to link REQ with Interaction

Gudipati Hemala
Tera Contributor

I have a requirement to create a custom UI action called "Create Request" button on 'Interaction' record. 

find_real_file.png

upon clicking on 'Create Request' button the following action should happen.

1. It should be redirected to the catalog item page in service portal. and user can select any catalog item and 'Requested for' variable should be copied as 'Opened for' from the 'Interaction' record .

lfind_real_file.png

 

2. After submission of the catalog item, Request (REQ) should be linked with 'Interaction' record as below.

 

find_real_file.png

 

Thanks!

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so where are you stuck?

what did you start?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Gudipati Hemalatha ,

You can send url of catalog item and sending opened for sys_id in the URL

for eg. - 
url = "sp?id=sc_cat_item&sys_id=060f3afa3731300054b6a3549dbe5d3e" + "&sysparm_opened_for_sys_id=" + current.opened_for;
action.setRedirectURL(url);

Write onload client script check the below link fetch data from url to client script and set requested for variable as a opened for.

https://community.servicenow.com/community?id=community_question&sys_id=6426e7e2dbf13c14679499ead39619f4.

 

Hi Ankur,

Issue is I'm not able to pass  'Opened for' value from the 'Interaction' record to selected catalog item and after submission of the catalog item I'm not able fetch REQ number/REQ SysId back to UI action in order to link REQ with Interaction.

Hi,

Did you check the OOB UI action

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I did, The OOB UI action takes to the below itil/backend page, here it allows to select catalog item and after ordering catalog item automatically links Interaction record with REQ.

find_real_file.png

 

But my concern is I wanted to redirect to the service portal catalog item page and after submission of catalog item, I need to get the REQ sysid back to the UI action.

 

Here is my current script:

Name : Create Request

Table: Interaction

Show Update :True

Form button :True

script:


var url;

var activeCatalogsCount = sn_sc.Catalog.getCatalogCount();

if (activeCatalogsCount === 1) {

url = "catalog_home.do?sysparm_view=catalog_default&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;

//url = "sp?id=sc_category&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;

} else {

url = "catalogs_home.do?sysparm_view=catalogs_default&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id;

//url = "sp?id=sc_category&sysparm_parent_table=" + current.sys_class_name + "&sysparm_parent_sys_id=" + current.sys_id ;

}

action.setRedirectURL(url);