Unable to set Source property of ticket using sdk interface method setvalue in Freshdesk

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);
}
`

Hi @Sachin_Kumar, really sorry for not replying earlier. I don’t think manipulating the Source property through interface methods is supported, officially at least.

Would it be possible to use a custom field instead? This is far from the ideal solution, but at least interface methods support custom fields.

Alternatively, you can try using Tags to store the actual source given that agents cannot make changes anyway.

@kaustavdm
Thanks for your reply. Since the source can be changed on ticket creation page and using the API (Ticket Update), It would be really helpful to have this in the list of attributes that could be changed using client interface.

Customer was not in favor of having a different custom property for source, we used ticket create event and update ticket API to default source to a specific value for now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.