Show/Hide fields in approval summarizer based on Category of change

patrickmcgonagl
Mega Expert

We use UI Policies to show and hide a lot of fields on the Change form based on the Category.   When the approver looks at the approval view it shows all the fields from the Change form on the summarizer (formatter).   We would like to only show fields related to the change category that is selected.

(not very good with jelly script and have been spinning my wheels trying to figure this out)

We're currently using the approval_summarizer_default ui macro

1 ACCEPTED SOLUTION

patrickmcgonagl
Mega Expert

We were able to add an if statement inside the g:evaluate


In this case, only one type of Category will need to have a different view.   else if statements could be used to define specific views for each category (or another field from the change form if necessary)


We needed to create another view on the change form to match the one that is called in the else statement



              <g:evaluate var="jvar_my_form">


                      var gc = new GlideController();


                      var p = new GlidePopup(gc, "${gr.getRecordClassName()}");


                      p.putParameter("sys_id", "${gr.sys_id}");


  <!--gs.print("Test:"+"${gr.category}");-->


        <!-- Category1 would be the value of the choice you are looking for from the category field -->


  if("${gr.category}"=="Category1"){


  p.putParameter("sysparm_view", "approval");


<!-- if the category is anything else show another view -->


  }else{


  p.putParameter("sysparm_view", "approvalnotcategory1");


  }


                      //PRB579164: Skip g_form creation in activities.xml if activities displayed in formatter


                      p.putParameter("sysparm_skip_gform", "true");


                      var rp = p.getRenderProperties();


                      rp.setSmallCaption(true);


                      rp.setInlinePopup(true);


                      rp.setReadOnly(false);


                      p.getPopup();


              </g:evaluate>


View solution in original post

6 REPLIES 6

it depends on what field you are using on the Change form to show where it is at in the change process.  


you can try debugging and use the following in your code


gs.print("Test:"+"${gr.example_field}");



replace example_field with the field you are referring to in the if statement, then search the log for Test: to see what value is returning.


barkha1
Kilo Contributor

Its not coming in logs Patrick, I think its not taking our if condition, gr.state is not taking the value of approval form