Hey guys,
I’m facing really weird problem. I don’t know what happened behind the scenes but for our company we have freshdesk field (in the production) where we use orderNr as a custom field. But interesting fact is I’ve opened my own account to avoid any serious problem in the live system of our working freshdesk production, and made a dummy environment to create and test my apps before installing it in the production. Let’s say it’s a developer environment. However, the custom field orderNr have different way of calling in the freshdesk itself. For the production it called
order_no
where for me it’s called
cf_ordernr
. However, When we were creating the field the names were same. So to avoid this issue I have said okay let’s parameterized this orderNr field since it called different from environment to environment which is really weird. Now there is another problem. When I try to fetch the orderNr this dynamic way kinda this way:
client.data.get(“ticket”)
.then(
function (data) {
var orderNr = ‘data.ticket.custom_field’+‘.’+ FIELDPARAMNAME;console.log('orderNr: '+orderNr); initOrderTool(); initPodioService(client); } );
However, it doesn’t work as it should work. I want to use this as an expression not as a string or an object. However, this is where I’m facing some challenges for example, orderNr is 1234567 it shows me
data.ticket.custom_field.cf_ordernr
not the 1234567. Besides, I know it works with
eval()
but it’s not a professional way to use and isn’t secured too. However, when I try to pass this using
var tempODN = new Function(‘a’,“return a”);
now freshdesk gives me error like this:
VM129:3 Uncaught (in promise) ReferenceError: data is not defined at eval (eval at (VM124 app.js:1562), :3:1)
. I don’t understand why? Is there any better option to do so? Thanks everyone.