How to get the document path (EntityInstancePath) and formModelElementPath (ModelPath) given a field name?

We want to dispatch the valueChange of FormEngineActions.event to change the value of a field (specifically, DomainSingleTravelExpenseClaim.TravelData.ReturnDate) and have computation rules related to it automatically triggered. (We do not use ActivityActions.setData because of this).
The current code:

yield put(
			FormEngineActions.event({
				activityId: payload.activityId,
				engineEvent: Events.valueChange({
					value: outwardDate,
					path: [
						{ elementName: "DomainSingleTravelExpenseClaim", index: 1 },
						{ elementName: "TravelData", index: 1 },
						{ elementName: "ReturnDate", index: 1 }
					],
					formModelElementPath: [
						{ elementName: "Screen1" },
						{ elementName: "DetailsBusinessTrip" },
						{ elementName: "TravelDataDates" },
						{ elementName: "Row1" },
						{ elementName: "control-26204" }
					]
				})
			})
		);

Is there an API to get the path and formModelElementPath given the likes of the field name (something like ReturnDate or DomainSingleTravelExpenseClaim.TravelData.ReturnDate or DomainSingleTravelExpenseClaim, TravelData, ReturnDate as separate arguments)? If possible we do not want to hardcode the values like above, especially for the formModelElementPath.

I have the same problem :grinning:

hi @ahmad-warm-vale, do you have any ideal? We really want to resolve it.

Hi @anh-round-summit

to get the document path you can use the DocumentPathForInput hook for retrieving the document path.
For the formModelElementPath, you can use getAssignedObject from Document Service where you can pass the document and the document path.

This issue is now also solved through a feature available in A12 2023.06 version.

Hi @katerina-icy-token,
Could you more details about the solution or a12 document?

Thank you.

Hello,
unfortunately, this information is outside of my knowledge, I am just a messenger here :slight_smile: . However, I was told by @an-frosted-byte that there is a feature solving it in 2023.06 so maybe she knows more. Let’s wait for her response and, if necessary, we can reach out to the developers for more insights.

Hello, the feature is mentioned in the other thread that I linked in the question, and it’s A12-11742. It doesn’t answer the question on how to get the paths but it could help with our issue of not being able to trigger computation.