Hi there,
We are troubled with save and reloading an entity in a child CDM form model, see image below:
export const startProcessEventMatcher = (action: AnyAction) => FormEngineActions.event.match(action)
&& Events.eventButton.match(action.payload.engineEvent)
&& action.payload.engineEvent.payload.name.startsWith(ProcessConstants.CAMUNDA_EVENT_PREFIX)
export function* startProcessEventSaga(): SagaIterator {
yield* takeLatest(startProcessEventMatcher, handleStartProcess);
}
export function* handleStartProcess({payload}: Action<FormEngineActions.FormEngineEventActions>): SagaIterator {
const processEvent = payload.engineEvent.payload.name.replace(ProcessConstants.CAMUNDA_EVENT_PREFIX, '');
const processNameAndPollingType: string[] = processEvent.split(':');
const activity: Activity = yield select(ActivitySelectors.activityById(payload.activityId));
const valid = yield call(isValid, payload.activityId);
if (!valid) {
yield call(ProcessNotification.processError, 'error.process.validation');
return;
}
yield putResolve(ActivityActions.save.started({activityId: payload.activityId}));
const {failed, done} = yield race({
done: take(ActivityActions.save.done),
failed: take(ActivityActions.save.failed),
});
if (failed) {
yield call(ProcessNotification.processError, "error.process.start_process");
} else {
yield put(PollingActions.loading({
activityId: activity.id,
isBusy: processNameAndPollingType[1] === ProcessConstants.SPINNER_LOADING_ANNOTATION_NAME,
}));
yield put(ActivityActions.lock({activityId: activity.id, id: activity.id, owner: activity.id, details: {}}));
const instanceId = done.payload.result?.instance;
yield call(ProcessNotification.processStarted, processNameAndPollingType[0], activity.id)
const processResult = yield call(getProcessEvent, activity, processNameAndPollingType[0], instanceId);
const processId = processResult[0].result;
yield put(PollingActions.startPolling({id: activity.id, processId }));
}
}
With the current setup, when clicking on the GET CLIENT DOCUMENT button there is a saga to put save action for the client and trigger a task in the backend to generate additional data for the document. Unfortunately the child form Client when saving the entity, the data is marked as a dirty document and will only be saved when the parent is saved.
Is there any solution to trigger save the client (which is child cdm form in my case) and reload the data for this context (the whole dataholder for activity)? because if the entity hasn’t been saved yet then the backend task can’t find it in the database.
Versions:
{
"@com.mgmtp.a12.base/base-model-api": "27.1.0",
"@com.mgmtp.a12.client/client-core": "14.5.2",
"@com.mgmtp.a12.dataservices/dataservices-access": "36.3.7",
"@com.mgmtp.a12.expression/expression-core": "0.4.4",
"@com.mgmtp.a12.formengine/formengine-core": "36.7.0",
"@com.mgmtp.a12.kernel/kernel-core-runtime-api-ts": "28.5.1",
"@com.mgmtp.a12.kernel/kernel-md-facade": "28.5.1",
"@com.mgmtp.a12.overviewengine/overviewengine-core": "36.5.1",
}
Thanks!
