Set Field default value in Record Producer.

Alok21
Giga Expert

Hi,

I would like to set default values for few fields through script in record producer which is mapped to same field name into a parent table.

Can someone please help here?

Regards,

Alok

1 ACCEPTED SOLUTION

You could do an onload script to set the value. 

g_form.setValue('variable', 'value');

View solution in original post

12 REPLIES 12

Brian Lancaster
Tera Sage

Instead of doing it thought a script why would you not use add the default value on the variable in the record producer?  Or if the incident is always supposed to use the default values leave them off the record producer and let the default values in the incident table take care of it.

This is an old post but hopefully it will still be checked 😉

 

I am having difficulties understanding the syntax for default values of Record Producer variables.

What I want to achieve it to populate the default value with today at 8 in the morning.

I have tried with javascript:gs.nowDateTime("2020-01-01 08:00:00") as a mean of testing but that set the value to my current date time.

Any ideas?

Thanks

Try javascript: new GlideDateTime("2020-01-01 08:00:00");

I have done that 

javascript:gs.dateGenerate(gs.now().substring(0,10), "08:00:00")

 

maybe not the most simple but does the job 😉

Thanks