How to access catalog variables from Business Rule Script

agarc657
Giga Contributor

Hello Everyone,

I have a Business Rule Script that populars a field called Requester upon a task being created

The Business rule is run on the task table.

The issues i'm having is that there is a variable on the Catalog item that the user populates called "requested for" and I need to assign its value

to my Requester field. However on the task level how do I access or dot walk to the catalog variables .

(function executeRule(current, previous /*null when async*/) {

                  // check to see if task is an incident

                    if (current.sys_class_name == 'incident')

                                  {

                                      current.u_requester = current.caller_id;

                                    }

                    if (current.sys_class_name == 'sc_req_item')

                                    {

                              if(JSUtil.notNill(current.variable_pool.requested_for)){

                                      current.u_requester = current.variable_pool.requested_for;

                                }

                              else{

                                    current.u_requester =current.opened_by ;

                              }

                              }

                    if (current.sys_class_name == 'sc_task')

                          {

                            if(JSUtil.notNill(current.variable_pool.requested_for)){

                              current.u_requester =current.request_item.variable_pool.requested_for;

                      }

                          else{

                            current.u_requester =current.request_item.opened_by ;

                      }

                      }

                          })(current, previous);

the bolded lines are my the ones im having problem with. Is there a way to access these variables from a business rule ? if not can does anyone have an alternative option for

populating my the requester fields based on the script above.

Edit to be clear both current.variables and current.variable_pool do not work

Thanks everyone

10 REPLIES 10

eduardo gushike
Tera Contributor

Hi Guys try: 

current.hierarchical_variables.nameOfVariable

Thx!