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 Admin → Automation → Custom 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.


      • Sticky Posts

      • [DidYouKnow-45]How to Auto Populate User Defined Fields(UDF) on a Ticket

        One of our Community users has requested the following function in ServiceDesk Plus. When a user submits a ticket. The User Defined Fields (UDF - store users AD attributes), should get auto-populated on request additional fields based on the user who
      • [DidYouKnow-41] Glowroot bundled with ServiceDesk Plus

        Introduction: Glowroot is a simple APM (Application Performance Monitoring) tool useful for monitoring Java-based applications. It has a feature which allows tracing for slow requests and errors, it is also possible, logging trace time for every user action within the ServiceDesk Plus.  https://glowroot.org/ Glowroot is now bundled with ServiceDesk Plus and available from 11124 builds onwards. Note: This tool is not enabled by default and need not be enabled until explicitly told so for performance
      • [DidYouKnow-38] Unable to start ServiceDesk Plus as service

        Some of us would have come across a situation, where ServiceDesk Plus works only through CMD prompt by executing the RUN.bat (batch file) and fails to start as service. This situation most likely occurs after application restores or migrating the application to another drive on the same server. The reason behind this issue is, the ServiceDesk Plus service is already registered with an old installation, the server will not allow the same service to get registered again on the same name. We can fix
      • [DidYouKnow-36] Contract Management life cycle

        ServiceDesk Plus Contract Management helps you to organize and centralize contract tracking. The primary objective of contract management is to maintain a complete record of contracts of your organization with third-party vendors. You can track different types of contracts that are for lease, software licenses, support, maintenance, warranty, etc. Contract Management life cycle: New contract submission: You can create a new contract at [Contracts tab -> New contract ] provide the details of your
      • [DidYouKnow-35] Customize request templates

        Colors can make you look away or draw you in. It has the ability to create emotions as powerful as music can. Colors help us instantly understand our environment. It is fundamentally important to our everyday life as it is all around us all the time, helps the human mind to relate and respond to our world. With ServiceDesk Plus build 11110, we introduced an enhancement to customize request templates with colors, fonts, font sizes, background color, label placements and so on.                                     

                        New to ADSelfService Plus?