Hello,
I have created an application that allows for a new ticket to be created when certain fields are filled in. This application takes the values of those fields and send them in a post request for ticket creation. The issue I am facing is the toast notifications that I have set up do not appear for this function. And I get this response when I log the response of the post request
This response is logged even if the post request returns 201 and the ticket is created. Here is the code snippet for the ticket creation function. Hoping someone can help me identify the issue. All other notifications where the “showNotification” function is set to run work as intended.
function createFreshserviceTicket (email, subject, description, agent, group) {
client.request
.post('https://<%=iparam.freshservice_subdomain%>.freshservice.com/api/v2/tickets', {
headers : {
Authorization : 'Basic <%= encode(iparam.freshservice_api_key)%>',
'Content-Type' : 'application/json;charset=utf-8'
},
body : JSON.stringify({
description : `${description}`,
email : `${email}`,
priority : 1,
status : 2,
source : 1002,
group_id : parseFloat(group),
responder_id : parseFloat(agent),
subject : `${subject}`
})
})
.then(function () {
showNotification('success', 'Ticket is successfully created');
//Clears user input after posting data
clearInputfields();
})
.catch(function (error) {
console.error(error);
showNotification('error', 'Unable to create ticket');
});
}
Here is the function for showing notifications.
function showNotification (status, message) {
client.interface.trigger('showNotify', {
type : `${status}`,
message : `${message}`
});
}
Thank you in advance for any help offered.
-Zach