Urgent!!!!!! Business rule to set auto assignment

madanm2103
Kilo Explorer

Hi All,

 

I have written a business rule to set the auto assignment group for Catalog Item.

But it is not workin....

 

Please help.

 

My requirement is, there is a choice field "Choose Role" which has some 30 values in my Catalog item.

If I select A or F or M for Choose Role, request item should assign to XYZ group, else should assigne to ABC group.

 

Below is my script.

var gr=new GlideRecord("sc_req_item");

gr.addQuery("sys_id", current.sys_id);

gr.query();

if(gr.next()){

      CatItem = gr.cat_item.getDisplayValue();

      //gs.addInfoMessage(CatItem);

      if (CatItem =='Demo')

              {

              var RoleType = current.variables.chooserole_vce1.getDisplayValue();

              //gs.addInfoMessage(RoleType);

              var grpname;

              if (RoleType == 'A' || RoleType == 'F' || RoleType == 'M')

              {

                      //gr.setValue('assignment_group', 'SEC Adm VCE VMS');

                      grpname = 'XYZ';

                      //gs.addInfoMessage(current.assignment_group.name);

              }

              else

              {

                      grpname = 'ABC';

              }

}

 

Please help, its urgent

 

Thanks in advance.

 

Thanks,

Madan

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

try this ...



condition : current.cat_item.sys_id == 'sys id of your catalog'



script:



var RoleType = current.variables.chooserole_vce1.getDisplayValue();


if (RoleType == 'A' || RoleType == 'F' || RoleType == 'M')


      {


      current.assignment_group.setDisplayValue('XYZ');


}


else


      {


      current.assignment_group.setDisplayValue('ABC');


}


View solution in original post

10 REPLIES 10

No Friend,



Its not working....


Value is not setting into Assignment group....


Community Alums
Not applicable

Try this:



current.assignment_group.setDisplayValue('SEC Adm VCE VMS');




Tim


Ashutosh Munot1
Kilo Patron
Kilo Patron

HI Madan,


Why dont You edit your IF statement and try it again and compare it with actual values rather than display value.



Or simple Use Current.assignment_group='sys_id' or name of the group in ' ' or Value of the group name.


Kalaiarasan Pus
Giga Sage

try this ...



condition : current.cat_item.sys_id == 'sys id of your catalog'



script:



var RoleType = current.variables.chooserole_vce1.getDisplayValue();


if (RoleType == 'A' || RoleType == 'F' || RoleType == 'M')


      {


      current.assignment_group.setDisplayValue('XYZ');


}


else


      {


      current.assignment_group.setDisplayValue('ABC');


}


Hi Kalaiarasan,



Thanks its working fine.



Regards,


Madan