Pages

Monday, February 28, 2022

Salesforce: Rename Related List for Custom Field

When you add a lookup field in an object to another object, the lookup object will become the parent object, this is applied for both Standard and Custom objects.

In this example: I have a custom object called Region with a lookup field to Account.


And if we go to the Account page layout, we can add Region as a related list.


How to change the "Regions" label to something else? Let's say it should be called "Supported Regions".

Let's go back to the Regions object, open that field and change the "Related List Label"


Refresh the account page and now should show "Supported Region"



Bonus requirement: the New button should not be in the related list.

  • Go to Account page layout
  • Click Related Lists on the left panel, scroll down to the related list object
  • Click properties icon, click Buttons, then untick New checkbox




Monday, February 21, 2022

Salesforce: File Privacy on Records

By default, when you upload files from a record Related List, the file will be visible to all users who have access to the record. But, this can be changed by adding a field called File Privacy on Records in the Content Version page layout.


Once the file owner selects that checkbox, the file will not visible to other users, unless manually shared, but users with View All Data permission will be able to see those files.

Step to update the checkbox:
1. Upload the files from Related List, you can upload multiple files in one go

2. Open each file and click the arrow next to View File Details, then select Edit File Details

3. Change File Privacy on Records from Visible to Anyone with Record Access to Private on Records

Notes:
  • The file visibility does not roll up to users in the higher role hierarchy, so when the file owner sets this as Private on Records, the manager will not see the file, unless shared manually.
  • The file visibility does not depend on the related record owner but depends on the file owner.
  • If you query on ContentDocument object (prefix: 069), this is stored in SharingPrivacy field, P for Private on Records, and N for the default visible to anyone

However, if you click the Edit File Details link from the Files dropdown in a related list, you will not see that checkbox, as mentioned in this article. I have created an idea exchange to vote.




Reference:



Salesforce: Opportunity Split Query

This is the continuation of the previous blog Forecast and Opportunity Split, in this blog, we will share more on Opportunity Split records.

SOQL
SELECT Id, OpportunityId, SplitOwnerId, SplitOwner.Name, CurrencyIsoCode, SplitAmount, Opportunity.CloseDate FROM OpportunitySplit WHERE SplitAmount <> 0 AND Opportunity.ForecastCategory = 'Closed' AND SplitTypeId = '1492v0000008opLAAQ' AND Opportunity.CloseDate > 2019-06-30 AND Opportunity.CloseDate < 2019-10-01 ORDER BY Opportunity.CloseDate DESC 


Summary:
  • The number of rows here is based on the number of split records that fit the criteria, so there is no summarized calculation as in ForecastingItem
  • The currency can be different based on the currency defined for the opportunity
  • The Split Amount is not roll-up to the manager.

Wednesday, February 16, 2022

Salesforce: Retrieve all fields from an Object

Config Workbook

This tool is not free, but you can do a trial for a few analyses, and need to install it from AppExchange.The details provided are quite comprehensive, but missing a few important pieces of information.

Click CWB Tool tab >> Reports tab >> Full Object and Fields Details Only.


This will produce an Excel file with the following columns:
  • Field Name
  • API Name
  • Data Type, missing information if the field is a Formula field
  • Picklist Value, for Picklist field only, and not for Multi-Select Picklist  
  • Length, for Text and Long Text Area
  • Visible Lines, for Long Text Area
  • Default Value
  • Mandatory
  • External ID
  • Unique
  • Case Sensitive
  • Description
  • Help Text
  • Relationship, for Lookup: Related To (object name) and Child Relationship Name
  • Number, with Precision and Scale, for the length of Currency, Number, Percent field
  • Track Feed History
  • Track History

It also missing Controlling Field, Modified By, Modified Date/Time information.


ColumnCopy extension for Chrome browser

This needs to be performed in Classic (not Lightning) with Chrome (or Edge or Opera) browser, you just need to add ColumnCopy to your browser. Once the extension is added in your Chrome browser, go to the object's field page, right-click on the field table >> ColumnCopy >> Copy entire table >> paste into Excel.


You will get all information presented in the fields table:

  • Field Label
  • API Name
  • Installed Package
  • Data Type
  • Indexed
  • Controlling Field
  • Modified By (including Modified Date/Time)
  • Track History

* Indexed and Track History will not copy by ColumnCopy because they are checkboxes.

This is good enough if you just need to get basic field information quickly.


Salesforce Schema Lister

This tool uses the Salesforce Metadata API to build a list of objects, fields, and field attributes from within your Salesforce Org, this tool is part of the Toolkit for Salesforce, and please note this is a 3rd party tool, not by Salesforce.


The tool will scan all objects, instead of asking with objects that you would like to work with. This will work well if you are just starting a new org, but when working in a big org. (with hundreds of custom objects), it may take a few minutes or longer.

Once completed, you have the option to export the data into an Excel file, as a single tab or multi-tab (one object per tab).

What do you get in the Excel file?

  • Field Label
  • API Name
  • Type. including length (all fields), picklist values (including multi-select picklist)
  • Help Text
  • Formula, this is the raw formula for the field

SOQL

Query from FieldDefinition object.

Sample: SELECT DurableId, QualifiedApiName, Label, DataType, ValueTypeId, LastModifiedDate, PublisherId, Length, Precision, Scale, EntityDefinitionId, RelationshipName, ReferenceTo, Description FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Account' 

You must have EntityDefinitionId or DurableId added as a filter, EntityDefinitionId refers to an object and DurableId for a field.

A few interesting fields from the query result:
  • DurableId, return ObjectName.QualifiedApiName for standard object and ObjectName.00Nxxx for custom fields
  • ValueTypeId, return id, string, boolean, integer, double, etc.
  • PublisherId, return System for standard objects, or Package Prefix name for installed packages

Full documentation here

Note: Because this is a query based on the user permission, the query result will be based on field (and object for lookup field) visibility for the login user. 
You don't option to retrieve Help Text here.


Custom Report Type

Create a custom report type with primary object = Entity Definitions with or without records from Field Definitions.



You can filter Durable ID (of Entity Definitions) to an object name to pull just fields of that object. Sample report:


Note Same as SOQL, the report runs based on the user permission, so the result will be based on field (and object for lookup field) visibility by the report running user.
You don't option to get Help Text using this method.


Salesforce DevTools

This is another Google Chrome browser extension that is mainly focused on Salesforce admin/dev productivity. You can get it and include more information from this site.

From the Salesforce DevTools panel, select the object >> Export >> Object Fields Definition 



You will get an Excel file with the following columns:
  • Field Label
  • API Name
  • Data Type
  • Length
  • Field Type, this is standard or custom field information
  • Required
  • Picklist Values
  • Formula
  • Extend ID
  • Help Text
Note Same as the previous method, the Excel file result will be based on field (and object for lookup field) visibility by the report running user.


So, which methods work best for you? I would say it depends on what you want to achieve, do you need extra information to retrieve, can you install an app into the org., can you switch back to Classic, how complex is the org., do you have visibility to all fields, etc.



Page-level ad