Save and Reload a child CDM form

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!

Hello @nhat-round-cloud, I forward you the answer of my colleague @loi-risen-dale

Unfortunately, after getting advice from the client, I’d confirm that this specific use case is not supported and that there’s no easy workaround.

If you believe this is a valid requirement for your project, please create an A12 Overall ticket.
Thank you!

Thanks for your info!
We considered it and decided this case shouldn’t happen so I will close this topic.

Regards,
Nhat.

Hi,

I just want to confim, that as I understand, there’s currently no way to save state of a Child Activity (CRUD::save), without traversing back to the Root form activity and clicking Save from there.

I’m especially interested in a scenario where there is a Parent form based on a CDM and a Child form (based on another CDM - subset of parent CDM). We also have set the Child activity descriptor is derived from Parent scene.

As nesting of Child activities can have arbitraty depth it appears natural to have ability to save work progres while editing a nested form.

@m.stepniewski That’s true!