Olá,
Tive que fazer algo parecido, porem no momento de retorno de sucesso da função eu tenho que atualizar a pagina, para que o fluig atualize meus dataset's
Segue exemplo da minha situação :
function salvarImprime() {
var user = [parent.WCMAPI.userCode];
if (parent.ECM.workflowView.availableUsers.users[0] && parent.ECM.workflowView.availableUsers.users[0].colleagueId) {
user = [parent.ECM.workflowView.availableUsers.users[0].colleagueId]
}
var state = parent.ECM.workflowView.availableStates[0].sequence,
formData = parent.ECM_WKFView.getFormData();
parent.ECM_WKFView.conditionsAutomatic.selectedDestinyAfterAutomatic = -1;
parent.ECM_WKFView.conditionsAutomatic.conditionAfterAutomatic = -1;
movimentActivity(false, formData, user, state, null , false , null , null, null, null, null, true )
}
function movimentActivity (completeTask, formData, selectedColleague, selectedState, showMessage, isAutomatic, onComplete, isReturn, passValue, subProcessId, subProcessSequence, hideModal, transferTaskAfterSelection) {
var comments = "";
var newObservations = [];
if (parent.ECM_WKFView.wkfViewObservation) {
comments = parent.ECM_WKFView.wkfViewObservation.getObservation();
newObservations = parent.ECM_WKFView.wkfViewObservation.getUnsentObservations()
}
var _this = parent.ECM_WKFView ,
message = "",
attachments = [];
var pID = parent.ECM.workflowView.processDefinition.processInstanceId;
this.newRequest = pID === 0;
if (this.newRequest) {
attachments = parent.WKFViewAttachment.getAllAttachments()
}
var senddata = {
processInstanceId: pID,
processId: parent.ECM.workflowView.processId,
version: parent.ECM.workflowView.version,
taskUserId: parent.ECM.workflowView.processDefinition.taskUserId,
completeTask: completeTask,
currentMovto: parent.ECM.workflowView.processDefinition.currentMovto,
managerMode: parent.ECM.workflowView.processDefinition.managerMode ? true : false,
selectedDestinyAfterAutomatic: _this.conditionsAutomatic.selectedDestinyAfterAutomatic,
conditionAfterAutomatic: _this.conditionsAutomatic.conditionAfterAutomatic,
selectedColleague: selectedColleague,
comments: comments,
newObservations: newObservations,
appointments: parent.ECM.workflowView.appointments,
attachments: attachments,
pass: passValue,
digitalSignature: parent.ECM.workflowView.digitalSignature,
formData: formData,
deleteUploadFiles: parent.ECM.workflowView.deleteUploadFiles,
isDigitalSigned: parent.ECM.workflowView.isDigitalSigned,
isLinkReturn: isReturn,
versionDoc: parent.ECM.workflowView.processDefinition.versionDoc,
selectedState: selectedState,
internalFields: parent.ECM.workflowView.internalFields,
subProcessId: subProcessId,
subProcessSequence: subProcessSequence,
transferTaskAfterSelection: transferTaskAfterSelection,
currentState: parent.ECM.workflowView.sequence
};
parent.WCMAPI.Create({
url: parent.ECM.restUrl + "workflowView/send",
async: true,
data: senddata,
styleGuide: true,
success: function(data) {
parent.window.onbeforeunload = null;
parent.location.reload(true)
},
error: function(err) {
alert("error")
loading2.hide()
},
complete: function() {
}
})
}
Ele funciona bem quando o fluxo já foi iniciado, ou seja, ele já tem um código de processo.
Quando é atividade 0 ( fluxo não startado ) ele da alguns problemas. Para isto tem que adaptar se for de atividades inciais.
Bem, Enjoy com este filho =)