4.5. Add Ability to Add Endpoints to Tenant¶
Endpoints are configured on a tenant. Each tenant maintains its own endpoints. Endpoints are not shared between tenants.
Under the tenant, endpoints are organized by provider. Each provider has its own folder. In this folder are all of the endpoints that are based on endpoints included with the provider.
The following screenshot shows a tenant from a Sitecore server with two providers installed: one for Dynamics CRM and one for Sitecore. Notice that the endpoints for each provider are organized under a folder whose name matches the name of the provider. These are called endpoint items folders.
4.5.1. Add template for endpoint items folder¶
A new template is needed to represent the folder used to store endpoints for the file system provider.
In Sitecore, open Template Manager.
Navigate to Templates > Data Exchange > Providers > File System.
Add a template folder named Folders.
Add the following template:
NameFile System Endpoints Root Base templateTemplates > Data Exchange > Framework > Folders >Folders for Endpoints > Base Endpoints for Provider Root LocationTemplates > Data Exchange > Providers > File System > Folders
Note the id for this template, because you will need it later.
Set the icon for this template to
4.5.2. Add insert option for adding endpoint items to folder¶
Adding an insert option to the folder where endpoint items are stored makes it easier for people to add new endpoint items.
- Add the Standard Values item.
- Navigate to the Standard Values item.
- In the Insert Options, assign the template Templates > Data Exchange > Providers > File System > Endpoints > Text File Endpoint.
4.5.3. Add command template for endpoint items folder¶
In the following screenshot, you can see that the endpoints for each provider are organized in folders. The name of each folder corresponds with the name of the provider.
For example, the endpoints for the Dynamics CRM provider are organized under a folder named Dynamics CRM.
Normally when Sitecore items are created, the user creating the item specifies the name of the item. In this case, however, you do not want to count on the user getting this right. Instead, you want to ensure the item name matches the name of the provider: File System.
This is accomplished using a Sitecore command template.
The idea of providers is that a system may already have Data Exchange Framework set up with tenants already configured. The person installing your provider will want to be able to incorporate your provider into their existing tenant.
However, you do not want to force anyone to use your provider. Let the person who wants to use your provider determine when and where to use the provider. This means you should not automatically make any changes to the existing tenants.
For example, when your provider is installed, you should not automatically create a new File System folder in the existing tenants. Instead, make it as easy as possible for the person who is responsible for configuring the tenants to discover and use your provider. This is what most of this section is describing how to do.
In Template Manager, navigate to Templates > Branches > Data Exchange > Providers.
Add a branch folder named File System.
Navigate to Templates > Branches > Data Exchange > Providers > File System.
Add a branch folder named Commands.
Navigate to Templates > Branches > Data Exchange > Providers > File System > Commands.
Add the following item:
Template Create Item Without Prompting for Name Branch Name File System Endpoints Root
The template Create Item Without Prompting for Name Branch is included with Data Exchange Framework. It, itself, is a command template.
Navigate to Templates > Branches > Data Exchange > Providers > File System > Commands > File System Endpoints Root > New Item Settings.
The command template uses this item to determine what kind of item to create, and the name of the item.
Set the following field values:
Field Value Name for new itemFile System Template for new itemTemplates > Data Exchange > Providers > File System >Folders > File System Endpoints Root
4.5.4. Add insert option for command template¶
You have created a command template that can create an endpoint items folder where the item name is always File System. But where is this command template ever used?
The endpoint items folder must be added to a folder that organizes the endpoint items folders for all of the providers that are available to the tenant.
In the following screenshot, that folder is Data Exchange > mycrm > Endpoints > Providers. Notice that under this folder are folders for Dynamics CRM and Sitecore. This indicates that there are two providers available for the tenant mycrm.
Adding this insert option is a little more complex. For each tenant there should only be one endpoint items folder for the file system provider. All of the endpoint items go in this one folder.
This means the insert option for the endpoints folder will only appear under a specific condition: no endpoints folder item has already been added. Insert option rules support the ability to define this condition.
Open Content Editor.
Navigate to sitecore > system > Settings > Rules > Insert Options > Rules.
Add the following item:
Template Insert Option Rule Name Data Exchange - File System Provider
Set the following field values:
Field Value Name Add insert options for the File System provider for the Data Exchange Framework
On the field Rule, click Edit rule.
Add the action add specific insert option.
This action requires you specify a template. Select Branches > Data Exchange > Providers > File System > Commands > File System Endpoints Root.
Add the condition where the item template is specific template.
This condition requires you specify a template. Select Data Exchange > Framework > Folders > Folders for Endpoints > Endpoints Providers Root.
Add another condition. Add the condition where the result of the expression query exists.
This condition requires you specify an expression. Enter
./*[@@templateid='TEMPLATE-ID'], being careful to replace
TEMPLATE-IDwith the id from the template you created named Text File Endpoint.
The purpose of this condition is to reduce the chances that more than one folder for file system endpoints is created.
However, insert options are not fool-proof. New items of any type can still be created using the Insert from template option available in Content Editor.
Negate the condition by clicking where.
Negating the condition changes where to except where.
Name the rule Endpoints Providers Root.
Click OK to save the rule.
Save the Sitecore item.
4.5.5. Test the configuration¶
The following steps explain how to confirm your configuration is working properly.
- In Content Editor, navigate to sitecore > system > Data Exchange.
- Select a tenant.
- Under the tenant, navigate to Endpoints > Providers.
In the insert options, the option to insert File System Endpoints Root is available.
- Use the insert option to create a new item.
A new item named File System is created. The insert option for the endpoint item is available.
If you navigate back to the Providers item, the insert option for File System Endpoints Root is no longer available.
- Delete the item File System.
Once again, in the insert options, the option to insert File System Endpoints Root is available.