Help with dot walked field in Client Script

Still Learning
Kilo Sage

Hello SN community, 

I'm trying to write an onChange client script based on a dot walked field (Operating System) on my form but the field does not appear in the list of selectable fields.  The requirement is to have the field auto-populated based on what is in the parent record of the form so I have a script include for that. Can this be done in a client script? If yes, can someone please tell me how to get the field to show up.  What I am seeing is below: 

Form Field: Operating System(OS)

     find_real_file.png find_real_file.png 

Missing as an option in Client Script:

find_real_file.png

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

You can access the dot-walked field within a UI Policy and then use the script section to then set a particular value for another field. In the condition builder, you can scroll to the bottom of the field selections and choose "Show related fields", then scroll back up to your initial field and then choose the dot-walk applicable entry indicated by => '... fields' verbiage.

From there, in the script section, you can set what would happen if true and/or false (such as calling GlideAjax, etc. it's a client scriptable field).

Additionally, if you don't want it to execute onLoad, you can uncheck the "On load" checkbox to not have it execute on load (it'll still execute on change).

Takes a bit of setup, but it can be done.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

6 REPLIES 6

Aman Kumar S
Kilo Patron

You can't create onChange script for dot walked fields

Best Regards
Aman Kumar

Still Learning
Kilo Sage

That explains it then ... thank you Aman!!

Allen Andreas
Administrator
Administrator

Hello,

You can access the dot-walked field within a UI Policy and then use the script section to then set a particular value for another field. In the condition builder, you can scroll to the bottom of the field selections and choose "Show related fields", then scroll back up to your initial field and then choose the dot-walk applicable entry indicated by => '... fields' verbiage.

From there, in the script section, you can set what would happen if true and/or false (such as calling GlideAjax, etc. it's a client scriptable field).

Additionally, if you don't want it to execute onLoad, you can uncheck the "On load" checkbox to not have it execute on load (it'll still execute on change).

Takes a bit of setup, but it can be done.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

James Fricker
Tera Guru

The other option is to create the client script for another field and then list edit the client script to point to the dotwalked field instead. It works, but its messy. The other option, to make it a bit cleaner, is to add the attribute "allow_references=true" to the sys_script_client.field dictionary entry. This lets you select dotwalked fields on client scripts. Which, from my limited testing, do seem to work. I have also found there are two OOTB fields in the HR app that use dotwalked references.
2023-12-01_174104.png