
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 08:54 AM
Hello SNow community,
i have often used "javascript:gs.getUserDisplayName()" in catalog items variables "Default value" field to dynamically set logged in user.
I now also want to call a function stored in catalog item script (type onLoad) to dynamically load values.
Variable:
Eg "javascript:mycustomclientscriptfunction()" -> "Default value"
Catalog Item script (onLoad):
function mycustomclientscriptfunction(){
return 'test';
}
Unfortunately this did not work. How to achieve this? Any hints ideas? Maybe there is a better way to go with "overall" ScriptIncludes? Do you have some samples for this?
Thx a lot and best regards
Vesp
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 09:10 AM
You can't call a client script or any client side code from the default value. You should be able to call an OOB or your own script include from the default value field, though.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 09:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 09:06 AM
Hi vespertinus,
Unfortunately, i dont think its possible, in the default value to call client script codes.
Why dont you extend the onLoad Client script to set the values based on conditions. Or you can use several Ui Policies to set the default values.
or dynamic reference qualifier like user manager is(dynamic) me( if the field is reference type and the table is sys_user)
Regards,
Shariq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 09:08 AM
While, answering i would also request to clarify the need for the default value setting in the variable.
Regards,
Shariq

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 09:10 AM
You can't call a client script or any client side code from the default value. You should be able to call an OOB or your own script include from the default value field, though.