Question

I have wondered about this for years and have seen questions posted out there on this but never have found an answer.

Let's say you have a Form with datasource A, B, and C. "A" will act as the parent and both "B" and "C" join to "A" as an Inner Join. Now, I have logic on the Table object of A in the modifiedField() method. Inside that method, you should be able to access relating data by using this.joinChild(). However, since there are multiple child datasources, which one will it pick? And also, how do I access the one that it doesn't automatically pick?

I found there is a this.datasource(), but I didn't see any methods within that would seem to get to other datasources.

Was it helpful?

Solution

As joinChild takes no arguments, you will have to rearrange your datasources to have one child only like in this question: Display Methods - Multiple Form Data Sources. This can be done in AX 2012 by linking C to A directly using the third argument to addLink. You can then use A.joinChild().joinChild() to reference C.

Or you will have to move your logic to the form where the records can be referenced directly.

Using joinChild in the modifiedField method is a sure sign of trouble, as you cannot be sure that a field is modified in a context of a join.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top