Does anyone know how to make a call to a REST service inside the beforeSendData event, below my code (not functional):
My goal is to execute a call on a REST service from the fluig itself in order to get the detail of a request (process instance).
I tried to use the standard jQuery call but it did not work, this script runs on the server side.
function beforeSendData(customFields, customFacts) {
log.info("****************teste");
customFields[0] = "1";
customFacts[0] = 10.53;
var processInstanceId = getValue("WKNumProces");
var taskUserId = getValue("WKUser");
log.info("****************teste");
//Tentei usar esta API mas não funciona
//Tentei usar jQuery mas também não funcionou.
WCMAPI.Read({
type: "POST",
url: WCMAPI.getServerURL() + '/ecm/api/rest/ecm/workflowView/findDetailsMyRequests?processInstanceId=' + processInstanceId + "&taskUserId=" + taskUserId,
async: false,
success: function funcao(data) {
log.info(txt);
var data = jQuery.parseJSON(txt);
},
error: function (msg){
log.info("****Não funcionou********");
}
});
}