I've a custom function which is perfectly working when I add a specific ticket id in the url:
orgid = 2XXXXXXX;
resp = invokeurl
[
type :GET
connection:"deskXXXX"
];
info resp;
gcon = resp.getJson("description");
//info gcon;
if(gcon.contains("ziekmelding") && gcon.contains("ziektegeld"))
{
// info "yes1";
mp = Map();
mp.put("cf_subcategorie","Ziekmelding;Ziektegeld");
mp1 = Map();
mp1.put("cf",mp);
resp = invokeurl
[
type :PATCH
parameters:mp1.toString()
connection:"deskXXXX"
];
info resp;
}
else if(gcon.contains("ziekmelding"))
{
mp = Map();
mp.put("cf_subcategorie","Ziekmelding");
mp1 = Map();
mp1.put("cf",mp);
resp = invokeurl
[
type :PATCH
parameters:mp1.toString()
connection:"deskXXXX"
];
info resp;
}
else if(gcon.contains("ziektegeld"))
{
mp = Map();
mp.put("cf_subcategorie","Ziektegeld");
mp1 = Map();
mp1.put("cf",mp);
resp = invokeurl
[
type :PATCH
parameters:mp1.toString()
connection:"deskXXXX"
];
info resp;
}
However, I try to make this function general by adding /api/v1/tickets/{ticket_id}/latestThread. Once, I add this line, the function is failing