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

Yes change number is the reference variable.

Hello @sureshp89882164 

 

Did you try the script I shared ? 

 

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

@sureshp89882164 

script I shared should work fine.

Did you try that?

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

Hi Ankur,

Its working fine. And I want to display the short description of catalogue item(request) in change record "Requests" tab.

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