Groovy Sample – GeneratePrgrmDocReport.groovy for Profitability and Cost Management

Prerequisites: json.jar

Common functions: See Appendix C: Common Helper Functions for Groovy.

def generateProgramDocReportJob() {
	JSONObject json = new JSONObject();
	json.put("fileName", "2016JanActual.pdf");
	json.put("fileType", "PDF");
	json.put("useAlias", false);
	json.put("stringDelimter", "_");

String povGroupMember = "2016_January_Actual";
String urlString = serverUrl + "/epm/rest/"+ apiVersion + "/applications/"
+ appName + "/povs/" + povGroupMember.trim().replaceAll(" ", "%20") + "/
jobs/programDocReportJob";

def url;
try {
	url = new URL(urlString)
} catch (MalformedURLException e) {
	println "Malformed URL. Please pass valid URL"
	System.exit(0);
}
executeJob(url, "POST", json.toString());
}