- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 02:34 AM
Hello,
Wa recentely started to use a Problem module. I have a question: how to copy the Impacted CI's field from the Problem form to an Affected CI's field of the Problem Task' form. I also want to have a condition, if Impacted CI's field changes in the Problem, so the value in the Affected CI's field in Problem Task changes too.
The fields 'Impacted CI' and 'Affected CI' have different types. So I wanted to know what is the best way to do it?
The Impacted CI's field on the Problem form:
The affected CI's field on the Problem Task's form:
Thank you in advance for your answers,
Elena
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:36 AM
Hi @Elena7 Sorry for the confusion, Can you Please revert back to the initial version of my Business Rule on "Problem task "table and on top of it Create a new Business rule on the "Problem" table as below:
(function executeRule(current, previous /*null when async*/ ) {
var PT = new GlideRecord('problem_task');
PT.addQuery('problem', current.sys_id);
PT.query();
while (PT.next()) {
PT.cmdb_ci = current.cmdb_ci;
PT.update();
}
})(current, previous);
Thanks & Regards,
Eswar Chappa
Mark my answer correct and Helpful if this helps you 😀
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 03:21 AM
Hi @Elena7 ,
This should be possible through a business rule and a script to do an automatic update.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 04:33 AM
Hello @AndersBGS ,
Thank you for your answer. Do you have an example of a Business rule. As the fields 'Impacted CI' and 'Affected CI' have different types, I don't know how to do it.
Thank you in advance,
Elena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 12:23 AM
Hi @Elena7 ,
I can see that many scripts has been provided, did you make it work or do you need any additional information?
f my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 06:26 AM - edited 09-06-2023 10:57 PM
Hello @Elena7
The affected CIs table is task_ci. You have to create a business rule on the problem record with the after-update condition Impacted CI changes. GlideRecord problem task table with problem and then problem task table with task_ci tables. Update the task CI configuration item field with the problems impacted CI field. Refer to below script.
var problemTask = new GlideRecord('problem_task');
problemTask.addQuery('problem', current.sys_id);
problemTask.query();
while(problemTask.next()){
var taskCI = new GlideRecord('task_ci');
taskCI.addQuery('task', problemTask.sys_id );
taskCI.query();
while(taskCI.next()){
taskCI.ci_item = current.u_impacted_cis; // impacted ci field
taskCI.update();
}
}
Mark my answer correct and Helpful if this helps you
Thank you!!