There are quite a few ways content (files) are stored in Salesforce. This article shows you ways to access them through a SOQL query.
EMAIL ATTACHMENT:
Let's consider the scenario where we have attachments against email messages related to a Case. Let's see how to query it in SOQL.
SOQL Query:
Assuming case number 123
ATTACHMENTS against a Case:
Salesforce Files Attached to a Case Feed:
EMAIL ATTACHMENT:
Let's consider the scenario where we have attachments against email messages related to a Case. Let's see how to query it in SOQL.
SOQL Query:
Assuming case number 123
Case cs = [Select Id from Case where CaseNumber=123];
Map<Id,EmailMessage> caseEmails = new Map<Id,EmailMessage>([Select Id from EmailMessage where ParentId=:cs.Id and HasAttachment = true]);
Set<Id> caseRelatedIds = new Set<Id>();
if(caseEmails != null){
caseRelatedIds.addAll(caseEmails.keySet());
}
List<Attachment> AttachedFiles = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE ParentId IN :caseRelatedIds];
ATTACHMENTS against a Case:
Case cs = [Select Id from Case where CaseNumber=123];
List<Attachment> AttachedFiles = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE ParentId IN =:cs.Id];
Salesforce Files Attached to a Case Feed:
Case cs = [Select Id from Case where CaseNumber=123];
List<CaseFeed> caseChatterFiles = [SELECT Id, Type, Body, Title, LinkUrl, ContentData, ContentSize, ContentFileName, ContentType From CaseFeed where Type = 'ContentPost' and parentId = :cs.Id];
Delegated authentication
Your company's authentication service is currently down. Please contact the administrator at your company for more information.
10:44 AM
When your delegated authentication fails, you are presented with the error message as in this article title. Below are a few steps to troubleshoot when you face such a issue.
Do you whitelist Salesforce IP's access to your internal server? If yes, check this page to make sure no new IP's were added to the list.
Check the Delegated Authentication Error section under setup.
If you see an error message as below, make sure the certificates are updated on your internal server. Here is an article with more details and list of certificates approved by Salesforce - Click here
javax.net.ssl.SSLPeerUnverifiedException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Do you whitelist Salesforce IP's access to your internal server? If yes, check this page to make sure no new IP's were added to the list.
Check the Delegated Authentication Error section under setup.
If you see an error message as below, make sure the certificates are updated on your internal server. Here is an article with more details and list of certificates approved by Salesforce - Click here
javax.net.ssl.SSLPeerUnverifiedException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Note: Salesforce has a standard VLOOKUP function but has limited functionality, this approach helps overcome those without code.
Process Builder and Flows are recent automation engines provided by Salesforce, they have been around for a while but haven't been used widely i believe (probably developers tend to stick with Apex Triggers and Workflow rules as they are used to it)
The use case below shows you how you could use these two together to solve a simple scenario which as a developer we tend to solve with Apex Code.
Scenario:
Everytime a Product2 record is updated, i have to query if this product exists in a custom object (Exempted parts) and based on the result update a boolean field on Product2.
Solution:
STEP 1:
Create a Flow (Product2_Validate_Exemption)
STEP 2:
Create a Process and call the flow every time a product2 record is updated.
Process Builder and Flows are recent automation engines provided by Salesforce, they have been around for a while but haven't been used widely i believe (probably developers tend to stick with Apex Triggers and Workflow rules as they are used to it)
The use case below shows you how you could use these two together to solve a simple scenario which as a developer we tend to solve with Apex Code.
Scenario:
Everytime a Product2 record is updated, i have to query if this product exists in a custom object (Exempted parts) and based on the result update a boolean field on Product2.
Solution:
STEP 1:
Create a Flow (Product2_Validate_Exemption)
STEP 2:
Create a Process and call the flow every time a product2 record is updated.
Reference: This example uses the great search component provided by Avinava Maiti. His blog is here
http://blogforce9.blogspot.com/
Problem:
Using a standard lookup field on the user object, Salesforce does not allow you to lookup a user who is of the license type 'Chatter Free'.
Solution:
Although you cannot use a standard UI to update the user lookup field with a chatter free user, you can update the field through the API. This means that we could use a visualforce page to populate the lookup field.
Assumptions:
We will use a custom type ahead advanced search component.
We will use a custom field 'Chatter Free user lookup' on the account object.
STEP 1:
Install the autocomplete search component from here
http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000009KusM
STEP 2:
Create the following apex class
STEP 3: Create the following visualforce page:democustomlookup
STEP 4: Create a new custom button on the account object.
STEP 5:
Add this custom button to the page layout and you are done.
RESULT:
http://blogforce9.blogspot.com/
Problem:
Using a standard lookup field on the user object, Salesforce does not allow you to lookup a user who is of the license type 'Chatter Free'.
Solution:
Although you cannot use a standard UI to update the user lookup field with a chatter free user, you can update the field through the API. This means that we could use a visualforce page to populate the lookup field.
Assumptions:
We will use a custom type ahead advanced search component.
We will use a custom field 'Chatter Free user lookup' on the account object.
STEP 1:
Install the autocomplete search component from here
http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000009KusM
STEP 2:
Create the following apex class
STEP 3: Create the following visualforce page:democustomlookup
STEP 4: Create a new custom button on the account object.
STEP 5:
Add this custom button to the page layout and you are done.
RESULT: