Skip to main content
Inspiring
Apr 11, 2022 9:24 AM UTC
Question

Alternative to eval()

Is there an alternative to eval() where I can evaluate a text input as part of the code? And also, why is it not a best practice to use the eval()?

5 replies

harshitb6843
Brainy
Apr 11, 2022 9:29 AM UTC

No. There isn't any alternative. Also. this is an undocumented function of Appian. As far as reason is concerned about why this is not generally available, lets wait to hear from someone from Appian. 

stewart.burchell
Employee
Apr 11, 2022 9:30 AM UTC

In reverse order:

  • it's not best practice to use unsupported functions. eval() is unsupported:

  • AFAIK there is no alternative. 

That answers your specific questions. Taking a step back - what is the actual problem you're trying to solve here?

Inspiring
Apr 11, 2022 9:34 AM UTC

I want to use it as such: 

eval(
  "updatedictionary(
    fv!item,
    {
      "&ri!pkName&": null
    }
  )"
)

where ri!pkName is a cdt field which i want to address in updatedictionary()

stefanhelzle0001
Brainy
Apr 11, 2022 10:37 AM UTC

a!update should get you there.

eval() is evil! It allows an attacker to inject code into your application. Think of a SQL injection attack.