- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 07:20 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 10:53 AM
You could do an onload script to set the value.
g_form.setValue('variable', 'value');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 05:23 AM
Thanks for your reply.
Just using the logged in user.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 09:01 AM - edited ‎10-31-2022 09:39 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2022 05:30 AM
hi,
write onload script using setvalue method.
g_form.setValue('variable', 'value');
Thanks