Populate RITM to the worknotes

Rushikesh5
Giga Guru

Hi All,

My requirement is like

1. If I open a change form and click on the order button [which I created by UI action]

2. Then it should redirect to the service portal to a particular item [This is done]

3. After the catalog item is requested then the RITM number should populate in the work notes of the change form i.e. for example RITMXXXX is created

Can you help me with this

Thanks,

Rushikesh

1 ACCEPTED SOLUTION

then update as this

action.setRedirectURL('sp?id=sc_cat_item&sys_id=119c3de01b02011014d099f7b04bcb02&sysparm_chg=' + current.sys_id);

Then have onLoad catalog client script on your catalog item

function onLoad(){
	var url = top.location.href;
	var chg = new URLSearchParams(url).get("sysparm_chg");
	g_form.setValue('variableName', chg);
}

Then have workflow run script

var chg = new GlideRecord('change_request');

if(chg.get(current.variables.variableName)){
	chg.work_notes = current.number + ' is created';
	chg.update();
}

You need to create text variable and hide it always on catalog form and RITM form as well

Regards
Ankur

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

View solution in original post

21 REPLIES 21

the script is

action.setRedirectURL('sp?id=sc_cat_item&sys_id=119c3de01b02011014d099f7b04bcb02');

then update as this

action.setRedirectURL('sp?id=sc_cat_item&sys_id=119c3de01b02011014d099f7b04bcb02&sysparm_chg=' + current.sys_id);

Then have onLoad catalog client script on your catalog item

function onLoad(){
	var url = top.location.href;
	var chg = new URLSearchParams(url).get("sysparm_chg");
	g_form.setValue('variableName', chg);
}

Then have workflow run script

var chg = new GlideRecord('change_request');

if(chg.get(current.variables.variableName)){
	chg.work_notes = current.number + ' is created';
	chg.update();
}

You need to create text variable and hide it always on catalog form and RITM form as well

Regards
Ankur

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

@Rushikesh 

Glad to know that my approach worked.

Please mark response helpful as well.

Regards
Ankur

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

Hi,

As always thank you @Ankur Bawiskar for your time and efforts

Really Appreciated your work

 

Thanks,

Rushikesh

Hi,

Just one small change is needed I have to populate the RITM number in the work notes but it's populating in the activities of change request

Thanks,

Rushikesh