Run a source field report to set the data source context

Abstract

Use the Source field report helper script to set the data source context.

Most SXA renderings are designed for reusability and to pull data from data source items. This means that the content they display is not bound to the page on which they appear but is stored in data source items. The Source field specifies where the user is allowed to look for the data source.

Setting this location correctly makes selecting data sources much easier because, for example, the Content Editor is directed to a specific site subfolder and does not have to search the whole Media Library for an image. You can set the location manually, use a query, or use the Source field report helper script.

To run the Source field report helper script:

1. In the Content Editor, right-click the item for which you want to invoke the Source field report. This item can be:

• An item whose template inherits from the Tenant template of your tenant.

• An item within a Project (/sitecore/templates/Project).

2. Click Scripts, and click Source field report. The script looks for the fields that do not have a Source field specified.

3. In the Powershell Script Results dialog box, review the results. The report shows a list of all the fields that can be improved (fields with an empty Source field).

4. If you think the setting is correct, click the item and click Set recommended Source.

5. To add a different data source location manually, click the item and then click Open.