Pages

Friday, May 27, 2022

Salesforce: Retrieve Custom Field Created Date

If you notice in Salesforce: Retrieve all fields from an Object, all options to retrieve all fields will not include Created Date, but only Last Modified Date, so this blog will share how to get the custom field creation date.

You need to query the CustomField object and select Use Tooling API.

Sample query: SELECT DeveloperName, CreatedDate FROM CustomField WHERE TableEnumOrId = 'Account'

use Salesforce Inspector

use Developer Console

Description:

  • DeveloperName field in the Tooling API does not include the suffix __c, so you need to manually add __c to get the API Name, e.g. DeveloperName = Region --> API Name = Region__c
  • TableEnumOrId field, for the standard object, it would be the object name e.g. Account, for custom objects, it would be the object Id, starting with 01Ixxxxxx, you can easily get the ID from the URL of the object from Object Manager.



Reference:




Tuesday, May 17, 2022

Salesforce: Retrieve List View columns and filters

Five years ago, I blog retrieving List View Sharing to get the list of users, groups, and roles that can access list views. This blog is to continue to get the columns and filters.

Open Workbench and from Rest Explorer, example: /services/data/v53.0/sobjects/Case/listviews/00B0o00000Fq3xQEAR/describe

Make sure to update the object name in red and List View id in orange.

To get the list of columns, click the "Show Raw Response" link. 


Copy the result of the column and use JSON to CSV tool to convert it into CSV or Excel file. Some of the columns here are added by the system and do not appear in the list view, such as Id, Record Type Id, etc.

To get the filters; looks for the query underneath, this will also show the fields, filter, and order in SOQL format:

SELECT CaseNumber, Contact.Name, Subject, toLabel(Status), toLabel(Sub_Status__c), toLabel(Priority), CreatedDate, Owner.NameOrAlias, RecordType.Name, Id, RecordTypeId, CurrencyIsoCode, LastModifiedDate, SystemModstamp, Contact.Id, ContactId, Owner.Id, OwnerId FROM Case WHERE IsClosed = false AND (Contact.Name != null OR Status = 'Escalated') ORDER BY CaseNumber DESC NULLS LAST, Id DESC NULLS LAST

** Use toLabel(fields) to translate SOQL query results into the user’s language.

Here is the original list view:


Sunday, May 15, 2022

Salesforce: Case Team Report

We shared Account Team Report and Opportunity Team Report a few years back, in this blog, we will look into the Case Team Report.

Similar to the Account and Opportunity report, you can filter Case based on the owner too, here are the options:


Let us go through each of them:

My cases: ONLY cases that are assigned to you.

All cases: ALL cases that you have access to, no matter who is the case owner.

User owned cases: ALL cases that you have access to, and are owned by a user, not a queue.

Queue owned cases: ALL cases that you have access to, and are owned by a queue, not a user.

My case team's cases: These are cases where you are added as a Case Team member.


My role-based team's cases: These are cases owned by you and your subordinates in the role hierarchy, but not owned by a queue, although you or your subordinate is a member of the queue.


Reference:



Friday, May 13, 2022

Salesforce: File and Content Report Type / Query All Files

File and Content report type produce a report of Salesforce CRM Content and Files in Salesforce. When you create a new report using the File and Content report type, a lot of fields will be added by default.

When you run the report with standard fields, you may see no result, this is because the data, instead of showing as blank, this report type will just remove the rows altogether, such as Downloaded By, if the files have never been downloaded, the files will not appear as a row in the report. The same behavior for fields such as Link Name, if the link for the file has not been created.

On the other hand, if the file has been uploaded in multiple versions, the same file name will appear in a few rows based on the number of file versions uploaded, if you add the File Version field to the report.


This report will show files that you owned and shared with you, even if you are a system admin or user with View All Data permission, and selects Show Me All Files in the filter.


Query All Files

There is permission called Query All Files, this permission is not enabled by default for the System admin profile, it allows users with View All Data permission can query ContentDocument and ContentVersion and retrieve all files in the org, including files in non-member libraries and files in the unlisted groups, and not just files that are owned or shared to the user. 

However, this permission does not impact to result of the report using the File and Content report type, even if the user has Query All Files permission.


Reference:




Page-level ad