- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 11:41 AM
In the process of creating a new change request for a selection of specific categories (for example: selecting "ABC" category) the user wants to see only a specific class of resources (Server - cmdb_ci_server) instead of all CIs and for other categories want to see all the ci
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 09:33 PM
HI @saptarshiamc ,
I trust you are doing great.
Create a Business Rule:
Navigate to "System Definition" > "Business Rules" in the ServiceNow application.
Click on "New" to create a new Business Rule.
Provide a suitable name and description for the Business Rule.
Set the "Table" field to "change_request" to target the change request table.
In the "Advanced" section, enter the following code:
(function executeRule(current, previous /*null when async*/) {
if (current.category == "ABC") {
current.cmdb_ci = "cmdb_ci_server";
} else {
current.cmdb_ci = "";
}
})(current, previous);
Save the Business Rule.
Modify the Change Request form:
Navigate to "System Applications" > "Customize Form" in the ServiceNow application.
Search for and open the "Change Request" form.
Edit the form layout.
Locate the "Configuration item" field.
In the "Default Value" section of the field properties, enter the following code:
javascript:if(g_form.getValue('category') == 'ABC') { 'cmdb_ci_server'; } else { ''; }
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
06-12-2023 09:33 PM
HI @saptarshiamc ,
I trust you are doing great.
Create a Business Rule:
Navigate to "System Definition" > "Business Rules" in the ServiceNow application.
Click on "New" to create a new Business Rule.
Provide a suitable name and description for the Business Rule.
Set the "Table" field to "change_request" to target the change request table.
In the "Advanced" section, enter the following code:
(function executeRule(current, previous /*null when async*/) {
if (current.category == "ABC") {
current.cmdb_ci = "cmdb_ci_server";
} else {
current.cmdb_ci = "";
}
})(current, previous);
Save the Business Rule.
Modify the Change Request form:
Navigate to "System Applications" > "Customize Form" in the ServiceNow application.
Search for and open the "Change Request" form.
Edit the form layout.
Locate the "Configuration item" field.
In the "Default Value" section of the field properties, enter the following code:
javascript:if(g_form.getValue('category') == 'ABC') { 'cmdb_ci_server'; } else { ''; }
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi