Pages

Sunday, November 6, 2016

Salesforce Files Type and Sharing

"Files" in Salesforce introduce after Attachment and Document. They are not related each other. However, Files is related to Library, they support content search, while Attachment and Document are not. When you upload a file to library, the same file will be available in "Files" tab as well.

Here are few type on how the Files loaded and the differences:

1. Upload file directly to Files tab

2. Contribute file to Private Library

3. Contribute file to Shared Library

4. Upload file from Chatter record feed, or user feed, or Chatter group


If you click "Go to Content Detail Page", here is the differences:

1. Upload file directly to Files tab

2. Contribute file to Private Library

3. Contribute file to Shared Library

4. Upload file from Chatter record feed, or user feed, or Chatter group


We discussed about Content Architecture sometimes back, Files API is called ContentDocument start with prefix 069, while Library API is called ContentWorkspace start with prefix 058.

Let's query and see what is the difference from the backend
SELECT Id,ContentSize,FileExtension,FileType,ParentId,PublishStatus,Title FROM ContentDocument WHERE Id IN ('0693B00000083pw','0693B00000083q1','0693B00000083q6','0693B00000083qG') ORDER BY Title


- ParentId is refer to Library only - private library, record feed or chatter group is Not count.
- PublishStatus: P = Public, R = Private


Reference:


Saturday, November 5, 2016

Salesforce: Child Implicit Sharing

In the previous blog, we discussed Parent Implicit Sharing, let's discuss Child Implicit Sharing now.

Child Implicit Sharing is the ability of the Account owner, even if the user does not have access to the child record as defined in that child record.

Child Implicit Sharing also applies to the Account team, if the user is added as an account team member and given access to relevant child access (contacts, opportunities, and cases).



Querying the child Share object, such as OpportunityShare, you will see the RowCause as ImplicitChild.

Example: SELECT Id, UserOrGroupId, OpportunityAccessLevel, RowCause FROM OpportunityShare WHERE UserOrGroupId = '00580000001ren7AAA' AND OpportunityId = '0062H00001ESrWYQA1'



For the account owner, the account owner's role determines the level of access to child records (read-only or read/write). The same scenario is also applicable to users above the Account owner in the role hierarchy.


The above screenshot is taken from org. with all contact, opportunity, and case sharing settings "Private". If Contact sharing is "Controlled by Parent", you will not see Contact access here - the account owner will have full access to the Contact, even if the Contact is owned by another user.

Object (contact, opportunity, and case) with sharing "Public Read/Write" will also not be shown here, because all users have permission to read and edit the records.


Since the Winter '24 release, salesforce introduced Faster Account Sharing Recalculation, where the sharing access is not stored in CaseShare, ContactShare, or OpportunityShare object, but is determined when the user accesses the record; query to those objects will return zero records. You can use UserRecordAccess or look at the AccountShare to determine access.



Friday, November 4, 2016

Salesforce: Parent Implicit Sharing


In addition to the sharing setting defined by the system admin, the Salesforce platform also has built-in sharing behaviors between parent and child records. This sharing is called implicit sharing because it is not configured by administrators but defined and maintained by the platform.

Implicit sharing is automatic. You can neither turn it off nor turn it on — it is native to the platform. In other words, it isn't configurable; however, it's very important to understand how it works.

Parent implicit sharing provides read-only access to parent record (Account) when the user has read/write or read-only access in a child record (Opportunity, Case, or Contact) through child record ownership, sharing rule, or added as a team member (Opportunity Team or Case Team). 
For example, Account A has 3 contacts; if user X has access to one (or more) of the contacts of Account A, user X will be able to access the Account as read-only.
If the user has access to the child record via object permission (in Profile or Permission Set), the parent implicit sharing does not apply.

Parent implicit sharing only gives read-only access to the Account; for example, if A is the owner of an opportunity, parent implicit sharing will not give A access to ALL Contacts and Opportunities under the same Account.

Opportunity Contact Role
Parent implicit sharing does not apply by adding Contact Roles in the Opportunity. Adding Contact Roles to the Opportunity will not allow the Contact owner to have access to the Account.

Related Contacts
Parent implicit sharing does not apply by adding Contact as a Related Contact to an Account (indirect). Adding a contact as a Related Contact will not allow the Contact owner to have access to the Account.

Lookup Relationship
When the user has access to a record from other objects (NOT Opportunity, Case, or Contact) with a Lookup relationship to the Account, the user will see the Account Name only, but not the Account detail—this includes Account lookup to the Parent Account; the child account owner will see the Parent Account Name only.


The same behavior applies to lookup from other objects, including custom objects. For the Master-Detail relationship, the child record does not have an owner, so it is not applicable in this scenario.


If we look from the back end at how this is stored, there is an object called AccountShare. This object stores all the defined and implicit sharing. It also has RowCause, which tells us the reason that this sharing entry exists.

One of the values is ImplicitParent — the User or Group has access because they’re the owner of or have shared access to records related to the account, such as opportunities, cases, contacts, contracts, or orders -- so, it is not always the owner of the record, but as long as the user has access to the child records via sharing rules.

sample query: SELECT Id, AccountId, UserOrGroupId, AccountAccessLevel, CaseAccessLevel, ContactAccessLevel, OpportunityAccessLevel, RowCause FROM AccountShare WHERE UserOrGroupId = '0053400000AAkhz' AND AccountId = '0013400001RhrP3'



Wednesday, November 2, 2016

Salesforce: Use Colon for Report name


This tip is a quote from Salesforce success community #TipsTuesday "Using a colon in a report name places text before the colon on one line and text after the colon on another. This looks nicer and keeps reports with different names that need to be together, sorted together."

To keep this awesome tips, I share the tip with everyone from my blog and not buried in the forest of success community.

Here is normal Salesforce report naming.



When we add: in the report name, this is how it looks like when you or your user run the report, notice the different.



Let's look how we save it from Report Properties.



Note:
- this tip is not applicable to Dashboard.
- this also do not work in Lightning report


Last updated: 8 May 2017


Reference:


Wednesday, October 19, 2016

Salesforce: Customizable Campaign Influence Model

Before the Winter '17 release, when you have multiple Campaigns associated with the Opportunity, the Primary Campaign gets 100% of the Influence credit, and any other Campaigns get 0%.

This was frustrating for a multitude of reasons, but with Winter 17, this is an issue of the past. The new model provides flexible revenue attribution across multiple campaigns. Rather than just 100% of the credit given to the primary campaign on an opportunity, you can now do a first-touch, or last-touch attribution, or anything else in between.

For example, you could give 50% credit to the last-touch, 25% attribution to the campaign before the last, and 25% attribution to the first-touch. Or create a model that would evenly distribute credit for an opportunity across all campaigns that the lead touched, or set up a model that distributes 100% of the credit to the last campaign the lead touched.

The only thing you need to really worry about here is what to do with all your historic Opportunities. You can do a clean-up to get them into the new model or just start with this on new Campaigns only. This great new feature works in Classic as well as Lightning.


Prior Winter '17 Campaign Influence
  • Campaign added in Campaign Influence related list in Opportunity and marked as Primary Campaign Source will be shown in Opportunity related list in Campaign. The campaign will be auto-populated as the Primary Campaign Source field in Opportunity.
  • There is only one Primary Campaign Source for one Opportunity.


Enable Campaign Influence in Winter 17
Setup | Customize | Campaigns | Campaign Influence | Campaign Influence Settings



1. Admin
  • Assign yourself the "CRM User" Permission Set License
  • Create a Permission Set, e.g., name it "Campaign Influence", add the "Campaign Influence" permission to the permission set, and assign it to yourself

2. New standard objects added to the org.
  • CampaignInfluence
  • CampaignInfluenceModel

3. Campaign page layout
  • The existing Opportunities related list will be removed
  • Add a new related list called "Influenced Opportunities"
  • If you select "Salesforce Model" as Campaign Influence Model, existing Opportunities in Campaigns related list will stay; otherwise, it will be removed.

4. Opportunity page layout
  • The existing Campaign Influence related list will be removed.
  • Add new related list called "Campaign Influence" (different logo - old with opportunity logo, new with campaign logo)
  • If you select "Salesforce Model" as Campaign Influence Model, existing Campaigns in Opportunities related list will stay; otherwise it will be removed. While the Primary Campaign Source value in the Opportunity field will always stay.

Campaign Influence Model 
When you enable this new Campaign Influence, by default Salesforce will provide a model called "Salesforce Model"; this model will serve as the primary model, and Locked - campaign influence records for a locked model can only be added or edited via workflows and the API. Your users can’t add records manually in Salesforce.

You can add a new model suit to your business requirements. If you set up more than one influence model, designate one of them as the primary model. The primary model’s records appear in the Campaign Influence related list on opportunities and the Influenced Opportunities related list on Campaigns.


Reference:


Thursday, October 13, 2016

Salesforce: Contact Sharing Setting

When Account sharing rule is Private, options for Contact sharing will be: Private or Controlled by Parent only.

Use case with following sharing setting:
- Account: Private
- Contact: Controlled by Parent

For Account that user suppose do not have access to, but if any Contacts that user owned are linked to the Account. Contact Owner will be able to access the Account (read-only). But, this does NOT apply for indirect contact linked to Account via Related Contact to Multiple Account relationship.

Sample: screenshot below is all accounts visible to user:



and this is all contacts visible to user:



When user received a contact link to the account that user has no access "Google", in this sample "Mann, Saman", user will be able to see that contact. Furthermore, if the Account have multiple Contacts, user will be able to see all Contacts for that Account, in sample below "Li. Linda", even user does not own the contact:



Because now user own a contact Mann, Saman which is linked to Google account, user will be able to read Google account, furthermore user will also able to access Li, Linda although not owned by the user, because user have read access to the Account.




Notes:
1. Contact Owner will NOT able to link his/her Contact to an Account if the user do not have read access. The same also applicable for Related Contact to Multiple Account feature.

2. If your Organization-Wide Default for Contact is set to Controlled by Parent, you will not see Sharing button in Contact page layout.

3. All access to the contact is determined by the user's accessibility to the Account for that Contact.
But, since Contact is a special standard object with owner field (different with normal M-D relationship), contact have Owner. Even Contact sharing setting is set to Controlled by Parent, contact owner will be able to edit contact, and this would not related to the user accessibility to the Account.


Side notes related to Opportunity:
If Account is Private, this will cause Opportunity become Private.
The same with Contact, Opportunity Owner will be able to access (read-only) Account because Opportunity is linked to Account.


Reference:


Page-level ad