Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

what could we use in the Business Rule script similar to the client side scripting which uses g_form.getValue('o_employee'); //'o_employee' is a variable in service request?

Raju Singh1
Tera Expert

Hi Experts,

I have an onoload client script which calls a script include which populates the value of the variable in the service request

qrykey = 'type=keyboard^install_status=1^assigned_to='+g_form.getValue('o_employee');      //'o_employee' is a variable

// in service request

 ga = new GlideAjax('KPopulateEmployeeAssets');
  ga.addParam('sysparm_name','populateKeyboard');
  ga.addParam('sysparm_table_name',"cmdb_ci_peripheral");
  ga.addParam('sysparm_encoded_query', qrykey);
  ga.getXMLAnswer(function(answer)
  {
   var str = answer.slice(0,-1);
   g_form.setValue('o_asset_keyboard',str);
  });
 
I want to use the same script in the business Rule, but I am not sure what shall I put in this place '+g_form.getValue('o_employee');      //as g_form is used in client script. What shall I use in Business Rule in place of this.

 

9 REPLIES 9

Ian Mildon
Tera Guru

Try replacing the g_form part with gs to make it read '+gs.getValue('o_employee');

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,


You have to use : current.o_employee or current.getValue('o_employee ');

 

Thanks,
Ashutosh Munot

Hi Ashutosh,

current.o_employee is a variable in the request item.  It's not that value in the user table. In user table we have values like user_name and name.

Since, I have to use the script in after business Rule. will this script work??

 

Regards,

Raju Singh

 

 

Hi,

 

Then you can try to use : current.variables.o_employee if the BR is on Requested ITem.

 

Thanks,
Ashutosh Munot