Hi Team,
We are updating the group and custom ticket fields of a ticket using the “Update ticket” API. Most of the time, tickets are reassigned to the appropriate group and custom fields are updated properly.
But sometimes, we are getting a “400” error even though all the required values are passed to the request.
Please find the code snippet below.
function updateCustomeFieldForConversation(args, etsGroupIDValue, detailsList) {
return new Promise(async function (resolve, reject) {
let req_body = {
group_id: parseInt(etsGroupIDValue),
custom_fields: {
cf_group_id: detailsList.group_id,
cf_agent_id: detailsList.responder_id,
},
};
let basicKey = getToken(args.iparams.ApiKey);
$request
.invokeTemplate("upd_cus_field_for_con", {
context: {
path: `/api/v2/tickets/${args.data.conversation.ticket_id}`,
key: basicKey,
},
body: JSON.stringify(req_body),
})
.then(
function (body) {
console.log(
"----Log of updated ticket by conversation----",
body
);
resolve(true);
},
function (error) {
console.log(
"Error in updateCustomeFieldForConversation function",
error
);
reject(error);
}
);
});
}
Please find the screenshot of the log below.
We are invoking the same request a second time if the ticket update request fails, but a second time too, we are getting the same error.
Looking forward for suggestions to fix this issue.
Thanks,
Suman.