Set a reference field value from a script include

janindiadoc_1
Tera Expert

Hi,

 

Is there a way to set the sys id returned from script include in the reference qualifier for a reference variable?

 

I have a reference variable that refers to sys_user_group table. I'm calling a script include from the reference qualifier of this field as below.

javascript: new XXXutils().getGroups(current.variables.a,current.variables.b,current.variables.c);

 

The value returned from this is populated in the reference field dropdown, but not set in the field automatically.

I know this could be achieved by a client script, but just checking if there is a way in the reference qualifier itself to set the value in the variable to display it without selecting from the dropdown.

 

Thanks

 

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi @janindiadoc_1 Reference Qualifiers are used to filter out data and they will not set to field automatically, it will just show under drop down, if you need to set it on field then use Client callable script include and onChange client script to set it on the field.

Regards
Harish

View solution in original post

5 REPLIES 5

SanjivMeher
Kilo Patron
Kilo Patron

Yes. It is possible. In the reference qualifier, make sure to use sys_idIN

For ex

javascript:'sys_idIN'+new XXXutils().getGroups(current.variables.a,current.variables.b,current.variables.c);

 

The script include should return one or more sysid separated by comma


Please mark this response as correct or helpful if it assisted you with your question.

Harish KM
Kilo Patron
Kilo Patron

Hi @janindiadoc_1 Reference Qualifiers are used to filter out data and they will not set to field automatically, it will just show under drop down, if you need to set it on field then use Client callable script include and onChange client script to set it on the field.

Regards
Harish

SunilKumar_P
Giga Sage

Hi @janindiadoc_1, The script include will return the data. In case if you are returning just one record and doesn't have the choice 'None' on the variable, it may be possible that the returned record will be displayed as the variable value in the dropdown (as it is the first record / value) but if you are returning the multiple records then only the first record will be show as a choice and not the other records. You may need the client script to set the specific value on to the variable.

 

Regards,

Sunil

Aman Kumar S
Kilo Patron

Hi @janindiadoc_1 

No, you will not be able to achieve this by using the Reference qualifier.

And if you are sure that it is going to be just value that you get back from your query, better you can stick to using the Async GlideAjax to fetch the value and populate the field instead of going through the Ref Qual way

Best Regards
Aman Kumar