for catalog creation and dynamic data source learning purpose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2025 11:58 AM - edited 07-19-2025 12:07 PM
In ServiceNow some time we get project where we need to create a Service Catalog item in ServiceNow. This catalog item is designed to dynamically insert data into a target table—in my case, the API Endpoint table. is the target table.
The key requirement is that the data should be passed directly from the catalog item to the target table in real time. Since multiple users might submit requests simultaneously, using a single static data source could lead to conflicts or data integrity issues. To address this, I implemented a dynamic data source using Business Rules on the Requested Item (RITM) table.
Here's how the solution works:
Catalog Item Setup:
- I created a catalog item named "Catalog Your API Inventory Item".
- This item is configured to trigger a Business Rule when a request is submitted.
Dynamic Data Source Creation:
- The Business Rule dynamically creates a Data Source and Import Set.
- It then triggers the Import Set to move data from a staging table to the target table using a Transform Map.
- The Transform Map ID is passed dynamically to ensure the correct mapping.
Error Handling:
- If certain fields (e.g., the API field) are empty or invalid, we prevent the data from being submitted.
- This validation is handled using an onBefore Client Script.
- A dedicated field in the staging table captures error messages for each row.
- Pass the error message of ignored field in RITM variable
Below is the code--
business rule on requested item table--
*condition on your item
code you need to create a dynamic data source and import set.
now time for on before script--
- 732 Views