Change as Requester in Custom Function

Change as Requester in Custom Function

Is it possible to change roles for a technician or remove the technician role from a user? I am working on a workflow for offboarding users in SDP On-Prem 15240 and would like to automatically remove the permissions when a technician is being offboarded. This is the Deluge script I tried to achieve this, but it doesn't work.

  1. leaver = requestObj.get("udf_fields").get("udf_pick_27762");
  2. headers = Map();
  3. headers.put("TECHNICIAN_KEY", "valid-integration-key"); // Integration key has SDAdmin permission to achieve this.
  4. info leaver;
  5. removeTechRole = invokeurl
  6. [
  7. url: "https://servicedesk.domain.net/api/v3/technicians/change_as_user"
  8. type: PUT
  9. parameters: {"ids": leaver.get("id")}
  10. headers: headers
  11. ];
  12. return removeTechRole.get("changes_as_user");
I currently get an SSL Exception, but I do not get this if I run this using Invoke-RestMethod in PowerShell. Anything I'm missing? Or is this not possible?