Update Test field using PATCH web service
I know I can update a single field using a PATCH call and use the operator "Replace". Is there a way to append text onto the end of existing text in a text field?
I have a workflow with several web services that are making child tickets under a Problem ticket. I want to record in the problem ticket that a Child ticket was completed successfully. I was planning on making the success leg of the workflow go to another web service that does the update on the Problem ticket. I want to do this several times and want to record each successful ticket creation.
I found that Rest API Patch method can use the "Add" operator to update an existing array of values. I want to do the same but on a text field.
I also know the workflow steps are in the history and ticket feed, but I'd like for all the child ticket success statuses to be in a concise format in the ticket for easy manual review by technicians.
Answer (1)
Hello Nathaniel,
If it's a text type attribute, you should be able to define that attribute as a parameter, then when you are constructing the PATCH call's body, refer to the attribute parameter first in the value property, then supply whatever you are wanting to append to it after that, still within the value property.
You'd still continue to use the "replace" operator though as you are replacing the old value with a new value.
Love the super quick response!
I don't want to replace, I want to append to the existing text in the field. I want to add six different responses each from its own web service call into the same field and see all six messages.
Nate - Nathaniel Obee Tue 3/29/22 4:48 PM
Either way, formatting the PATCH call with the parameter and then referencing that in the body when you go to generate the new value for the attribute is the right way to go. - Mark Sayers Tue 3/29/22 4:55 PM
I suppose I could use another web service to read the ticket data to get the existing text, parse that into a parameter and then append the new message to that parameter in my PATCH Body. So the existing data is in the new update call, making the replace viable.
That's a lot of steps.
Side note, is it normal for each web service step in a workflow to take five minutes? Testing from the Web service config screen returns in a few seconds. But when chained up in a workflow they each take 5 minutes every time. - Nathaniel Obee Tue 3/29/22 5:09 PM