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 


Thanks for your reply.

Just using the logged in user.

I think in this case you will need to use a client callable script include and then use GlideAjax to call it passing g_user.userID which is the sys_id of the logged in user.

 

The easier way to do this would be to have a reference field to the user and set the default value to javascript:gs.getUserID(). Then have an oncange client script on this field and use getReference to fill in the company field.

Not sure why it keeps morphing the code but here is a screenshot of what the default value on the user field should look like.

BrianLancaster_0-1667234362727.png

 

sujata sakhare
Tera Contributor

hi,

write onload script using setvalue method. 

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

 Thanks