This is a sample Deluge script to set Line Manger field.
When a Change Request is created, ChangeRequester's reporting_to user is set as the Line Manager automatically, using Change Custom Triggers.
This is achieved by submitting a update request to the application in a specific JSON format, a example of which is give below.
{"operations": [{"input_data": {"change": {"roles": [{"users": [{"name": "Hugo.Weaving", "email": "Agent.Smith@Matrix.WB"}], "name": "Line Manager"}]}}, "operation_name": "UPDATE_ROLES"}], "message": "Updating Change Roles through Custom Trigger"}
User Case:
Assume Service Request template in request module. We have option to send automatic approvals to a $REPORTING_TO$ user automatically.
Similarly, In change module we do not have the option to automatically set the Line Manager to $REPORTING_TO$ user of the ChangeRequester. This can be achieved using a custom script.
Execution steps:
1. Copy the script content and Goto > Admin > Request Custom Function > New. Paste the copied content and save it with a name.
2. Configure the script under the Admin > Change custom triggers.