Query REST Entities
The Query REST Entities activity supports querying list items across different Microsoft Dynamics CRM lists and websites in a specific site collection. This activity supports two modes: FetchXML and OData to query for entities.
General
In the General tab, you can establish a connection to the Microsoft Dynamics CRM server, and specify the type of entity records you want to retrieve.
The following table lists the configurations in the General tab of the Query REST Entities activity:
Field | Module Property? | Description |
---|---|---|
Name | No | Specify the name of the activity in the process definition. |
Dynamics CRM REST Connection | Yes | Specify a shared connection resource.
Click the
|
Mode | No | Specify the retrieve mode. Select OData or FetchXML. |
Dynamics CRM Entity | No | Specify the type of the entity record(s) you want to retrieve.
Click Fetch Entity to open the Entity Selection Dialog that contains all the available entities. Select an entity from the list and click OK. The selected entity is automatically specified in this field. |
Select | No | Specify the attributes of the entity which you want to be returned.
After selecting the entity, click Select Attributes to open the Attributes Selection Dialog dialog that contains all the available attributes associated with the entity. Select the attributes you want and click OK. The selected attributes are displayed in the Output tab. |
FetchXML | No | Specify the FetchXML query.
You can use different FetchXML Query types such as:
After you provide the FetchXML query, the Build Schema button is enabled. Click the Build Schema button to open the Build Schema dialog box that contains a list of base and linked entities retrieved from the FetchXML input. Select the entities from the list and click Refresh to refresh the schema. Click OK to build the output schema. Note: When the mode is
FetchXML, you can pass values for the "value" attribute of the FetchXML query <filter> expression dynamically to return a specific set of records. '?' is the placeholder for the value attribute of the FetchXML query <filter> expression.
For example,
<filter> <condition attribute ='lastname' operator='eq'value='?'/> </filter> You can filter based on the attributes of a base entity or a linked entity. For example,
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' > <entity name='account' > <attribute name="name" /> <attribute name="accountid" /> <filter> <condition attribute='name' operator='eq' value='?' /> </filter> <link-entity name='contact' from='contactid' to='primarycontactid' link-type='inner'> <attribute name='fullname' /> <filter> <condition attribute='lastname' operator='eq' value='?'/> </filter> </link-entity> </entity> </fetch> |
Query
The following table lists the configurations in the Query tab of the Query REST Entities activity:
Field | Module Property? | Description |
---|---|---|
Filter | Yes | Specify Search operator and attribute names to get the entity records. |
Order By | Yes |
Specify the order in which you want the entity records to be returned. |
Entity to Expand | No | Specify the entity or entities to be associated with the base entity.
Click Select Entity to open the Entity Selection Dialog that contains all the available entities. Select an entity or multiple entities from the list and click OK. Click Clear Entity to clear the field. |
Expand Query | No | Displays the query based on the output attributes selected for an expanded entity or entities. This is a read-only field. |
Restriction Option | No | Select the option from the drop-down based on which you want to restrict the output. |
Top Restriction | Yes | Specify the number of entity records to be returned in the Output tab. |
PageSize | Yes | Specify the number of entity records to be displayed in a page. |
Input
The input of this activity varies depending on the selected entity when configuring the General tab.
The following table lists the possible input elements in the Input tab of the Query REST Entities activity:
Input Item | Data Type | Description |
---|---|---|
The following field is displayed in FetchXML mode. | ||
Filter<n> | Complex | Specify values dynamically for the "value" attribute of the FetchXML query <filter> expression to return a specific set of records. '?' is the placeholder for the value attribute of the FetchXML query <filter> expression.
We get a complex element filter <n> which has value <n> elements under it. For every filter condition, based upon the number of values specified, the input schema is built. |
The following fields are displayed in OData mode. | ||
FilterQuery | String | Specify the attribute names and Search operators to get the entity records. |
OrderbyQuery | String | Specify the order in which you want the entity records to be returned. |
NextPageLink | String | Specify the URL which the activity uses to get next bunch of data while querying data. |
Top | String | Specify the number of entity records to be returned. |
Output
If you select the Odata mode in the General tab, the output schema is built based on input provided in the General, Query and Input tabs.
If you select FetchXml mode in the General tab, output schema is built based on the XML provided in the FetchXML field in the General tab.
The following table lists the possible output elements in the Output tab of the Query REST Entities activity:
Fault
The error code and error message of the Query REST Entities activity are displayed in the Fault tab. See Error Codes for a more detailed explanation of errors.
The following table lists error schema elements in the Fault tab of the Query REST Entities activity: