Mark Burns Posted July 10, 2024 Posted July 10, 2024 Hello, Just wondering if anyone has any script examples of logging a request that has an attached workflow via the API. I'm trying to make API requests to log a ticket in the same way a user would, providing answers to questions that are asked in the Intelligent Capture. The documentation is good at telling me which fields need to be provided, but I can't figure out how to format some of the parameters to make sure a workflow is attached to the request and that the answers are passed. Thank you
Victor Posted July 10, 2024 Posted July 10, 2024 11 minutes ago, Mark Burns said: logging a request that has an attached workflow via the API How is that request raised, what API are you using specifically and what would be an example payload? For example, are you using the generic logRequest or the request type ones, such as logIncident?
CraigP Posted July 10, 2024 Posted July 10, 2024 We've recently gone live with an automated process to raise requests. Yes, working out the required fields on the JSON objects took a little bit of trial and error! I seem to recall the "questions" and "questionFieldMap" parameters giving me the most issue, so hopefully this is of use! The "questions" parameter wants the JSON to look something like this (or at least, this is what worked for me!): [ { "form_id": "form_id", "question": "Question 1", "question_id": "h_custom_a", "answer": "Answer", "answer_value": "Answer value", "field_type": "text", "entity_type": "request" }, { "form_id": "form_id", "question": "Question 2", "question_id": "h_custom_b", "answer": "Answer 2", "answer_value": "Answer 2 Value", "field_type": "text", "entity_type": "request" } ] The "questionFieldMap" parameter (assuming you want to map custom fields on the request being raised) wants an answer like this: { "h_custom_a": "Answer", "h_custom_b": "Answer 2" } Common field types are defined as: checkboxlist, datetimepicker, queryselect (e.g. user lookup), radioset, text, textarea (i.e. multi line text fields) Hope that helps!
Victor Posted July 10, 2024 Posted July 10, 2024 3 minutes ago, CraigP said: The "questions" parameter wants the JSON to look something like this (or at least, this is what worked for me!) Just to be aware, we don't have this part of the API documented just yet so officially it is not yet supported (this part). If it works now, great, but it can be subject to change without prior notice.
Mark Burns Posted July 10, 2024 Author Posted July 10, 2024 2 hours ago, CraigP said: The "questions" parameter wants the JSON to look something like this (or at least, this is what worked for me!): Fantastic, thank you! That's got the questions section of ticket logging sorted. 2 hours ago, Victor said: are you using the generic logRequest or the request type ones, such as logIncident? I'm currently using the generic request. I'd like to use the specific request type ones, but not sure how to format the request for that. the documentation states this example: Quote (E.g. For Incidents, use Incidents::fc_ops::logIncident operation). It's a service request I'm trying to create - how would I use the specific request types with the API? Cheers
Victor Posted July 10, 2024 Posted July 10, 2024 2 minutes ago, Mark Burns said: It's a service request I'm trying to create - how would I use the specific request types with the API? Would this help? https://docs.hornbill.com/servicemanager-api-api/entities/servicerequests/espflowcodeentityoperation/content/logservicerequest
Mark Burns Posted July 11, 2024 Author Posted July 11, 2024 Thank you @Victor, that's got me in the right direction. I'm still struggling with creating a ticket with a workflow attached. I've put the correct Service ID in and that shows up on the request, however, no workflow seems to be attached (I can't see the workflow being processed along the top of the request page). Is there a way to see if a workflow has been attached to a request besides seeing the green process bar at the top? Cheers
Victor Posted July 11, 2024 Posted July 11, 2024 @Mark Burns have you included the BP name(*) param in the payload? (*) the BP name is the string that is displayed in the URL when you open the workflow configuration in HB admin. This would be different than the name you see displayed din the UI.
Mark Burns Posted July 11, 2024 Author Posted July 11, 2024 Hi Victor, That's sorted it! I was entering the wrong value. Thank you for all your help - it's all working now! 1
Victor Posted July 11, 2024 Posted July 11, 2024 3 hours ago, Mark Burns said: Is there a way to see if a workflow has been attached to a request besides seeing the green process bar at the top? 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now