|
| 1 | +# ServiceNow Portfolio Commitments Loader |
| 2 | + |
| 3 | +Bulk link service commitments to portfolio offerings with dry-run validation. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This background script automates linking service commitments across multiple offerings in a ServiceNow portfolio. Instead of manually adding commitments one by one, you can process entire portfolios in seconds. |
| 8 | + |
| 9 | +The script checks if commitments exist before creating them, skips duplicates, and includes a dry-run mode so you can see exactly what will be updated before running it live. |
| 10 | + |
| 11 | +## What It Does |
| 12 | + |
| 13 | +- Loops through all services in a defined portfolio |
| 14 | +- Gets all offerings for each service |
| 15 | +- Adds service commitments from a configured array |
| 16 | +- Checks if commitments already exist (avoids duplicates) |
| 17 | +- Can simulate changes first (dry-run mode) to see impact |
| 18 | +- Generates a summary of what was processed |
| 19 | + |
| 20 | +## Key Features |
| 21 | + |
| 22 | +- **Dry-run mode** - Preview changes without touching the database |
| 23 | +- **Duplicate prevention** - Doesn't add the same commitment twice |
| 24 | +- **Auto-create commitments** - Creates commitments if they don't exist |
| 25 | +- **Detailed logging** - See exactly what the script did |
| 26 | +- **Error handling** - Continues if something fails on one record |
| 27 | +- **Easy to customize** - Can be modified to target specific services or use different commitments per service |
| 28 | + |
| 29 | +## Getting Started |
| 30 | + |
| 31 | +### Before You Run |
| 32 | + |
| 33 | +1. Note your portfolio's `sys_id` |
| 34 | + - Go to Service Portfolio module |
| 35 | + - Open your portfolio |
| 36 | + - Copy the sys_id from the the list |
| 37 | + |
| 38 | +2. Know the names of your service commitments |
| 39 | + - Go to Service Commitment table |
| 40 | + - Copy the exact names you want to add (case matters) |
| 41 | + |
| 42 | + |
| 43 | +### How It Works |
| 44 | + |
| 45 | +The script: |
| 46 | + |
| 47 | +Validates your configuration |
| 48 | +Queries for all services in the portfolio |
| 49 | +For each service, gets all offerings |
| 50 | +For each offering: |
| 51 | +Finds or creates the service commitment |
| 52 | +Checks if it's already linked |
| 53 | +Creates the relationship (or shows what it would do in dry-run) |
| 54 | +Shows you a summary of what was processed |
| 55 | +Configuration Options |
| 56 | + |
| 57 | +Setting Default What It Does |
| 58 | +PORTFOLIO_SYS_ID Required The portfolio to process |
| 59 | +SERVICE_COMMITMENTS_TO_ADD Required Commitments to add |
| 60 | +DRY_RUN true If true, just show what would happen |
| 61 | +FILTER_OPERATIONAL_ONLY false If true, only process operational items |
| 62 | +SKIP_EXISTING true If true, don't add duplicate links |
0 commit comments