I have a before load script running on a new record and I have a multi-select record on the case form and want to select all fields in a beforeload event.
Here is the code segment:
[SIZE=2][COLOR=#0000c0]var[/COLOR][/SIZE] ufld [SIZE=2][COLOR=#5c5c5c]=[/COLOR][/SIZE][SIZE=2][COLOR=#0000c0]this[/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]form[SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]getField[SIZE=2][COLOR=#5c5c5c]([/COLOR][/SIZE]pcCaseField[SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]USERASSIGNEDPARTNERS[SIZE=2][COLOR=#5c5c5c]);[/COLOR][/SIZE]
[SIZE=2]var[/SIZE] opts [SIZE=2][COLOR=#5c5c5c]=[/COLOR][/SIZE] ufld[SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]getSelectOptions[SIZE=2][COLOR=#5c5c5c]();[/COLOR][/SIZE]
[SIZE=2]v[/SIZE][SIZE=2]ar[/SIZE] vals [SIZE=2][COLOR=#5c5c5c]=[/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c][];[/COLOR][/SIZE]
[SIZE=2][COLOR=#5c5c5c]/[/COLOR][/SIZE][SIZE=2][COLOR=#008000]/ set the values[/COLOR][/SIZE]
[SIZE=2]f[/SIZE][SIZE=2]or[/SIZE][SIZE=2][COLOR=#5c5c5c]([/COLOR][/SIZE][SIZE=2][COLOR=#0000c0]var[/COLOR][/SIZE] i[SIZE=2][COLOR=#5c5c5c]=[/COLOR][/SIZE][SIZE=2][COLOR=#800040]0[/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c];[/COLOR][/SIZE] i[SIZE=2][COLOR=#5c5c5c]<[/COLOR][/SIZE]opts[SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]length[SIZE=2][COLOR=#5c5c5c];[/COLOR][/SIZE] i[SIZE=2][COLOR=#5c5c5c]++)[/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c]{[/COLOR][/SIZE] vals[SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]push[SIZE=2][COLOR=#5c5c5c](([/COLOR][/SIZE]opts[SIZE=2][COLOR=#5c5c5c][[/COLOR][/SIZE]i[SIZE=2][COLOR=#5c5c5c]].[/COLOR][/SIZE]getId[SIZE=2][COLOR=#5c5c5c]()).[/COLOR][/SIZE]toString[SIZE=2][COLOR=#5c5c5c]());[/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c]}[/COLOR][/SIZE]
nlapiSetFieldValues([SIZE=2][COLOR=#202020][COLOR=#000000]pcCaseField[SIZE=2][SIZE=2][COLOR=#5c5c5c].[/COLOR][/SIZE]USERASSIGNEDPARTNERS[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#5c5c5c],[/COLOR][/SIZE]vals[SIZE=2][COLOR=#5c5c5c]);[/COLOR][/SIZE]
The result when the form loads is they are not set. I try other normal text fields using nlapiSetFieldValue and that works fine. I have to be missing something as I assume this works. Any one have an idea?
Edit Update: If I hide the field, then the values get set. I may be dealing with a visual UI issue where the highlight of the fields is not displaying...
Thanks.
-Steve