ServiceDesk Plus - Automatic Request Transfer Between Portals

ServiceDesk Plus - Automatic Request Transfer Between Portals

Hi Everyone!

This is a Custom Trigger script for ServiceDesk Plus that automatically transfers requests from Portal A to Portal B in real-time. No manual intervention required!

✨ Features

  • Automatic Transfer - Instantly sends new requests to Portal B
  • Subject & Description - Transfers complete request information
  • Requester Information - Preserves original requester name
  • ID Tracking - Original Portal A Request ID is visible everywhere
  • Error Handling - Logs errors for troubleshooting
  • Industry Standards - Uses ServiceDesk Plus REST API v3

📋 Requirements

  • ServiceDesk Plus (Cloud or On-Premise)
  • Admin privileges (to create Custom Triggers)
  • API access on both portals (Auth Tokens)
  • ServiceDesk Plus REST API v3

🔧 Installation

Step 1: Get Auth Tokens

Obtain API auth tokens for both portals:

  • Admin → Setup → Developer Space → API Key

Step 2: Create Custom Trigger

  1. Navigate to AdminAutomationCustom Triggers
  2. Click "New Custom Trigger"
  3. Enter the following parameters:
    • Trigger Name: Auto Transfer to Portal B
    • Module: Request
    • Trigger Type: Request Created
    • Execute on:Create

Step 3: Configure the Script

Update the configuration parameters at the top of the script:

portalB_url = "https://your-portal-b.com/api/v3/requests";
portalB_authtoken = "YOUR-AUTH-TOKEN-HERE";

Step 4: Paste the Script

Paste the script into the "Execute Script" section and click Save.

🧪 Testing

  1. Create a new request in Portal A
  2. Verify the request is automatically created in Portal B
  3. Confirm the subject includes [Portal A #ID] prefix
  4. Check that the description contains original ID and requester information

📊 Use Cases

1. Multi-Portal Architecture

Separate portals for different departments or branches, but centralized monitoring is needed.

2. Backup & Redundancy

Automatic backup of critical requests for data protection.

3. Escalation Workflow

Automatically transfer specific requests to a higher-level portal.

4. Reporting & Analytics

Collect all requests in a central portal for comprehensive analytics.

🔍 Technical Details

API Endpoint: /api/v3/requests
Method: POST
Authentication: Auth Token (in Header)
Format: JSON (application/x-www-form-urlencoded)

Transferred Fields:

  • Subject
  • Description (HTML format)
  • Requester (name/email)
  • Status (default: Open)

⚠️ Security Notes

  1. Protect Auth Tokens - Don't hardcode in production, use environment variables if possible
  2. Test in Non-Production - Always test before deploying to production
  3. Monitor Logs - Keep an eye on logs to detect errors early
  4. Rate Limits - Be aware of API rate limits (if many requests are created)

🐛 Troubleshooting

Error: "Missing return statement"

Solution: Ensure return result; is at the end of the script.

Error: "Authentication failed"

Solution: Verify that your auth token is correct and active.

Request not transferring

Solution:

  1. Check if the trigger is active
  2. Review logs in Admin → Automation → Custom Triggers → View Logs
  3. Verify Portal B URL is correct
  4. Test API connection manually using the provided sample code

Description not showing correctly

Solution: Ensure HTML format is enabled in Portal B. Check description field configuration.

📝 Script Structure

1. Configuration Section - Set Portal B URL and auth token
2. Data Extraction - Get request details from Portal A
3. Data Preparation - Format data for Portal B
4. API Call - POST request to Portal B
5. Response Handling - Check success/failure and log results
6. Return Statement - Required for Custom Triggers

🎯 Best Practices

  1. Use Descriptive Naming - Name your trigger clearly for easy identification
  2. Document Customizations - If you modify the script, document your changes
  3. Regular Testing - Periodically test to ensure it's working correctly
  4. Backup Your Script - Keep a copy of the script in version control
  5. Monitor Performance - Check execution time in trigger logs

🤝 Contributing

If you improve this script or find bugs, please share your findings with the community!

📞 Support

For questions or issues:

  • Check ServiceDesk Plus API documentation
  • Review Custom Trigger logs
  • Test API calls independently
  • Contact your ServiceDesk Plus administrator

📜 Version History

v1.0 - Initial release

  • Basic subject and description transfer
  • Requester name preservation
  • Error handling and logging
  • Return statement for Custom Trigger compatibility

🎓 Additional Resources


Tested on: ServiceDesk Plus Cloud & On-Premise
API Version: REST API v3
Status: Production Ready ✅


💡 Pro Tip: You can extend this script to include custom fields, attachments, or additional metadata by modifying the new_request object structure according to your needs.


                  New to ADSelfService Plus?