How to populate two fields with each other's value if one of them is empty?

Question

There are two fields. If one of them is not found, it should be populated with the value of the found one. Is there a sample script to do so?

Answer

An example script below checks if one of the fields is empty and if it is, it fills it with the value from the second field and vice versa. 

let f1=Context.GetField("New Field").Value;

let f2=Context.GetField("New Field 2").Value;

if(f1=='' && f2!='')

    Context.GetField("New Field").Value=f2;

if(f2=='' && f1!='')

    Context.GetField("New Field 2").Value=f1;

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.