1

I have a somewhat complex scenario where I have multiple objects in my Data Model associated to each other like Contacts, Users, Campaigns, Campaign Members and one custom object.

The relationships are like  Partner Contacts (associated Partner Users) are asscociated with Business Contacts.

Partner Contacts are associated with Campaigns via a Custom object. Business Contacts are associated with Campaigns via Campaign Member Object. Contact Share is calculated and inserted to associate Partner Users to Business Contacts in a many to many relationship.

Currently, data load process for the above is a multistep process, only the ContactShare gets calculated internally and inserted. Business users wantto be able to do a single file load and all these data load getting automated on the same load.

I am trying to figure out an optimized way to do so and need your help here.

  • what are the object's data to be loaded? and how you are planning to load data, is that by dataloader? Salesforce loads data per object basis – Santanu Boral Mar 24 '17 at 15:56
  • 1
    What's your question, exactly? Right now it just sounds like you're hoping someone will do your work for you? – Adrian Larson Mar 24 '17 at 16:07
  • @Adrian, I definitely do not expect someone to do the work for me. All I need is if someone has gone through this experience and has some ideas. – ParoTech Mar 27 '17 at 18:32
1

You've not provided sufficient details for us to give you detailed guidance on exactly how to approach this, but I can provide you with some information that may help guide you. Each object has it's own sharing table. For Contact, there will be a ContactShare object (See the Object Reference). A Share object exists for every Standard object that supports sharing and for all custom objects.

When new shares are created or existing ones removed, the sharing table is recalculated. This can be a time consuming process when there's a large database and it can cause long running operations. That's when you may want to enable "Defer Sharing Calculations". See A Guide to Sharing Architecture.

Defer Sharing Calculations

If you have an object that utilizes sharing and has a large volume of records (such as more than two million accounts), and you need to make a bulk change (such as a quarterly realignment requiring a hierarchy change), then there is a feature that can be enabled by Salesforce Support to defer automatic sharing calculations. Natively, every individual change to the role hierarchy, territory hierarchy, groups, sharing rules, user roles, team membership, or ownership of records can initiate automatic sharing calculations. When a bulk change is made, it causes a number of automatic sharing recalculations to begin. By suspending these temporarily, you are able to make the change and then have sharing calculations happen all at once. This is typically a more efficient and better performing method to bulk changes.

I would also recommend you look at Record-Level Access: Under the Hood to understand the concepts involved with sharing that affect sharing tables.

I'm confident you already understand the need for load order, or you wouldn't have posted this question. For those that may not, there's an excellent short video series on You Tube covering Data Import.

| improve this answer | |
  • Hi crmprogdev, the idea here is User will load a flat file structure and based on that I would 1. Create Contact Records 2. Create Contact Share Records. 3. Create CampaignMember Records 4. And create records for a custom junction object associating users and campaigns I already have a trigger which does Step 1 and 2, but I need the whole process in one go. I was trying to decide on flow and remove the trigger and also analyzing whether a batch job will be ideal in this scenario. – ParoTech Mar 27 '17 at 18:33
  • Doing this asynchronously would definitely be the way to do all the operations in one execution context. Your trigger can also write all the record Ids to a custom object which is queried, the records processed in bulk, any errors written back for error handling or upon success, deleted. Can also used scheduled or queueable jobs to query the custom object regularly & run the operations for you. All depends on how close to real time you need this done as to how to manage it. – crmprogdev Mar 27 '17 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.