Show all RITM's variable for a Request using a UI Action

DevYadav
Tera Contributor

Hi everyone,

I need help with a requirement related to Service Catalog Requested Items (RITMs).
https://www.servicenow.com/community/developer-forum/show-all-ritms-for-a-request-using-a-ui-action/...
 I am working on new but separate requirement, can everyone help on that @Ankur Bawiskar 

Each RITM contains a reference-type variable shown via the Variable Editor (e.g., referencing an incident table). I want to add a UI Action button on the RITM form such that when it's clicked, instead of showing the RITM details in a popup or new tab, it should open the referenced record from that variable directly in a modal or a new tab.
thanks 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@DevYadav 

you can use this logic and that record will open in new tab in browser

This will work in native, to make this work in workspace client script you can use workspace client script

UI Action: on sc_req_item table

Client - True

Onclick - showRITM()

Script:

function showRitm(){
var variableValueSysId = g_form.getValue('variables.variableName'); // give your variable name
var url = '/tablename.do?sys_id=' + variableValueSysId; // give your table name here
g_navigation.open(url, '_blank');
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

DevYadav
Tera Contributor

Hi @Ankur Bawiskar thanks for the reply, the scenario is:
There is a button on the sc_request form. When this button is clicked, instead of displaying the associated RITM number, it should display the details of a specific variable that exists within the variable editor. The variable in question is a reference type, so the expectation is to show the referenced record’s field values..

@DevYadav 

then do this

I hope you are aware on how GlideAjax works

function showRitm(){
// use GlideAjax here and pass REQ sysId, the script include will return the variable value
// then use below script
var variableValueSysId = responseFromAjax;
var url = '/tablename.do?sys_id=' + variableValueSysId; // give your table name here
g_navigation.open(url, '_blank');
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@DevYadav 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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