User Tools

Site Tools


Salesforce Org Configuration Options

Instead of deleting and recreating an Apex Trigger each time a dynamic share is modified, triggers are now updated with the dynamic share triggers to allow you to easily move changes to your production organizations. Note that because attachment triggers are not changed, attachment triggers will continue to be deleted and recreated when you select the “Include Attachments” option on a dynamic share.

Because of how Salesforce moves change sets between development and production organizations (you can move modified objects, but removing items from production that were deleted in development requires the user to do so through a developer environment plugin like Eclipse), an Active field has been added for when you want to turn off a dynamic share but may want to turn it back on later on.

When Active is selected, the Apex Trigger is saved with the trigger's content as normal. When Active is unselected, the Apex Trigger will be updated to be blank (no actions or operations) so as to not share out any records. This way you can turn off a dynamic share without having to delete it.

As well, the “Include attachments” Apex Trigger will do the same thing; when selected, the attachment Apex Trigger is created with the necessary actions to share attachments and when unselected, the attachment Apex Trigger will update to be blank so it doesn't have to be deleted and can be turned back on later when this option is selected again.

Deleting a dynamic share will delete both Apex Triggers on the table and attachments.

Since only certain tables (sobjects) support creating Apex Triggers on them, the list of tables in the dynamic share form will only show these tables that support Apex triggers.

Table List Paging

Because of Salesforce Visualforce limits with how many objects can be collected in one object, in prior versions where there were more than 1,000 tables, the page to create a new dynamic or bulk share would not display and instead would show this error message: Collection size 1,504 exceeds maximum size of 1,000

To resolve this, we page the Table selection box to get 998 tables at a time with “Next” and “Previous” options available to page through the list of tables (to give room for the “Please select a table” and “Next”/“Previous” options since the box can only hold exactly 1,000 entries):

Additional Settings

Include Child Records

The “Include Child Records” option provides a way to share out child records of a parent record. This is done by creating Apex triggers so as to capture events on those child tables, with filtering done so we only share out child records related to the parent record.

After selecting the parent table on a dynamic share form, the Include Child Records option will populate with child tables that support Apex triggers. Select those tables where you want to share child records from.

For example, if you select the Case table for the dynamic share and want to share out comments on Case records, select the “CaseComment” table in the “Include Child Records” option:

Like attachments, this option currently only supports sharing out all fields of the child tables.

As is the case with the Apex trigger created for the parent table specified in the share, any triggers created for the child tables will be set to blank when the dynamic share is set as inactive and/or the user removes a child table from the selected list (i.e. the user first selects the CaseComment table in the “Include Child Records” option and creates a trigger for it and then later decides to remove the CaseComment table from the selected list). This is done to be consistent with the approach of not deleting Apex Triggers since Apex triggers can only be created in sub-prod orgs and moved over to prod orgs. (i.e. once you delete an Apex trigger in production you can't recreate it without going through the process of doing it in a sub-prod).

Apex triggers on the child tables can be deleted but when the Apex trigger is deleted on the parent table, notably when the dynamic share itself is deleted.

2017/12/27 18:02 · Paul Nguyen
salesforce_dynamic_share_configuration.txt · Last modified: 2019/01/04 11:38 by timothy.pike