I have been trying to set a custom data-sourced drop down field using setValue inside client.interface.trigger() method. The field is sourced with “Agents” and I have tried using values such as Agent id, name, or email address and I am unable to get the Agent to populate in the field. This works with a text field, no problem.
So my question is, is there anything special regarding data-sourced drop down fields when it comes to trying to use setValue?
There is nothing that is specifically documented about dropdown in Freshservice docs > Documentation > Interface Methods.
@Zach Can you confirm that you are looking for a UI event to dynamically update a dropdown ticket property field? (Or similar to setOptions like Sachin is hinting at.)
It indicates that custom fields are eligible to set values for using the “interface” method. I assume setOptions is designated for drop down fields but I don’t see that method available for freshservice.
My apologies as misunderstood your question/issue. I tried to replicate the issue and it looks like the method is not working for data sourced drop downs. It works fine for normal drop down options.
Interestingly, it tries to set the value for data sourced drop down also and enables the icon in the drop down field however since setting the data sourced property requires to first lookup the values and then populate options selected by user on UI. When you try to set the value from the APP the list of possible values on the UI is not available in the DOM and hence it is not setting the value of drop down.
May be if we get the ability to setOptions in code then probably this will work. I might be wrong.
Hello @Sachin_Kumar, no worries, I may not have described my situation accurately but this was my experience when I tried it as well. I noticed the “X” icon in the field just no value was populating.
Any suggestions on a possible solution? I need this field to be of the drop-down type so that I can then later filter tickets by it.
Usecase: Filter tickets using “Created By” (this would be the name of the data-source drop down field)
Well this would not be the cleanest solutions but since the limitation of not being able to set options of dropdown,
Create a custom field of type number “Created By” and set it in app to the agent id.
Create custom app with a dropdown for agents which you can construct in app init and put a event listener for change on this drop down to reset the value of custom field. if required.
My apologies, this will not let you filter tickets on UI. I got confused with Analytics module where you can use numeric fields to filter data and suggested to keep the agent id in the numeric field.