catalogue item request number display in change record requests tab

sureshp89882164
Tera Contributor

change management catalogue item request number need to display in the change record "Requests" tab. This Catalogue item is using work flow.

In the flow designer using with Actions "update record" we can achieve this one. Can you help me on how to achieve this one in work-flow.

4 ACCEPTED SOLUTIONS

Hello @sureshp89882164 

 

Please use activity "Run Script" after the point where you want to add change request. 

 

In the script part of that activity add below 👇 code - 

 

// Get the Catalog Request (sc_request) record linked to this item
var req = new GlideRecord('sc_request');
if (req.get(current.request)) { // Ensure we have a valid request
    req.parent = current.variables.your_change_request_field; // Replace with the actual field storing Change Request
    req.update();
}

Modify it to reflect your change request number field name. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@sureshp89882164 

in your workflow run script of catalog item simply use this line

Is that change number a reference variable?

var chg = current.variables.changeVariableName.getRefRecord(); // give variable name here
chg.parent = current.getUniqueValue();
chg.update();

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

View solution in original post

Chaitanya ILCR
Kilo Patron

Hi @sureshp89882164 ,

Add a run script activity in the workflow with below script

var requestGr = current.request.getRefRecord();
requestGr.parent = current.variables.Change_Variable_Name;/*replace this ->Change_Variable_Name with actual variable name*/
requestGr.update();

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

Hi @sureshp89882164 ,

you can update the same run script in the workflow

var requestGr = current.request.getRefRecord();
requestGr.parent = current.variables.Change_Variable_Name;/*replace this ->Change_Variable_Name with actual variable name*/
requestGr.short_description = current.cat_item.short_description;
requestGr.update();

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

22 REPLIES 22

Shivalika
Mega Sage

Hello @sureshp89882164 

 

How are you getting rhe change request number to update it ? Is changed request being created by this catalog item ? 

No, change number is field of the catalogue item. Please refer the attachment same.

Hello @sureshp89882164 

 

Please use activity "Run Script" after the point where you want to add change request. 

 

In the script part of that activity add below 👇 code - 

 

// Get the Catalog Request (sc_request) record linked to this item
var req = new GlideRecord('sc_request');
if (req.get(current.request)) { // Ensure we have a valid request
    req.parent = current.variables.your_change_request_field; // Replace with the actual field storing Change Request
    req.update();
}

Modify it to reflect your change request number field name. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Ankur Bawiskar
Tera Patron
Tera Patron

@sureshp89882164 

in your workflow run script of catalog item simply use this line

Is that change number a reference variable?

var chg = current.variables.changeVariableName.getRefRecord(); // give variable name here
chg.parent = current.getUniqueValue();
chg.update();

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