The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to get a to report against the total rejection count on the change request table, as well as being able to report how many times an approval group rejected on the approval [sysapproval_approver] table ?

jennyjenny
Kilo Contributor

Hello Team,

I trying to get to report against the total rejection count on the change request table, as well as being able to report how many times an approval group rejected on the approval [sysapproval_approver] table .

For the rejection count :

- I have created a new field called Rejection Count to capture the count that how many times the count has been rejected .  

- I have written the business rule as below

      Condition :   current.state.changes() && current.state=='rejected'

    Script :

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

      // Add your code here

      var sd = new GlideRecord('change_request');

if(sd.get(current.sysapproval)) {

//sd.u_rejection_count++;

sd.u_rejection_count++;

      sd.work_notes='Rejection Count : '+sd.u_rejection_count;

sd.update();

}

})(current, previous);

Now the rejection count is calculating how many times the chage is rejected .

But the user is requesting how many times an approval group rejected on the approval [sysapproval_approver] table .

I am not able to get report on this requirement .

anybody help on this.

Thanks,

Jenny

6 REPLIES 6

Fabian Kunzke
Kilo Sage
Kilo Sage

Hello,



I think the best way to do this is via a custom report:


http://wiki.servicenow.com/index.php?title=Custom_Chart_Rendering#gsc.tab=0



This way, instead of writing data to a record(s), you can generate two summary sets (one for each kpi to mesure) and display them as a lineplot over each other (within one plot).



Hope this helps.



Greetings



Fabian


gdd
Giga Expert

you can report on group approval table where you can get change record number, group



but it wont give you exact count if you have used roll back in workflow



so you can change above new field to string and put the group name against the count, whenever needs an update you can inceremnt the counter against the group in the string field.



this can be achievable by string manipulations


jennyjenny
Kilo Contributor

Hi ,



Could you please help me in the code, how to take from the Group Approval .



Thanks,


Jenny


this is the group approval table name



sysapproval_group



On this group you will find one record per group approval, you can put same kind of business rule here as i have updated



you can use JSON there to store data in the string field