The attributes used -
bs_id String bs_id
pcsAttachment String (Attachment) pcsAttachment - File attachment attribute
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
records = bmql("select username, password, reviseUrl, requestUrl from integration.remoteApproval");
username=""; password=""; reviseUrl=""; requestUrl="";
for record in records {
reviseUrl=get(record, "reviseUrl");
requesturl=get(record, "requestUrl");
username = get(record, "username");
password = get(record, "password");
}
// This JSON is provided as an example. This needs to be changed according to the input
// defined for the PCS process. The CPQ Admin should work with PCS Admin to get details on
// what input is required to be passed into the process, based upon what has been defined.
json = "{\"processDefId\":\"default~CPQApprovalDemo!3.0~QuoteApprovalProcess\",
\"serviceName\":\"QuoteApprovalProcess.service\",\"operation\":\"start\",\"payload\":
\"Suyog" +bs_id + "
1256723
approve_pCSsubmit\",\"action\":\"Submit\"}";
attachmentsDict = dict("dict");
attachment1 = getattachmentdata(pcsAttachment, true);
put(attachmentsDict,"attachment1",attachment1);
header = dict("string");
put(header, "Accept", "application/json");
encodeCredential = encodebase64(username+":"+password);
put(header, "Authorization", "Basic "+encodeCredential);
//response = urlmultipartbypost(requestUrl,json,header); In case, there are no attachments
response = urlmultipartbypost(requesturl,json,header,attachmentsDict);
if(get(response,"Status-Code") == string(200)) {
processString= json(get(response,"Message-Body"));
return jsonget(processString, "processId","String");
}
else {
throwerror(get(response,"Message-Body"));
return "";
}