Extract Salesforce Layout

This API extracts all fields and the master Page Layout details of a target Salesforce object into an Excel sheet.

This API useful for when you want to extract or check over an entire Salesforce page layout. It is typically used in conjunction with the Assert Salesforce Layout API, which compares an extracted page layout from one Salesforce org to a current page layout. This is useful for comparing page layouts between sandboxes (for example) or checking that no changes have occurred in an existing org.

The API can also be used to test field permissions of the logged-in user of a given Salesforce connection.

To use this API, locate the Extract Salesforce Layout API in the API palette and click and drag it into your Test Case.

Update the parameters as follows:

  • Connection Name: The Salesforce Connection relating to the Salesforce org from which want to use to extract the layout information, and the user details you want to use to do it
  • Object Name: The Salesforce object whose fields and page layout needs to be extracted. Refer to the Org Browser for the exact name of the object
  • Result File: The file format in which to save the information (default is Excel Workbook)
  • Workbook: Choose the destination Excel Workbook on your local machine.  By default, an Excel named ‘Workbook’ will be created in your Test Project Folder
  • Worksheet: Leave this info blank. A new sheet by the name of the Object will be added with the field information.  Additionally, a sheet named ‘Master’ will be added containing the page layout information for that object
  • Include Field Permissions: If checked, adds a list of access permissions to each and every field on that object for all profiles in that SF org

Then Save the Test Case.

Example

The screenshot above shows the use of an Extract Salesforce Layout API to extract the Page Layout and field details of the Contact object from a connected Salesforce Org identified as ‘SFConnection’.

Page Layout Details:

Field Details:    

Asserting a Page Layout

Once you have extracted a page layout using the Extract Salesforce Layout API, you may want to check some of the information contained in it using the Assert Salesforce Layout API. This will compare a local Excel Workbook, created using the Salesforce Extract Layout API, with a ‘live’ page layout in a Salesforce org. Like the Extract Layout API, the Assert Layout API will use a Connection to extract layout and field information based on the Connection user’s permissions.

Note that the format of the spreadsheets must be an exact match for the API to work effectively. This is why it is sensible to generate the local Excel Workbook using an Extract Salesforce Layout API test step.

To use this API, locate the Assert Salesforce Layout API in the API palette and click and drag it into your Test Case.

Complete the parameters as follows:

  • Connection Name: The Salesforce Connection relating to the Salesforce org from which want to use to extract the ‘live’ page layout information, and the user details you want to use to do it
  • Object Name: The Salesforce object whose fields and page layout needs to be extracted. Refer to the Org Browser for the exact name of the object
  • Expected Layout File: The file format used by your local Layout file (default is Excel Workbook)
  • Workbook: The local destination of the Excel Workbook created by an earlier Extract Salesforce Layout API step
  • Include Field Permissions: Tick this if your local Workbook file was extracted using ‘Include Field Permissions’ ticked on the Extract Salesforce Layout API test step

Then save the Test Case.

Example

Results

The Test Step will pass if the contents of the local Workbook are a match with the ‘live’ page layout information relating to the Connection and Object selected. If there are discrepancies these will show up in the Test Runner and the Test Run Report. Note that all discrepancies will be included along with expected and actual values.

In Test Runner:

In the Test Run Report: