Create a change after RITM is created in workflow

sai kiran1
Tera Contributor

After the approvals, a Standard Change should be created and assigned to the group "XXX ", the RITM & RITM Task get auto closed after the change is created and the change should relate to the RITM previously created using as reference two templates created as part of this request "ABCD ".

 

The ask is to create a standard change after RITM gets approved, RITM should be auto-closed soon after standard change is created in a workflow for a catalog item.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@sai kiran1 

you can use Create Task Activity in workflow and create the change.

you can use run script to close RITM and SC Task just before this activity

what did you start with and where are you stuck?

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

sai kiran1
Tera Contributor

Hi Ankur,

Trying to create a change from business rule, with the code as follows,

(function executeRule(current, previous /*null when async*/) {
 
    // Create a new Change Request
 var gr = new GlideRecord("change_request");
gr.newRecord();
gr.type = 'standard';
//var chgProducerVersion = "7b96a1bd87d76d10b15677f7cebb35b3"; //sys id of the change record producer version
//var chgTemplate = new GlideRecord("std_change_producer_version");//producer version
//chgTemplate.get("sys_id", chgProducerVersion);
 
var template = GlideTemplate.get(chgTemplate.std_change_producer.template);
template.apply(gr);
gs.log("STRY0039872" + "created");
 gr.work_notes = "Change has been created using the template - " + chgTemplate.std_change_producer.name;
 gr.shtdesc="Offboarding of WAF Site(s)";
gr.desc=Modifying or removing the external DNS CNAME records to point to the Akamai Web Application Firewall for the list of websites included in this change record.  The related Record tab contains the associated RITM.
gr.justification=Justification is provided in the work notes of the change for each site.
gr.implementationpaln=The external CNAME DNS record for each website will be modified or removed.
gr.riskimpactaanalysis=There is potential for a website to be offline if the CNAME record is input incorrectly in external DNS or if the record in the Akamai WAF is not pointing to the correct IP or CNAME record of the website.;
 gr.backoutplan="Revert the external DNS change back to the previous settings.";
 gr.testplan="The vendors have communicated with the website owners in regard to the DNS record change.  The website owners are aware of the DNS cutover date and time and will test functionality to confirm that their website is accessible once they are notified that the DNS change has been completed.";
gr.worknotes="The Offboarding table question related to the RITM ";
gr.insert();
 
})(current, previous);
The above code is not working to create a change
Here we are asked not to create a task.
Am  stuck at creating the change itself unable to move further. please assist.