How to use GlideAggregate with Flow Designer

Edxavier Robert
Mega Sage

Hi I have a scheduled job that execute the script below, but I am using GlideAggregate to groupby the approver. But how I can accomplish this using flow designer so I can move scheduled job into Flow designer. 

 

function execute() {
	/* query approval table with GlideAggregate*/
    var approval = new GlideAggregate('sysapproval_approver');
	/* select only requested records */
    approval.addEncodedQuery('state=requested^due_dateRELATIVELT@dayofweek@ago@6');
	/* group by approver in order to get unique values (one distinct user at a time) */
	approval.groupBy("approver");
    approval.query();

    while (approval.next()) {
		/* Create a unique Scheduled Report */
		createScheduleReport(approval.approver);
    }
}

 

3 REPLIES 3

DrewW
Mega Sage
Mega Sage

Hi, I watched that video already, but don't quite understand how I can accomplish the use of the group by using Flow Designer.   

You need to add an input for it for the actions and the script and then add the code for it.  You will probably have to also change the output so its a JSON object so you can output the results.