- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2016 10:10 AM
Hi everyone,
I am trying to set a value to a catalog item variable via Catalog Client Scripts. It is working if being loaded in native UI but when opening in Service Portal the value is not being set. I'm really baffled at this. Anyone know why? Thanks - Regina
Here's the code (onLoad):
g_form.setValue('variables.url', 'test');
Native UI:
Service Portal:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2016 11:35 AM
Hmm...could you post your entire client script? Also, make sure you have UI Type marked as Both on the catalog client script record itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 08:00 PM
Seems to be a timing problem with angularJS. Using a setTimeout call seems to fix it;
You'll want to change
g_form.setValue('comments',new Date());
to
setTimeout(function() {
g_form.setValue('comments',new Date());
}, 0);
Essentially pushing the setValue call to the next execution stack so that the value set happens after the AngularJS evaluation finishes.