Question

Working with department custom fields and web requests

  • 9 March 2022
  • 3 replies
  • 239 views

Badge

We wanted to create a department custom field to reflect their priority status, so that we could use it to escalate tickets at a different pace based on the client. 

Easy. Checkbox. True/false. 

1st hurdle : discovered that department fields are not visible in workflows, at least not in our basic tier. 

OK, but I can make API calls against Freshservice from inside a workflow. 

2nd hurdle - most of the “department” names have spaces, and for whatever reason, the url_encode filter does NOT replace the spaces, observed by checking the execution logs and seeing the requested URL still has spaces vice “+”

3rd hurdle - managed to pipe in a replace: “ “,”+” and that appears to have done the trick…. and get verified json results back. The field type is boolean, and the branch/test node recognizes it as such, but won’t validate against [true] - maybe because the original CF is  an array of booleans? 

OK - manage to get the data out anyway and test it. Test it by modifying select tickets.  Activate it. Park it after the workflow that assigns to agent groups and …. nothing after this workflow executes. Since I had set some tags I can see that the web request completed and got data out. 

 

So now I’m back to a deactivated ticket and will do more testing, further down in the workflow. We may just create a decision tree and manually curate the list of departments in it, but we were hoping to set an easy checkbox in the same area we set default domains/etc., without having to set it separately in a workflow just for priority escalation. 


3 replies

Userlevel 7
Badge +14

Hello @DariusG, sorry for all the hurdles it seems you have to jump over. I am not sure if this is a viable solution for your usecase, but have you thought about using a custom object? And using its identity field option in workflow automator as a way to identify your departments that are of a higher priority?

Badge

I figured out that the “true” array of booleans returned - and I’’m new to JSON but even with a separate analyzer tool playing with mapping paths I’m not sure why I can’t pull that 1st true value out as any time I specify an index I get [null] - isn’t the same thing the WF logic branch checks for true/false, so obviously I need to learn a bit more about JSON. That said, the biggest hassle is not that I had to figure out how to workaround the url_encode filter not replacing spaces, but that this workflow causes all ticket processing to halt on a newly raised ticket instead of “falling through” - and nothing in there explains why. 

 

I’ll look into custom objects, thank you

Userlevel 4
Badge +6

Hi @DariusG,

We’d like to share our ideas and some workarounds. 

  1. As @zachary.king mentioned you could create custom objects to store your priority departments and use the reader node in workflow to read and match the requester department with the custom object record. It's also easier to keep the custom object updated using APIs. https://api.freshservice.com/#custom-objects

  2. The API filter URLs have to be encoded before passing them in the web-request/webhook nodes. Spaces have to be replaced with %20.

  3. You can use the status code to have the workflow proceed further based on the API response.

n76R97tB72er7TSbejO378q1ww0cSD5E-K1xhIgcXCVQnu7THN7VMzVLZGPNHFd_1kQZNs_jJ3S-MCvscHBZK1uReb3IeElqemB_G4bnc7ckJXWVZuNsYHF0uCcDgaIfj0SwUa8q

 

  1. Is your workflow waiting for some event on the ticket? No other workflow will trigger on the ticket until the current one has ended. If there is an issue, please write to us at support@freshservice.com with the ticket and workflow IDs and we’ll check this for you.

Cheers!

Reply