Reference contribution attribute showing UI macro for different field than configured one


Description

Say, there are 2 reference fields on a form (fieldA and fieldB) and both have 2 different ref_contributions attribute present for the dictionary of the fields, pointing to different UI macros. It was observed that in a use case that when we invoke the reference contribution for fieldA, it was showing the macro for fieldB.

Cause

It is possible that both the UI macros for fieldA and fieldB were using same method name as 'showRelatedList' (usual method name that can be found on other OOB UI macros). Hence system was confusing to get which one to pick and was taking the for last reference field. which has ref_contributions present, which was for fieldB.

Resolution

Changing the method name on the fieldA's UI macro resolves the issue. It can be changed to something as 'showRelatedListFieldA'

Please make sure to change the name in both the script and on onClick method.

Additional Information