- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 01:10 PM
I found this great resource that uses a Business Rule to call a custom API endpoint over REST: https://www.transposit.com/devops-blog/itsm/creating-webhooks-in-servicenow/
I set up a Business Rule on my ServiceNow account to execute my custom script after a table is updated, but now I need to scale up my solution to automate the process for other ServiceNow customers. ServiceNow has great documentation for Business Rules (https://docs.servicenow.com/bundle/sandiego-application-development/page/script/business-rules/conce...) but I do not see anything about dynamically creating a new rule. Does anyone know how to programmatically create a Business Rule using the ServiceNow API?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 01:59 PM
Capture the business rule in an update set, export it and provide the file to whomever you like. They can import the update set, preview and commit it. (The same can be done with just an xml export of the BR). I can't speak on using REST, doesn't seem appropriate to use to make configuration changes to an instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 09:52 AM
Update sets are typically done on a dev instance. Once ready to promote to QA/test instance, and after testing there, they are promoted to the production instance. You set up the relationship in QA/test using the "Update Sources" module under "System Update Sets" to add the dev instance as a 'Remote instance'. Once done, you can open the 'Remote Instance' and on that form is a Related Link there named "Retrieve Completed Update Sets". That will pull any non-existent update set that is in the Completed state on the source instance. Preview and commit. And this is a manual process performed by an admin user. Working with update sets 'programmatically is not possible that I know of. See screenshot.
If you want to know when any table is changed, then you can create a business rule on sys_db_object and sys_dictionary, that notifies you via some Event defined. I suggest you post another question here on that. And on "to automatically create and destroy the Business Rule, even just using my existing ServiceNow module, ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 07:09 AM
Moving update sets between your instances (your company insances: dev, test, ..., production) is done by setting up a relationship among your instances based on your instance 'hierarchy'. Using the "Update Sources" module in your instances. It can't be done between companies for data security reasons. You may be able to use REST to query your 'source' instance to retrieve update sets from your sys_update_set table, and the corresponding records from the sys_update_xml table. I do not practice using REST, but those two tables contain the Update set definition and relates 'updates'.