- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2018 07:17 PM
Hi,
I am trying to create a Standard Change template with multiple Affected CI. I can easily set the Affected CI field that accepts a single CI. I need to populated the list on the Affected CI tab with many CIs though.
Any ideas?
Thank you
Jake
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 01:17 PM
Here is my suggestion since this is not baseline functionality (which I believe would provide value if it was).
1. Log an Enhancement in HI 😉
2. Leverage the suggestion I have below until there is a permanent solution
There are many layers to the Standard Change functionality and the important thing to understand is where best to put the Affected CI data. Since the Standard Change Template is really a Record Producer, it doesn't fit where I would want to include the Affected CIs. Even if I did put it there is would require scripting and new fields, and yadda yadda yadda. The Standard Change Proposal however is a Task, and as a Task has the Affected CI (task_ci) list. Configure your Standard Change Proposal Related Lists and add the Affected CIs list. There you can add the CIs you want copied over to your Standard Change. In order to get the list from the Proposal to the Standard Change you would write a Business Rule.
Suggested Steps:
1. Add Affected CI Related List to the Standard Change Proposal
2. Add your Affected CIs to that list
3. Write a Business Rule (After Insert of a Standard Change) on the Change Request table (see below)
(function executeRule(current, previous /*null when async*/) {
//Add function to include Affected CIs
var stdP = new GlideRecord('std_change_proposal');
if(stdP.get('sys_id', current.std_change_producer_version.std_change_proposal)){
var affCI = new GlideRecord('task_ci');
affCI.addQuery('task',stdP.sys_id);
affCI.addNotNullQuery('ci_item');
affCI.query();
while(affCI.next()){
var taffCI = new GlideRecord('task_ci');
taffCI.initialize();
taffCI.task = current.sys_id;
taffCI.ci_item = affCI.ci_item;
taffCI.insert();
}
}
})(current, previous);
Optional
Since my Standard Change Process should look at successfully implemented Changes (that should mean I have a Change that already has everything I need), I might want to capture that specific Change on the Proposal (vs the List Variable that is on the Proposal Record Producer/ Proposal Record). Sure you can use the list of similar Changes, but why write a script to parse through the list when you can just have one that is your poster child for the Standard Change. Add a Primary Change Variable to the Record Producer (Propose/Modify), and have the corresponding field on the Proposal Record. Then you can leverage that record to populate the Affected CI List automatically on the Proposal Records vs manually adding them. Plus you have a way to dot walk to that original Change for information if you need it.
Example Business Rule (After Insert and Primary Change is not Empty) on the Standard Change Proposal table
Business Rule
(function executeRule(current, previous /*null when async*/) {
var affCI = new GlideRecord('task_ci');
affCI.addQuery('task',current.u_primary_change);
affCI.addNotNullQuery('ci_item');
affCI.query();
while(affCI.next()){
var taffCI = new GlideRecord('task_ci');
taffCI.initialize();
taffCI.task = current.sys_id;
taffCI.ci_item = affCI.ci_item;
taffCI.insert();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 01:17 PM
Here is my suggestion since this is not baseline functionality (which I believe would provide value if it was).
1. Log an Enhancement in HI 😉
2. Leverage the suggestion I have below until there is a permanent solution
There are many layers to the Standard Change functionality and the important thing to understand is where best to put the Affected CI data. Since the Standard Change Template is really a Record Producer, it doesn't fit where I would want to include the Affected CIs. Even if I did put it there is would require scripting and new fields, and yadda yadda yadda. The Standard Change Proposal however is a Task, and as a Task has the Affected CI (task_ci) list. Configure your Standard Change Proposal Related Lists and add the Affected CIs list. There you can add the CIs you want copied over to your Standard Change. In order to get the list from the Proposal to the Standard Change you would write a Business Rule.
Suggested Steps:
1. Add Affected CI Related List to the Standard Change Proposal
2. Add your Affected CIs to that list
3. Write a Business Rule (After Insert of a Standard Change) on the Change Request table (see below)
(function executeRule(current, previous /*null when async*/) {
//Add function to include Affected CIs
var stdP = new GlideRecord('std_change_proposal');
if(stdP.get('sys_id', current.std_change_producer_version.std_change_proposal)){
var affCI = new GlideRecord('task_ci');
affCI.addQuery('task',stdP.sys_id);
affCI.addNotNullQuery('ci_item');
affCI.query();
while(affCI.next()){
var taffCI = new GlideRecord('task_ci');
taffCI.initialize();
taffCI.task = current.sys_id;
taffCI.ci_item = affCI.ci_item;
taffCI.insert();
}
}
})(current, previous);
Optional
Since my Standard Change Process should look at successfully implemented Changes (that should mean I have a Change that already has everything I need), I might want to capture that specific Change on the Proposal (vs the List Variable that is on the Proposal Record Producer/ Proposal Record). Sure you can use the list of similar Changes, but why write a script to parse through the list when you can just have one that is your poster child for the Standard Change. Add a Primary Change Variable to the Record Producer (Propose/Modify), and have the corresponding field on the Proposal Record. Then you can leverage that record to populate the Affected CI List automatically on the Proposal Records vs manually adding them. Plus you have a way to dot walk to that original Change for information if you need it.
Example Business Rule (After Insert and Primary Change is not Empty) on the Standard Change Proposal table
Business Rule
(function executeRule(current, previous /*null when async*/) {
var affCI = new GlideRecord('task_ci');
affCI.addQuery('task',current.u_primary_change);
affCI.addNotNullQuery('ci_item');
affCI.query();
while(affCI.next()){
var taffCI = new GlideRecord('task_ci');
taffCI.initialize();
taffCI.task = current.sys_id;
taffCI.ci_item = affCI.ci_item;
taffCI.insert();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2018 03:21 PM
Big thank you Gary, your first solution and code worked perfectly!
Can I please ask if you could suggest any resources to learn the Service Now object model (entities like GlideRecord)/framework to code with.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 05:21 AM
Hi, reading the above case and advise given.. Per today.. is support for multiple affected CI's from standard change template OOTB supported/possible. Like to avoid customizations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2023 04:40 AM
Use Dynamic CI Group function OOTB
first create CMDB Group and the dynamic query
then create the Dynamic CI Group - which is a type of CI
then when you add it to a change or incident etc. the Affected CIs is populated by the CIs that are part of the group