When trying to configure an onInit rule to create Matrix Position row, the rule is create and assigned as onInit to the Position object. The rule triggers fine when the Position is created but when you try to save the new Position you get an error messages:
"Related Position is a required field/association in Object Matrix Position For Position."
The error will repeat for every Matrix Relationship row you create using the onInit rule. For example, you use a rule to create 2 Matrix Relationship rows. You add the "Related Position" to both and try to save and you get the following error:
Employee Central 2.0
Reproducing the Issue
If you have created an onInit rule to add Matrix Relationship rows to a new Position when it is created, using either of the following methods, you will encounter the error message:
Scenario 1) Default the Matrix Relationship "Type" rows when creating a new Position
You need to use the "Set" condition in the THEN part of the rule to add the Matrix Relationship row to the new Position. Note that this will only add the row. The "Related Position" will still need to be specified before saving the Position (as Related Position cannot be NULL).
Scenario 2) Default the Matrix Relationship "Type" rows when creating a new Position, but in one of the rows, specify a particular position
If you wanted to default the Related Position for a particular Type, you could also use "Create" condition to do so. NOTE: Do not set "Related Position" to be equal to NULL when using "Create" as this value cannot be set to Null
There is a code defect which causes the error message to trigger when trying to save the new Position if either of the mentioned onInit rule configurations are attempted. This is currently being tracked on XAF-13452
For now the only solution is to assign the rule to a Required field as "onChange". It would be best to assign the rule to a field which would always be updated when updating or changing a Position.
Please refer to artcile 2416892 - How to default Matrix Relationship Type when creating a new Position
This is confirmed as currently unsupported, and an Enhancement Request is open internally to implement support for this requirement - XAF-13952
Related Position is a required field/association in Object Matrix Position For Position, onInit, Employee Central, EC , KBA , LOD-SF-EC-POS , Position Management , Problem