Create Change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 05:56 AM
To create change request when 'ABC' field value is xyz ,but the 'ABC' filed is in mapped service table whose value gets autopopulated based on the filed Environment value which is the form filed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 06:12 AM
Hi @SamJam ,
Please create a business rule in ServiceNow that triggers when the 'ABC' field value is 'XYZ' applied to a particular table and then creates a change request.
You can follow these steps:
-
Open the 'Business Rules' module: In the left navigation pane, search for 'Business Rules' and select it.
-
Create a New Business Rule:
- Click the 'New' button to create a new business rule.
-
Fill in Business Rule Details:
- Name: Give your business rule a descriptive name.
- Table: Select the table where the 'ABC' field is located.
- When to run: Choose the appropriate option. In this case, you might select 'Before' to trigger the rule before the record is saved.
-
Add Conditions:
- Under the 'Conditions' section, define the condition that checks if the 'ABC' field value is 'XYZ.' For example:
current.abc == 'XYZ'
-
Script:
-
In the 'Script' section, write a script to create a change request. Here's a simplified example:
var changeRequest = new GlideRecord('change_request'); // Set values for the fields in the new change request record changeRequest.initialize(); // Initialize the record, which is optional but good practice changeRequest.short_description = 'Sample Change Request'; // Set the short description changeRequest.description = 'This is a sample change request created via script.'; // Set the description changeRequest.u_custom_field = 'Custom Value'; // Set any custom fields as needed // Insert the new change request record var changeRequestId = changeRequest.insert(); gs.addInfoMessage('Change request ' + changeRequestId + ' has been created.');
-
Save and Activate:
- Save the business rule.
- Make sure to activate it for it to take effect. Set Active = True.
-
Test:
- Test the business rule by updating a record where the 'ABC' field is 'XYZ.' The business rule should create a change request automatically.
-
If this helped you in any way, please hit the like button/mark it helpful. So it will help others to get the correct solution.
regards,
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 06:44 AM
The condition is when the 'install status is production and user for is production' create change request,so for the install status already an runscript is created in workflow wanted to add one more condition i.e used for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 06:49 AM
Install status field value is submitted through catalog item.