Open the specific record producer when the UI action is clicked

SK41
Giga Guru

Hi,

I have a requirement where i have to take the user to a record producer (name XYZ) when he clicks on the related link "Create Request" in interaction form and set the status to "close" of  the interaction and copy the interaction description to request description.

Below is the script i have written in Create Request, and it is taking to the record producer but it is not copying the short description and status of interaction to close.

onClick: OpenReq()

Script: 

function OpenReq()

{

var url= 'com.glideapp.servicecatalog_cat_item_view.do?v=2323230930380832';

g_navigation.openPopup(url);

current.state='closed_complete';

current.update();

}

 

This UI Action is on interaction form. The state is not copied and how to copy the interaction description to request decription.Kindly, help me in this regard.

Thanks!

1 ACCEPTED SOLUTION

Hello,

I found the solution for state not getting closed. 

After the code for opening the request url i call the fom element and used it to call another function and in that set the state to closed.

It is working fine. Below is the screenshot for reference:find_real_file.png

 

Thanks for the help!

View solution in original post

13 REPLIES 13

kunal20
Kilo Guru

Hi,

In the UI action you need to use GLideRecord in Request table and there set the description;

gr.short_description=current.short_description;

gr.update();

Please mark this as helpful.

 

i want to open specific catalog item.Gliding the sc_request will not fulfill that.It will create a generic request.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Do this

1) pass the interaction description as url parameter

2) then use onLoad catalog client script and get the url parameter value and store in text variable and hide this text variable always

3) then in record producer script set the short_description

current.short_description = producer.hiddenVariableName;

UI Action

function OpenReq(){
	var url= 'com.glideapp.servicecatalog_cat_item_view.do?v=2323230930380832&sysparm_description=' + g_form.getValue('description');
	g_navigation.openPopup(url);
}

onLoad Catalog Client Script:

function onLoad(){
	var url = top.location.href;
	var value = new URLSearchParams(url).get('sysparm_description');
	g_form.setValue('hiddenVariableName', value);
	g_form.setDisplay('hiddenVariableName', true);
}

Regards
Ankur

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

I need to set another variable value in request,like description. Need to set contact typevalue of interaction to contact type field of request.How to pass both of them in url?

Also, i need to set the interaction in closed state when UI Action is clicked. But, it does not work if do that in UI Action. Please suggest.