How to close catalog task after change request state is closed ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 08:32 AM
Hi Team,
Good Day,
I created Normal change Request from the catalog task by using UI Action , Now i have three requirements
1. how to Make relation between Change request and catalog Task.
2. catalog task should be closed once Change is closed.
3. how to add worknotes in change request ex..
- Created from Task.
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 09:30 AM
Hi @Dhanu1 ,
1. how to Make a relation between Change request and catalog Task:
To relate the Change Request to the Catalog Task, you can create a reference field in the sc_task table to store the sys_id of the associated Change Request.
2. catalog task should be closed once Change is closed: You can write a Business rule to make it happen when ever change is closed to close the catalog task.
3. how to add worknotes in change request ex..
- Created from Task.: You can add a work note when creating the Change Request from the catalog task to indicate its source. This can be done in the same UI Action where the Change Request is created.
Let me know if you have any questions on the above.
Please mark my answer as correct/helpful if applicable.
Thanks,
Pradeep
Regards,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 03:54 AM
Hi Pradeep, Thank for your reply.
2. catalog task should be closed once Change is closed: You can write a Business rule to make it happen when ever change is closed to close the catalog task. - If possible you have any similar script ?
3. how to add worknotes in change request ex..
- Created from Task.: You can add a work note when creating the Change Request from the catalog task to indicate its source. This can be done in the same UI Action where the Change Request is created. i wrote script as shown below , it is working for incident but for change it is not working, kindly help me on this(function(current, previous, gs, action) {var changeRequest = ChangeRequest.newNormal();changeRequest.setValue("short_description", current.short_description);changeRequest.setValue("description", current.description);//changeRequest.setValue("cmdb_ci", current.u_configuration.u_configuration_item);changeRequest.setValue("cmdb_ci", current.cmdb_ci);//changeRequest.setValue("u_configuration", current.u_configuration);// changeRequest.setValue("category", current.category);// changeRequest.setValue("u_sub_category", current.subcategory);changeRequest.setValue("requested_by", current.request.requested_for);changeRequest.setValue("assignment_group", current.assignment_group);changeRequest.setValue("u_regional_group", current.u_regional_group);changeRequest.setValue("parent", current.sys_id);changeRequest.setValue("work_notes", current.getValue("number"));//changeRequest.work_notes = "Converted from " + " " + current.number;Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 03:04 AM
Hello Team,
Any one please guide me on the attached After business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:56 PM
Hi @Dhanu1 ,
Give a try with below script,
// Check if the change request is closed
if (current.state == 3) {
// Query the catalog tasks related to this change request
var catTaskGR = new GlideRecord('sc_task');
catTaskGR.addQuery('change_request', current.sys_id);
catTaskGR.addQuery('state', '!=', 3); // Check if the catalog task is not already closed
catTaskGR.query();
while (catTaskGR.next()) {
// Set the catalog task state to Closed
catTaskGR.state = 3;
catTaskGR.update();
}
}
Please mark my answer as correct/helpful if applicable.
Thanks,
Pradeep
Regards,
Pradeep