You can use the outbound web service process to request data from an external application and to process the response in D365 FO, via an external web service. To manage the outbound web service process, set up an outbound web service action.


Application Consultant Application Consultant Start Start Which application  do you use as  outbound web service? Which application  do you use as  outbound web service? Set up outbound web service - Azure Logic Apps

Set up outbound web service - Azure Logic Apps

Instead of an external web service managed by an external application, you can use other applications as outbound web service in the cloud. An alternative application is an Azure Logic App.

This topic explains globally how to set up the web service using Azure Logic App. For more information on Azure Logic Apps, refer to Azure Logic Apps documentation.

Set up web service application for project Set up web service application for project For an outbound web service, a connection must be established with an external web service.To connect to the external web service, for the applicable project, set up the web service application.The web service application defines the base URL for the related web service actions.If required, you can also set up the user authentication to get access to the external web service. Procedure 1. Click Connectivity studio Integration Design. 2. Click Projects. 3. Click Edit. 4. Expand the Web service application section. 5. Click New. 6. In the Environment types field, select an option. 7. In the Base URL field, type a value. 8. In the Authentication field, select 'None'. 9. Sub-task: Use Windows authentication. 10. In the Authentication field, select 'Windows'. 11. In the Domain name field, type a value. 12. In the Password field, or in the Password reference field, type a value. 13. In the User name field, type a value. 14. Sub-task: Use Basic authentication. 15. In the Authentication field, select 'Basic'. 16. In the Password field, or in the Password reference field, type a value. 17. In the User name field, type a value. 18. Sub-task: Use OAuth2 authentication. 19. In the Authentication field, select 'OAuth2'. 20. In the Grant type field, select an option. 21. Fill in the user ID to be used for web service authentication. In the User name field, type a value. Note: Only fill in the user name if the grant type is 'Password'. 22. If the grant type is 'Password', enter the password or password reference for the OAuth2 authentication (Resource owner grant flow). Whether the password or password reference applies is defined by the Display secret field in the Connectivity studio parameters. If the Display secret parameter is set to: - Secret, fill in the Password field with the desired password. The password is specific for the current connector. - Secret reference, fill in the Password reference field with the desired secret reference. The password reference refers to a centrally stored password which makes updating secrets easier. - Both, fill in either the Password field or the Password reference field. In the Password field, or in the Password reference field, type a value. Note: Only fill in the password if the grant type is 'Password'. 23. For both grant types, fill in the client ID. The provider of the web service that is secured with OAuth2, can provide you with the required client ID. If you use a registered application in Microsoft Entra ID, use the client ID of this application. In the Client ID field, type a value. Note: If the external web service is a cloud service of Microsoft, Microsoft Entra ID is the identity provider. Therefore, register an Microsoft Entra ID application. For the registered application, grant permissions to the external web service. 24. If the grant type is 'Client credentials', enter the client secret or client secret reference for the OAuth2 authentication (Client credentials flow). Whether the client secret or client secret reference applies is defined by the Display secret field in the Connectivity studio parameters. If the Display secret parameter is set to: - Secret, fill in the Client secret field with the desired client secret. The client secret is specific for the current connector. - Secret reference, fill in the Client secret reference field with the desired secret reference. The client secret reference refers to a centrally stored client secret which makes updating secrets easier. - Both, fill in either the Client secret field or the Client secret reference field. In the Client secret field or in the Client secret reference field, type a value Note: Use the client secret that belongs to the used client ID. The provider of the web service, that is secured with OAuth2, can provide you with the required client secret. If you use a registered application in Microsoft Entra ID, use the client secret of this application. 25. In the Resource field, type a value. 26. In the Scope field, type a value. 27. In the Token authorization endpoint field, type a value. 28. In the Redirect URI field, type a value. 29. Sub-task: Use basic authentication with any authentication server. 30. In the Authentication field, select 'Basic authentication JWT'. 31. Click Save. 32. In the User name field, type a value. 33. In the Password field, or in the Password reference field, type a value. 34. In the Token authorization endpoint field, type a value. 35. In the Expires within field, enter the number of hours after which the bearer token expires. 36. Close the page. Set up web service action - Outbound Set up web service action - Outbound You can use an outbound web service action to request data from an external application and to process the response in D365 FO, via an external web service. For each outbound web service action, you can define these messages: Message Description Request message The request message provides the web service with data from D365 FO. Response message The response message processes the response from the web service in D365 FO. Error message The error message processes the error from the web service in D365 FO.   Note: Only D365 FO can trigger an outbound web service action. When triggered, the outbound web service action automatically runs the defined messages. Attributes You can use attributes to add extra information to the web service URL or HTTP request. The attribute type indicates how the attribute value is defined. You can use these types: Attribute type Description Value The attribute is a fixed value. Enter the fixed value in the Value or Custom field. Document field The attribute value is derived from a field of the source document of the request message. Fill in the Document field field. Record field The attribute value is derived from a field of a selected record. Usually, this type is used to get records. Only use this type if you start the web service with a menu item from a specific page. Fill in these fields: Record table and Record field. Example: You start the web service from the Sales orders page. You can use the attribute to get all sales orders for the customer of the selected sales order. In this case, you fill in the CustTable and ID. Custom You can enter a static method that defines the range. The static method is applied to the source document of the request message. Secret You can enter a secret reference to be used as attribute. The secret reference refers to a centrally stored secret which makes updating secrets easier. So, the secret value is not visible on the Web service action page. You only see the secret reference. Fill in the Secret reference field.   The attribute styles define how the attribute is applied to the request. You can use these attribute styles: Attribute style Description Header Sends a custom header with an HTTP request. The attribute is added to the header of the HTTP request. Query Most common attribute type. It applies to the whole request. It is added to the URL after the question mark (?) after the resource name. Example: https://myserver.com/resource?attr1=Your Value&attr2=Your Value Template Parameterizes the resource path, adding a placeholder for a variable value. Example: https://myserver.com/resource/{attr3} Matrix Applies to a specific resource path element. The attribute is added to the URL, between the resource or the template attribute and the QUERY attributes. The attribute is separated from the resource or the template attribute with a semicolon (;). Example: https://myserver.com/resource/{attr3};;attr4=Your Value?attr1=Your Value Plain Excludes the attribute from the HTTP request. For example, for testing purposes. Body key pair Usually, for an outbound web service, the body contains the content. In some cases, for example for Dataverse, the body contains more data than only the content. The data is split in a list of, so called, key pairs. In this case, the content is stored in a key pair, instead of in the body. For each of the key pairs to be added to the request body, add an attribute to the outbound web service action. To use key pairs in your body, use these settings: Content type: application/x-www-form-urlencoded Attribute type: Value Attribute style: Body key pair Attribute value: [Body]; only for the attribute that contains the request content. Note: You only can apply this setup if the target document of the request message is of type JSON. Procedure 1. Click Connectivity studio Integration Design. 2. Click the Web service tab. 3. Click New. 4. In the Web service action field, type the unique name of the web service action. 5. In the Project field, enter or select a value. 6. Define the goal of the outbound web service: - Post: Create records in the external application. - Put: Update records in the external application. - Get: Get data from the external application. - Patch: Update only a part of records in the external application. - Delete: Delete records from the external application. - Post or put: Create or update records in the external application. In the HTTP action field, select an option. Note: If the HTTP action is 'Post or put', you must set up an attribute of type Document field or Record field with the Key check box selected. This key attribute is used to determine if, in the external application, the record already exists and must be updated, or if the record does not yet exist and must be created. 7. Sub-task: Set web service properties. 8. Expand the Properties section. 9. In the Acts as field, select 'Outbound'. 10. In the Web service type field, select an option. 11. In the Content type field, type a value. 12. In the Maximum retries field, enter a number. 13. In the Delay operation with field, enter a number. 14. Define the request message for the web service action. The goal of the request message depends on the HTTP action of the web service action. In general, the request message provides the web service with data from D365 FO. In the Request message field, enter or select a value. Note: If the HTTP action is Get, the request message is optional. 15. Define the response message for the web service action. The goal of the response message depends on the HTTP action of the web service action. In general, the response message processes the response from the web service in D365 FO. In the Response message field, enter or select a value. Note: Only if the HTTP action is Get, it is mandatory to define a response message. 16. In the Error message field, enter or select a value. 17. Enter the name of the applicable resource in the external web service. The resource name is added to the URL for this web service action. In the Resource field, type a value. Note: - Click Save to see the result in the field below. - The base URL is defined in the web service application setup of the related project. 18. Sub-task: Set up attributes. 19. Expand the Attributes section. 20. Click New. 21. You can enter the sequence number of the attribute in the list of attributes. This can be important if the Web service type is REST. In the Line number field, enter a number. Note: You can also change the sequence with the Move up and Move down buttons. 22. In the Name field, type a value. 23. Use the attribute type to indicate how the attribute value is defined. You can use these types: - Value: The attribute is a fixed value. - Document field: The attribute value is derived from a field of the source document of the request message. - Record field: The attribute value is derived from a field of a selected record. - Custom: You can enter a static method that defines the range. - Secret: You can enter a secret reference to be used as attribute. In the Type field, select an option. Note: For more information on the attribute types, refer to the topic introduction. 24. If the type is: - Value, enter the attribute value. - Custom, enter a static method to define the range. For example, you can use the SysQueryRangeUtil class to apply advanced date queries. Other examples are: 'curExt()' (gets the current company), 'strFmt("%1..%2", prevMth(today()), today())' (gets the orders from the last month), and 'DateTimeUtil::utcNow()' (filters on the current date/time). In the Value or Custom field, type a value. Note: This field is only available if the type is Value or Custom. 25. Enter the field of the source document of the request message from which attribute value is derived. In the Document field field, enter or select a value. Note: This field is only available if the type is Document field. 26. Enter the table from which you want to select the field from which the attribute value is derived. In the Record table field, enter or select a value. Note: This field is only available if the type is Record field. 27. Enter the field from which the attribute value is derived. In the Record field field, enter or select a value. Note: This field is only available if the type is Record field. 28. Enter a secret reference to be used as attribute. The secret reference refers to a centrally stored secret which makes updating secrets easier. In the Secret reference field, enter or select a value. Note: This field is only available if the type is Secret. 29. You can use attributes to set varying parts of the HTTP request. - Header: Sends a custom header with an HTTP request. The attribute is added to the header of the HTTP request. - Query: Most common attribute type. It applies to the whole request. - Template: Parameterizes the resource path, adding a placeholder for a variable value. - Matrix: Applies to a specific resource path element. The attribute is added to the URL, between the resource or the template attribute and the QUERY attributes. - Plain: Excludes the attribute from the HTTP request. - Body key pair: The attribute is added as a key pair to the request body. In the Style field, select an option. Note: - Usually, the external web service administrator can provide you with the required attributes and attribute styles. - For more information on the attribute styles, refer to the topic introduction. 30. If the HTTP action is 'Post or put', you must set up an attribute of type Document field or Record field with the Key check box selected. This key attribute is used to determine if, in the external application, the record already exists and must be updated, or if the record does not yet exist and must be created. Select the Key check box. Note: This field is only available if the HTTP action is 'Post or put', and if the type is Document field or Record field. 31. If the attribute type is Document field or Record field, you can indicate if the value of the defined document field or record field is linked to an external ID or revision number. So, for the document field or record field value, an external ID must exist in the application of the source connector of the request message. In the External ID field, select an option. Note: If the attribute type is Document field or Record field, and the External ID field is not available, click Save to make it available. 32. In the Custom Url part field, type a value. 33. Sub-task: Set custom handler, class, and action menu item. 34. Expand the Custom section. 35. In the Handler field, enter or select a value. 36. In the Client Http class field, enter or select a value. 37. You can use a custom action menu item to manually start an outbound web service action. To make this work: - Create the custom menu item. The action menu item must be of type class and must be linked to the 'BisWsCmdActionRunWebservice' class. To avoid best practice warnings, in the menu item setup, define the permissions for the roles who can use the action menu item. As the action menu item is not linked to a RunBase class, you cannot run it in batch. - Add the action menu item to the form from where you want to start the web service action. For example, the Sales orders form to post a sales order. - Enter the name of the action menu item for the desired web service action in the Action menu item name field. For example, a web service action to post a sales order. As a result, for a selected record, you can manually run the web service action from the form to which you added the action menu item. In the Action menu item name field, enter or select a value. Note: Example: On the Sales orders form, you can select a record and click the action menu item button. This starts a web service action to post a sales order. The web service action is processed, and the selected sales order is posted. 38. Sub-task: Set history settings. 39. Expand the History section. 40. Select Yes in the Create history report field. 41. In the Secret reference field, enter or select a value. 42. Close the page. Use data synchronization? Use data synchronization? Set up data synchronization for outbound web service action

Set up data synchronization for outbound web service action

On export of data with an outbound web service action, the data synchronization setup defines which records are processed.
Data synchronization only applies to the request message of the outbound web service action.

Note: The request message also can have data synchronization set up. This setup is overruled by the outbound web service data synchronization setup.

You can use these types of data synchronization:

Type

Description

All

This is the standard data synchronization. All records that are found, based on the source document setup, are exported. No data synchronization setup is required for this.

Table events

You can use table events to log data changes. You can define, for each record, which table events are logged. The table events are logged in the Data synchronization log. From here, the logged entries must be processed further to the Outbound message queue. Process the outbound message queue to run the messages to export the records.

Date range

You can use a date range to export only the records that are changed or added since the latest outbound web service action run.

 

@videoref:CS5

End End Others: for example  Azure Logic Apps External  web service No Yes

Activities

Name Responsible Description

Set up outbound web service - Azure Logic Apps

Application Consultant

Instead of an external web service managed by an external application, you can use other applications as outbound web service in the cloud. An alternative application is an Azure Logic App.
This topic explains globally how to set up the web service using Azure Logic App. For more information on Azure Logic Apps, refer to Azure Logic Apps documentation.

Set up web service application for project

Application Consultant

For an outbound web service, a connection must be established with an external web service.
To connect to the external web service, for the applicable project, set up the web service application.
The web service application defines the base URL for the related web service actions.
If required, you can also set up the user authentication to get access to the external web service.

Set up web service action - Outbound

Application Consultant

You can use an outbound web service action to request data from an external application and to process the response in D365 FO, via an external web service.

For each outbound web service action, you can define these messages:
Message Description
Request message The request message provides the web service with data from D365 FO.
Response message The response message processes the response from the web service in D365 FO.
Error message The error message processes the error from the web service in D365 FO.

 

Note: Only D365 FO can trigger an outbound web service action. When triggered, the outbound web service action automatically runs the defined messages.

Attributes

You can use attributes to add extra information to the web service URL or HTTP request.
The attribute type indicates how the attribute value is defined. You can use these types:
Attribute type Description
Value The attribute is a fixed value. Enter the fixed value in the Value or Custom field.
Document field The attribute value is derived from a field of the source document of the request message. Fill in the Document field field.
Record field

The attribute value is derived from a field of a selected record. Usually, this type is used to get records. Only use this type if you start the web service with a menu item from a specific page. Fill in these fields: Record table and Record field.

Example: You start the web service from the Sales orders page. You can use the attribute to get all sales orders for the customer of the selected sales order. In this case, you fill in the CustTable and ID.

Custom You can enter a static method that defines the range. The static method is applied to the source document of the request message.
Secret You can enter a secret reference to be used as attribute. The secret reference refers to a centrally stored secret which makes updating secrets easier. So, the secret value is not visible on the Web service action page. You only see the secret reference. Fill in the Secret reference field.

 

The attribute styles define how the attribute is applied to the request. You can use these attribute styles:

Attribute style Description
Header Sends a custom header with an HTTP request. The attribute is added to the header of the HTTP request.
Query

Most common attribute type. It applies to the whole request. It is added to the URL after the question mark (?) after the resource name.

Example: https://myserver.com/resource?attr1=Your Value&attr2=Your Value

Template

Parameterizes the resource path, adding a placeholder for a variable value.

Example: https://myserver.com/resource/{attr3}

Matrix

Applies to a specific resource path element. The attribute is added to the URL, between the resource or the template attribute and the QUERY attributes. The attribute is separated from the resource or the template attribute with a semicolon (;).

Example: https://myserver.com/resource/{attr3};;attr4=Your Value?attr1=Your Value

Plain Excludes the attribute from the HTTP request. For example, for testing purposes.
Body key pair Usually, for an outbound web service, the body contains the content. In some cases, for example for Dataverse, the body contains more data than only the content. The data is split in a list of, so called, key pairs. In this case, the content is stored in a key pair, instead of in the body. For each of the key pairs to be added to the request body, add an attribute to the outbound web service action.
To use key pairs in your body, use these settings:
  • Content type: application/x-www-form-urlencoded
  • Attribute type: Value
  • Attribute style: Body key pair
  • Attribute value: [Body]; only for the attribute that contains the request content.
Note: You only can apply this setup if the target document of the request message is of type JSON.

Set up data synchronization for outbound web service action

Application Consultant

On export of data with an outbound web service action, the data synchronization setup defines which records are processed.
Data synchronization only applies to the request message of the outbound web service action.

Note: The request message also can have data synchronization set up. This setup is overruled by the outbound web service data synchronization setup.

You can use these types of data synchronization:

Type

Description

All

This is the standard data synchronization. All records that are found, based on the source document setup, are exported. No data synchronization setup is required for this.

Table events

You can use table events to log data changes. You can define, for each record, which table events are logged. The table events are logged in the Data synchronization log. From here, the logged entries must be processed further to the Outbound message queue. Process the outbound message queue to run the messages to export the records.

Date range

You can use a date range to export only the records that are changed or added since the latest outbound web service action run.

 

Outbound web service process

Set up data synchronization for outbound web service action

Set up outbound web service - Azure Logic Apps

Provide feedback