How to GET variable set variable value from client script for Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2018 11:02 PM
Hi Team,
I am trying to access variable set variable value form client script, it is working fine in ITIL view but, it's not working in service portal.
var clr = g_form.getValue('variables.requested_for');
Note: Using the variables.var_name
notation with the g_form API is not supported in Service Portal.
- 15,156 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2018 11:25 PM
Hi Bhargava,
Try using :
- $scope.page.field
- $scope.page.g_form()
Refer : Service Portal & Client Scripts
Note : Make sure your UI Type is set to "All".
Mark If Correct/Helpful.
Regards,
Ajay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2018 11:10 PM
Hi Bhargava,
Please check UI type of the script is selected as "Both". It will run on both ITIL and SP.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 08:12 AM
Hi Team,
Service portal not support to the variables.var_name
var usr =
g_form.getValue('variables.requested_for');
The below onchange client script working fine for my requirement.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var user = newValue ; // using this i am able to get updated value in that field .
Thank you for your support guys.