Hi All,
For a customer use case, I am trying to build a ticket background app for new ticket page in Freshdesk where we would like to set the source to a specified option and disable for agent to make change.
I am able to disable the “Source” however the value is always staying as “Phone”. Even though we don’t receive any error when we call set value method however the value is not set to the specified option.
Is there something wrong for “Source” property because we can set the “Status” property successfully.
Thanks in advance for any pointers or help.
PS: In SDK documentation, Source is not mentioned as supported property for setvalue method but so is for disable but interestingly disable works fine.
here is my app.js code`
if (document.readyState !== 'loading') {
console.log('document is already ready, just execute code here');
renderApp();
} else {
document.addEventListener('DOMContentLoaded', function () {
console.log('document was not ready, place code here');
renderApp();
});
}
function renderApp() {
var onInit = app.initialized();
onInit.then(getClient).catch(handleErr);
function getClient(_client) {
window.client = _client;
client.events.on('app.activated', onAppActivate);
}
}
function onAppActivate() {
client.data.get("loggedInUser").then(
function (data) {
logMessage(data);
let email = data.loggedInUser.contact.email;
client.interface.trigger('hide', { id: 'cf_parent_id' }).then(logMessage("Hide cf_parent_id")).catch(handleErr);
client.interface.trigger('hide', { id: 'cf_conversation_id' }).then(logMessage("Hide cf_conversation_id")).catch(handleErr);
client.interface.trigger("setValue", { id: "status", value: 2 }).then(logMessage("Status set to open")).catch(handleErr);
client.interface.trigger('disable', { id: 'status' }).then(logMessage("Disabled status")).catch(handleErr);
client.interface.trigger("setValue", { id: "source", value: 7 }).then(logMessage("Source is set to Email")).catch(handleErr);
client.interface.trigger('disable', { id: 'source' }).then(logMessage("Disabled source")).catch(handleErr);
client.interface.trigger("setValue", { id: "cf_created_by", value: `${email}` }).then(logMessage("cf_created_by is set to Email " + email)).catch(handleErr);
client.interface.trigger('disable', { id: 'cf_created_by' }).then(logMessage("Disabled cf_created_by")).catch(handleErr);
},
function (error) {
handleErr(error);
}
);
}
function logMessage(message) {
console.info(message);
}
function handleErr(err) {
console.error(`Error occured. Details:`, err);
}
`