+ Start a Discussion
Kelvin CheungKelvin Cheung 

Dependencies to SObjects from pageBlockTable

We have Visualforce pages in our package with pageBlockTables displaying info from NoteAndAttachment SObjects.  Inside of that pageBlockTable, we display the column:
<apex:column value="{!na.ParentId}" headerValue="Related To"/>
After some research, we found that this column is responsible for a number of dependencies being created.  In fact, it seems every SObject on the system (including Custom Objects from other packages) has a dependency where it is referenced by the Visualforce pages with these pageBlockTables.  This means that other managed packages with Custom Objects cannot be uninstalled because of these dependencies.  Since we're not actually referencing these SObject types, we believe these dependencies are an error.

We've gotten around this problem by changing that column to:
<apex:column headerValue="Related To">
  <apex:outputLink value="/{!na.parentId}">{!na.parentName}</apex:outputLink>
</apex:column>
This gets rid of any dependencies, however it's slightly less functional than the reference to the ParentId.
Best Answer chosen by Kelvin Cheung
James LoghryJames Loghry

Interesting!  What happens if you try to use dynamic fields instead of "ParentId"?

For instance change it to:

<apex:column value="{!na.[parentIdField]}" headerValue="Related To"/>
 

And then have a String variable in your controller called parentIdField and set it to 'ParentId'

I wonder if that would solve your issue?

All Answers

James LoghryJames Loghry

Interesting!  What happens if you try to use dynamic fields instead of "ParentId"?

For instance change it to:

<apex:column value="{!na.[parentIdField]}" headerValue="Related To"/>
 

And then have a String variable in your controller called parentIdField and set it to 'ParentId'

I wonder if that would solve your issue?

This was selected as the best answer
Kelvin CheungKelvin Cheung
Very good idea, James!  I did {!na['ParentId']} and that replicated the old functionality while getting rid of depdencies.  I think the dependencies are still a bug, but this is an adequate solution for us!