- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2022 10:34 PM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 03:40 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2022 11:44 PM
Hi,
but unless you have some link between CHG and RITM how would system know which RITM number to update in work notes of CHG
are you holding CHG in any of the variable of catalog item?
if not then I can suggest an approach
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 12:20 AM
Hi,
I have created a button on the change form which should redirect to the particular catalog item
and when we order that catalog item then the RITM of that item should be populated in the
work notes of the change form (the same form from which I redirect to the portal after clicking
on the button)
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 12:27 AM
Hi,
I got what you are achieving.
but I believe you didn't get my question
unless you have some link between CHG and RITM how would system know which RITM number to update in work notes of CHG
are you holding CHG in any of the variable of catalog item?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 12:30 AM
are you holding CHG in any of the variable of catalog item= No
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 12:43 AM
Hi,
then unless you link you won't know
1) create string variable and hide it always using UI policy
2) pass the CHG sys_id when you are redirecting to catalog item
3) on load of catalog item get the url parameter and populate the string variable
4) then use workflow run script and update work notes of CHG
var chg = new GlideRecord('change_request');
if(chg.get(current.variables.changeVariableName)){
chg.work_notes = current.number + ' is created';
chg.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader