- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2013 09:25 AM
Hi, I have a question I have a field i created on the SC TASK - It reference a Change Request. What I would like to do is add another field that references the "State" Field of the above mentioned Change Request so as the Change Request moves to "Scheduled-Prd" that it would also update the new field of Change Request State that i created on the SC Task. I am doing something similiar on the Change Request Task but that was easy cause i just dot walked the fields. But since SC Task is a completely different table not so easy... Let me know what you think if this is possible and how i could accomplish it. I couldn't reference the Change Request State field i thought if i created a select box with the same fields as the change request how could i get it to update that state?
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2013 07:53 AM
Wendy, you should be able to accomplish this with a business rule on the change_request table so that when that new state field is updated, it updates any catalog tasks with the latest state. I am assuming you have extended sc_task to have a reference field for the Change and another field for the state:
var gr = new GlideRecord('sc_task');
gr.addQuery('u_change', current.sys_id); //search for the current change record
gr.query();
while (gr.next()) {
//update the state
gr.u_change_state = current.state;
gr.update();
}
The business rule would be an After rule on the change_request table for Insert and Update and probably include a condition to only fire when the state field changes - current.state.changes()
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2013 07:53 AM
Wendy, you should be able to accomplish this with a business rule on the change_request table so that when that new state field is updated, it updates any catalog tasks with the latest state. I am assuming you have extended sc_task to have a reference field for the Change and another field for the state:
var gr = new GlideRecord('sc_task');
gr.addQuery('u_change', current.sys_id); //search for the current change record
gr.query();
while (gr.next()) {
//update the state
gr.u_change_state = current.state;
gr.update();
}
The business rule would be an After rule on the change_request table for Insert and Update and probably include a condition to only fire when the state field changes - current.state.changes()
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2013 06:15 AM
This works PERFECTLY... Thanks so much. Only adjustments I made was the field for Change Request State... Thanks again.
var gr = new GlideRecord('sc_task');
gr.addQuery('u_change_request', current.sys_id); //search for the current change record
gr.query();
while (gr.next()) {
//update the state
gr.u_change_request_state = current.state;
gr.update();
}