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

Bhargava4
Mega Expert

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.

3 REPLIES 3

Ajaykumar1
Tera Guru

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

Vichitra Garg
Mega Expert

Hi Bhargava,

Please check UI type of the script is selected as "Both". It will run on both ITIL and SP.

 

Thanks

Bhargava4
Mega Expert

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.