Skip to main content

We are currently using the Employee Onboarding module and are testing adding the Employee Offboarding module. However, one roadblock we have hit is how to make a web request that lists the onboarding or offboarding request details so that we can trigger off the specific fields. An example use case is if the request is for an immediate offboarding, it would automate additional actions as opposed to standard offboarding. 

Reading the API documentation specific to this (here for onboarding, here for offboarding), I know it is possible to use: /api/v2/offboarding_requests/id and /api/v2/onboarding_requests/id

But my question is… how the heck do you get that ID in workflows?? That ID for onboarding and offboarding requests does not correspond to the ticket ID (so I can’t use {{ticket.id}}) and the ID doesn’t appear in a web request with /api/v2/tickets/{{ticket.id}} in the resulting JSON even if I try that route. The sections for Onboarding Request and Offboarding Request (example below) have no ID of any kind to use (I’ve only blurred the team name and company name)… 

I’m on a same boat as you, Let me know if you have found any work around.


I have the same problem….


@maxviskov ​@ssalwan it took some effort and some work with Freshservice support, but managed to find a solution for this!

In the workflow: 

  • Create a web request: Request Type == GET, Endpoint == https://domain.freshservice.com/api/v2/onboarding_requests?per_page=100&page=p;X]]
    • NOTE: Using this endpoint without pagination will only show the first 10 onboarding requests in your Freshservice, which isn’t the most useful; it would be significantly better if it were the most recent requests, but here we are. I ended up using the parameter per_page=100, finding the last page with data, and then adding that page=4 parameter in the URL as well. I don’t know of an elegant way in Freshservice to incrementally check for the last page and proceed with the last page by default, so this workflow does need to be updated as the 101st, 201st, 301st, etc. request is submitted, which is not a great experience but nonetheless makes this possible. 
  • Create a JSON parser using the response_body from the above web request and generate the output
  • In the output of the JSON parser, in the id path, change the reference from * to -1: to get the last item from the ids array
  • Since the result is still in array format, create an expression that removes the a] from that id array to leave you with just a number. Example is {{P1.root.onboarding_requests.onboarding_requests_object.id | remove: "c" | remove : "]" }}

 

Let me know if any of that doesn’t make sense or needs clarification! 

 


@LizM  Thank you very much for sharing your solution! Could you please clarify - why the latest request will be the right one we are looking for? Thank you!


Reply