Use action rules to set field values in D365 F&SCM.

To set a field value, you can use several action types. This topic explains how to set up an action rule of type Web service.
Use a web service action rule to get a field value from another internal or external source, using a web service, and set this value in the target field of the action rule.
Before you can set up a web service action rule, set up the web service to be used.
You can set up a web service action rule in several ways. For a parameter of type:
  • Request, you can use the default parameter values as defined for the used web service. No specific parameter setup is required.
  • Request, you can override a default parameter value for a request parameter. To do so, you can use one of these types: Field, Code, or Fixed value. Each type requires specific settings. Explained in subtasks 13-14.
  • Response, you can use the values, as returned by the web service, to set several values in D365 F&SCM. Explained in subtask 15.
  • Response, you can process a response value, as returned by the web service, before you use it to set a value in D365 F&SCM. Explained in subtask 16.


Standard procedure

1. Click Data quality management.
2. On the Data quality policies tab, in the list, click the link of the desired data quality policy.
3. Click the Action rules tab.
 

Note: If you want to edit another data quality policy version than the currently shown version, first select the desired version. To do so, on the Action Pane, on the Version tab, click Versions. On the dialog, select the desired version and click OK.

4. Click Add.
5. Define the table of the field which value must be set.
  In the Table field, enter or select a value.
6. Define when the action rule is applied:
- New record: The action rule is applied when a record is created. So, before you can edit the record, the target field value is already set for the new record.
- Source field modified: The action rule is applied when the value of the source field is entered or changed.
- Save record: The action rule is applied when a record is saved. The action rule is applied first and then the record is saved.
  In the Event field, select an option.
7. In the Action type field, select 'Web service'.
8. If the event is Source field modified, define the source field. The action rule is applied when the value of the source field is entered or changed.
  In the Source field field, enter or select a value.
9. Define the field which value must be set.
  In the Target field field, enter or select a value.
10. On the Properties tab, in the Web service field, enter or select the desired web service.
11. Define the response parameter which value is used:
- To set the value of the target field, if the Override setup check box is cleared.
- As input for the custom method, if the Override setup check box is selected.
  On the Properties tab, in the Action response parameter field, enter or select a value.
 

Note: This field is not applicable if a Custom response handler is defined for the web service.

12. Sub-task: Set up a request parameter override of type Field.
  12.1 For a web service, parameters can be set up. If so, these parameters are shown on the Properties tab. For Request parameters, a default value can be defined. You can override this default value with the value of a field. If no default value is defined, do the same steps to define the request parameter value.
  On the Properties tab, for the desired Request parameter, select the Override setup check box.
 

Note: If a Custom request handler is defined for the web service, no Request parameters are available.

  12.2 In the Parameter type field, select 'Field'.
  12.3 In the Field name field, enter or select a value.
 

Note: You can only select a field from the table that is defined for the validation rule.

13. Sub-task: Set up a request parameter override of type Custom.
  13.1 For a web service, parameters can be set up. If so, these parameters are shown on the Properties tab. For Request parameters, a default value can be defined. You can override this default value with a value that is defined by a custom method. If no default value is defined, do the same steps to define the request parameter value.
  On the Properties tab, for the desired Request parameter, select the Override setup check box.
 

Note: If a Custom request handler is defined for the web service, no Request parameters are available.

  13.2 In the Parameter type field, select 'Code'.
  13.3 Define the custom class that is used to define the parameter value.
  In the Class name field, enter or select a value.
 

Note: You can only select classes that extend the DQSWebServiceParametersBase base class. This custom class must have a return method that returns a value.

  13.4 Define the custom class return method that is used to define the parameter value.
  In the Method name field, enter or select a value.
14. Sub-task: Set up a request parameter override of type Fixed value.
  14.1 For a web service, parameters can be set up. If so, these parameters are shown on the Properties tab. For Request parameters, a default value can be defined. You can override this default value with a fixed value. If no default value is defined, do the same steps to define the request parameter value.
  On the Properties tab, for the desired Request parameter, select the Override setup check box.
 

Note: If a Custom request handler is defined for the web service, no Request parameters are available.

  14.2 In the Parameter type field, select 'Fixed value'.
  14.3 In the Parameter value field, type a value.
15. Sub-task: Set up web service response actions.
  15.1 For a parameter of type Response, use the values, as returned by the web service, to set several values in D365 F&SCM.
You can map each parameter of the web service response to the applicable target field or several target fields in D365 F&SCM.
  On the Properties tab, in the Web service response actions section, click Add.
 

Note:
- A web service response action is only applied if, for the parameter, the Override setup check box is cleared.
- For response parameters, the Target field of the action rule is not used.

  15.2 Define the web service response parameter to be mapped to a target field in D365 F&SCM.
  In the Parameter name field, enter or select a value.
  15.3 Define the target field in D365 F&SCM to be mapped to the web service response parameter.
  In the Target field field, enter or select a value.
16. Sub-task: Set up response parameter override.
  16.1 For a web service, parameters can be set up. If so, these parameters are shown on the Properties tab.
You can process a Response value, as received from the web service, before you use it to set a value in the target field of the action rule. You can only do so with a custom class and method.
When the action rule is applied, the process is:
1. Send request to web service.
2. Web service gives a response.
3. Process response with custom method.
4. Get response value from custom method.
5. Set response value in the target field.
If the Override setup check box is cleared, steps 3 and 4 are skipped.
  On the Properties tab, for the desired Response parameter, select the Override setup check box.
 

Note:
- Select this check box only for the response parameter as defined in the Action response parameter field.
- If a Custom response handler is defined for the web service, no Response parameters are available.

  16.2 Define the custom class that is used to process the web service response and that returns the value to be set in the target field of the action rule.
  In the Class name field, enter or select a value.
 

Note: You can only select classes that extend the DQSWebServiceParametersBase base class. This custom class must have a return method that returns a value.

  16.3 Define the custom class return method that is used to process the web service response and that returns the value to be set in the target field of the action rule.
  In the Method name field, enter or select a value.
17. Close the page.

Provide feedback