Calling a resource using a composite identification key
In some cases, you may need to define for a resource an identification key that is made up of two fields. Once the identification key is configured, you need to configure a filter definition in order to be able to call the resource with this identification key, either from Campaign Standard interface or APIs.
In this use case, the Profile resource has been extended with custom "CRM ID" and "category" fields. We will create an identification key for the Profile resource, that will be made up of these two fields. We will then configure a filter definition, so that we can access the Profile resource using the identification key.
The main steps for this use case are:
- Configure the identification key for the Profile resource, based on the two fields.
- Configure the filter definition, to be able to call the Profile resource using its identification key.
- Call the Profile resource from the interface or from the APis.
Step 1: Configure the identification key
Global concepts when configuring identification keys are detailed in this section .
- Before configuring the identification key, make sure that the resource has been extended with the desired fields and that it has been published. For more on this, refer to this section .
- Go to the Administration / Developement / Custom resources menu, then open the Profile resource.
- In the Identification keys section, click the Create element button.
- Add the two custom "CRM ID" and "Category" fields, then click Confirm .If you want to display the two custom fields in the profile's interface, configure the Screen definition tab. For more on this, refer to this section .
- You can now configure the filter definition to be able to call the resource using its identification key.
Step 2: Configure the filter definition
Global concepts when configuring filter definitions are detailed in this section .
- In the Filter definition tab, click Add an element , then enter the filter definition's label and ID.
- Edit the filter definition's properties to configure its rules.
- Drag and drop into the workspace the table that contains the fields used in the identification key.
- Select the first field used in the identification key ("CRM ID"), then activate the Switch to parameters option.
- In the Filter conditions section, keep the Equal operator, then define the parameter's name and click the plus sign to create it.Once you have clicked the + button, the parameter's name is automatically generated. Note this information, as you will need it to use the filter from the APIs.
- Repeat the steps above with all the fields that compose the identification key ("category"), then save your changes.
- The filter definition is now configured. You can publish the resource so that the filter is available.
Step 3: Call the resource based on its identification key
Once the identification key and its filter definition are configured, you can use them to call the resource, either from Campaign standard interface or REST APIs.
To use the filter definition from the interface, use a Query activity in a workflow (see this section ). The filter is then available in the left pane.
To use the filter definition from Campaign Standard REST APIs, use the syntax below:
To call a custom filter, use the "by" prefix followed by the filter name defined when configuring the filter definition in step 2 .
In our case, the syntax to retrieve a profile from the "spring" category with the "123456" CRM ID would be:
For more details, refer to Campaign Standard REST APIs documentation .