- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2023 09:22 AM
Hello Everyone,
I have a record producer(incident table), after submitting the form incident will get submitted. In the incident, I have a field as Service(reference - cmdb_ci_service_business) currently it is empty where I need to populate the data which is part of the cmdb table(eg: report). Can anyone explain how I can achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2023 08:57 PM
HI @Supriya KM ,
I trust you are doing great,
You can achive it via Business rule :
(function executeRule(current, previous /*null when async*/) {
// Retrieve data from the CMDB table
var cmdbRecord = new GlideRecord('cmdb_ci_service_business');
cmdbRecord.addQuery('name', 'report'); // Assuming 'report' is the record you want
cmdbRecord.query();
if (cmdbRecord.next()) {
// Set the Service field with the cmdb record
current.u_service = cmdbRecord.sys_id; // Replace 'u_service' with the actual field name
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2023 09:30 AM
Hi @Supriya KM
OOTB Record producer code here. But a Service has many values, are you planning to hard code one value?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2023 08:57 PM
HI @Supriya KM ,
I trust you are doing great,
You can achive it via Business rule :
(function executeRule(current, previous /*null when async*/) {
// Retrieve data from the CMDB table
var cmdbRecord = new GlideRecord('cmdb_ci_service_business');
cmdbRecord.addQuery('name', 'report'); // Assuming 'report' is the record you want
cmdbRecord.query();
if (cmdbRecord.next()) {
// Set the Service field with the cmdb record
current.u_service = cmdbRecord.sys_id; // Replace 'u_service' with the actual field name
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2023 01:18 AM
Hello @Amit Gujarathi
Thank you hope you are doing great!!
Thanks for your prompt answer, it worked for me!!