Eval VS GlideEvaluator.evaluateString

lucasita
Tera Guru

Hi,

 

I have a function that iteratively create string commands like ad.u_namefiled1='string1'; to be evaluated by eval .

These  instructions  refers to a glide record variable ad = new GlideRecord('u_my_table');

I know eval should not be used but replaced by GlideEvaluator.evaluateString .

The problem is that eval is working but GlideEvaluator.evaluateString! I tried to find more detailed documentation about the use of GlideEvaluator.evaluateString but I couldn't find anything useful.

1 ACCEPTED SOLUTION

Hi,



I understood the problem reading the thread: https://community.servicenow.com/thread/160402





Many Thanks,



Luca





Da: ctomasi


Inviato: lunedì 2 ottobre 2017 17:16


A: Luca Solda


Oggetto: Re: - Eval VS GlideEvaluator.evaluateString








<https://community.servicenow.com/?et=watches.email.thread>








Eval VS GlideEvaluator.evaluateString




reply from Chuck Tomasi <https://community.servicenow.com/people/ctomasi?et=watches.email.thread> in NOW Platform - View the full discussion <https://community.servicenow.com/message/1257083?et=watches.email.thread#1257083>


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

Hi Luca,



Can you share the script with us? I've done a lab on using GlideEvaluator.evaluateString().



Also note if this is being used in a global or scoped app.


Hi,



I understood the problem reading the thread: https://community.servicenow.com/thread/160402





Many Thanks,



Luca





Da: ctomasi


Inviato: lunedì 2 ottobre 2017 17:16


A: Luca Solda


Oggetto: Re: - Eval VS GlideEvaluator.evaluateString








<https://community.servicenow.com/?et=watches.email.thread>








Eval VS GlideEvaluator.evaluateString




reply from Chuck Tomasi <https://community.servicenow.com/people/ctomasi?et=watches.email.thread> in NOW Platform - View the full discussion <https://community.servicenow.com/message/1257083?et=watches.email.thread#1257083>


Aditya Telideva
ServiceNow Employee
ServiceNow Employee

Hi Luca,


i would recommend you to please go through: Coding Best Practices - ServiceNow Wiki


Thanks,


Aditya Telidevara


Yes. I do understand the issue now I'm using GlideEvaluator.evaluateString.


Many thanks to everybody!