CI record creation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 10:47 PM
I am facing a challenge, if an asset record is created manually, the associated CI record is not getting created. How to resolve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 11:41 PM
Hi Debasish,
To ensure that a Configuration Item (CI) record is created automatically when an asset record is created manually, you can implement one of the following solutions:
************************Use a Business Rule:
You can create a Business Rule on the alm_asset
table to automatically create a CI record when a new asset record is created.
Steps:
-
Navigate to System Definition > Business Rules.
-
Click on New to create a new Business Rule.
-
Configure the Business Rule with the following details:
- Name:
Create CI on Asset Creation
- Table:
alm_asset
- When:
Before
(orAfter
, depending on your requirement) - Insert: Checked
(function executeRule(current, previous /*null when async*/) {
// Check if the asset is associated with a model that has an associated CI class
if (current.model_id.ci_class) {
var ciGr = new GlideRecord(current.model_id.ci_class);
ciGr.initialize();
// Set necessary fields
ciGr.name = current.name || current.display_name;
ciGr.asset = current.sys_id;
ciGr.install_status = current.install_status; // Or map to a corresponding CI field
ciGr.location = current.location;
ciGr.assigned_to = current.assigned_to;
// Add more fields as necessary// Insert the CI record
ciGr.insert();
}
})(current, previous);
- Name:
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2024 02:31 AM
Hi,
The Asset is created by the UI action or by script ?
If by script, you need to ensure you don't have the "setWorkFlow(false)" option in your GlideRecord as it will prevent the run of Business rules and it is a BR that is creating the CI based on the Asset Model Category.
If it is by the UI, you need to ensure that the BR is still active.
You can check this support article :
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0999333