I have one of the field called business unit needs to be populated based on the requested for onchan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2022 09:37 AM
Hi All
I have on of the field called Bussiness unit field and it is a reference field.
My query is when I select request for user, users Department needs to be populated when User open the form .
I wrote the Onchange script and it is working fine.
Business unit field is reference one, when I open the form my Department needs to be populated automatically and when I changed the requested for name automatically requested for user department needs to be populated.
How to populate the Requested for department when the form is loaded.
Note : Bussiness unit field is reference one.
Thanks
Vinuth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2022 12:47 PM - edited ‎10-24-2022 12:49 PM
If you have an onChange Client Script that is working to populate the Department field when the Requested for field changes, then use the same script onLoad. If you used newValue in the onChange script, just replace that with
g_form.getValue('field_name');
Where field_name is the name of your Requested for field. This will also work in an onChange script in place of the newValue shortcut.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2022 03:34 AM
Hi @Brad Bowman
I tried this way also it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2022 12:59 PM
Is the Requested for field populated when the field loads - either via the default value that Brian suggested, or an onLoad script? If not, the script to populate the Department won't work. If it is populated, let me know which method you are using to populate it, and post your onLoad script that is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2022 12:56 PM
You can set the default value of the requested for field to javascirpt:gs.getUserID(). Then you don't need any other scripts.