Mike_R
Kilo Patron

If i read this right, you want to use a rest api from an external system to create a business rule in ServiceNow. Can you confirm if that's what you're looking for or is it something different? 

zterlizz
Giga Contributor

Thank you for your reply. My intention is to use the ServiceNow API to create a Business Rule. I would also accept any solution that allows the creation of a Business Rule programmatically so that a user must only supply my third-party API authorization to their ServiceNow account, and my solution could automatically configure a Business Rule to send my third-party API updates when data is changed for some table on the users' ServiceNow account.

Bert_c1
Kilo Patron

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.

View solution in original post

zterlizz
Giga Contributor

Wow, Update Sets is a great feature for this purpose. Do you know if ServiceNow has a way to programmatically import an Update Set?

 

For context, I allow users to connect their ServiceNow account to my third-party tool using a custom-made ServiceNow module that can generate an authentication token to allow my tool to safely connect over REST. I would like to add the feature for my tool to automatically setup and receive updates using Business Rules when a specific table experiences changes. If there is a way to automatically create and destroy the Business Rule, even just using my existing custom ServiceNow module, then I would be interested in learning more about it!

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.

 

Capture.JPG

 

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, ..."