The Targetprocess Developer Hub

Welcome to the Targetprocess developer hub. Here you'll find comprehensive guides and documentation to help you start working with Targetprocess as quickly as possible and support you if you get stuck. Let's jump right in!

Ask A Question


Correct JSON format for setting the state field on an item

Posted by Steve Russell 25 days ago

I am trying to change the state of a request through javascript (Google script to be exact) but it is not executing and I am assuming that it is how I am forming the payload or defining the EntityState Name value. I can use the same script to update custom fields with a different payload and that is why I am assuming the issue is with the format of the payload. Here is my code.

// sets the state in TP for the change on the spreadsheet.
function setState(TP, state) {
var payload = {
"EntityState" : {'Name': state}
var options = {
'method': 'POST',
'payload': JSON.stringify(payload),
'contentType' : 'application/json',

var TPid = TP.toString();
var token = "?&access_token=mytoken&format=json";
UrlFetchApp.fetch("" + TPid + token, options);

Loading comments...