Two Events happening on same time occurs error

#1

I’m having the activiti Bpmn file, in that there is having transition of task. While transition I need to create the due date for that new task. my problem is due date and new task happening on same time. because of that I’m getting error.

Cannot find task with id 1602667

                    onClose: function (date) {
                        if (valid) {
                            date = Date.parse(date);
                            if (oldDate !== date) {
                                var tasks = getSet(context, 'task') || getSet(context, 'tasks'),
                                trans = Ember.get(context, 'transition') || Ember.get(context, 'propertyMap.transition'),
                                requestData = [];
                            if (!tasks.length) {
                                resolve();
                                return;
                            }
                            if (!trans) {
                                trans = 'Done';
                            }
                                tasks.forEach(function (task) {
                                 requestData.push({ name: 'id', value: (Ember.get(task, 'id') || Ember.get(task, 'currentTask.id') )});
                                requestData.push({ name: 'transition', value: trans || '' });
                            });
                            if (context.get('serviceParams')) {
                                Object.asAjaxData(context.get('serviceParams')).forEach(function (param) {
                                   requestData.push(param);
                                });
                            }

                         return (Core.services({
                            type: 'post',
                            service: 'workflow/task/transition',
                            data: requestData,
                            json: true
                        })
                        .done(function (res) {
                                Core.Action('Core:updateTask', context, { dtDue: date });
                            Core.model.ingestResources(res);
                            var inspected = Core.controller.detailsObject,
                                wf = res.workflows || {};
                            if (inspected) {
                                Object.keys(wf).forEach(function (w) {
                                    var hist = wf[w].historicalTaskIds;
                                    if (hist.contains(inspected.currentTaskId)) {
                                        inspected.set('currentTaskId', wf[w].openTaskIds[0]);
                                    }
                                });
                            }

                            resolve();
                        })
                        .fail(function (xhr, status, error) {
                            Core.Error.show(error);
                        })
                        .always(function () {
                            tasks.forEach(function (task) {
                                if (Ember.get(task, 'isClip')) {
                                    Core.model.clip.clear();
                                }
                            });
                            var wfController = Core.Tab.Workflow.getController();
                            var sel = wfController.get('selection');
                            wfController.reloadResultSet();
                            var rs = wfController.get('resultSet');
                            rs && rs.done(function () {
                                var s = Ember.Set.create();
                                rs.get('content').forEach(function (item) {
                                    if (!item) { return; }
                                    s.addObject(item);
                                });
                                sel.forEach(function (item) {
                                   if (!s.contains(item)) {
                                       sel.remove(item);
                                   }
                                });
                            });
                            sel.clear();
                            resolve(tasks);
                        })
                    );




                            }
                        }
                    }

In that Core.Action('Core:updateTask', context, { dtDue: date }); is using for updating the duedate. If I use on the top If statement Due Date is updated, but Transistion is not happening. If I’m using on the done function, the transistion is happened and moved to the new Task Id. Because of that it searching Task Id and showing error. Please provide me suggestion on this. I need to create both the Transistion and meanwhile update the date.

0 Likes

#2

I’m trying to understand this enough to help, but I cannot. There’s too much context left out from what you showed, and this code is doing unusual custom things that it’s impossible for us to help with.

Maybe we can help if instead you explain how the application feature you’re working on is supposed to work.

0 Likes