I have one of the field called business unit needs to be populated based on the requested for onchan

vinuth v
Tera Expert

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

 

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

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.

Hi @Brad Bowman  

I tried this way also it is not working.

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. 

Brian Lancaster
Tera Sage

You can set the default value of the requested for field to javascirpt:gs.getUserID(). Then you don't need any other scripts.