D365 FO supports custom services. With a custom service, you can call application logic in D365 FO from outside D365 FO.
For Connectivity studio, a two custom service are available for messages: 'BisMessageStartFromHttp' and 'runMessage' (both in service group 'BisMessageHttpAction').

Custom service: 'BisMessageStartFromHttp'

The 'BisMessageStartFromHttp' custom service has these service operations:

Operation Description
executeMessage Runs a message to import data into D365 FO.
executeMessageGet Runs a message to export data from D365 FO.
 
For these service operations, the arguments are:
Argument Description
ProjectId The identification of the project in Connectivity Studio.
Message Id The identification of the message in Connectivity studio.
Content The body content of the data to be imported.
Note: This argument only applies to the ‘executeMessage’ operation.

 

To call the custom service from outside D365 FO, use a URL like:

https://Instancename.cloudax.dynamics.com/api/services/BisMessageStartFromHttp/BisMessageHttpAction/executeMessage

('Instancename' = Your D365 FO instance identification)

Make sure to call the custom service operation with the arguments. So, the call must include the value for each of the arguments.

Custom service: 'runMessage'

The 'runMessage' custom service has these service operations:

Operation Description Contract
ExportFromD365FO Runs a message for specific data. For example, for a specific record or field value. BisServiceMessageArgumentsD365Fo
ImportFromFile Runs a message to import a specific file. BisServiceMessageArgumentsFile
ImportFromStaging Runs a message to import a specific staging journal into D365 FO. BisServiceMessageArgumentsStaging
ImportFromODBC Runs a message to import specific ODBC data. BisServiceMessageArgumentsODBC

 

For these service operations, the arguments are defined in a contract, as shown in the previous table. The arguments are:

Argument Description
ProjectId The identification of the project in Connectivity Studio.
Message Id The identification of the message in Connectivity studio.
Company The applicable company ID in the D365 FO environment.
RunAsyncronize

You can run a message asynchronous. As a result, the message runs directly in a separate background process. So, you can continue working on the client when the message runs.
If the value of this argument is:

  • ‘true’, immediately a standard response is sent back to the caller and the message is run after that. The result of the message run is not sent to the caller. The response is a JSON object:
    {"Status":true, "responseMessage":"Message run is processing"}
  • ‘false’, first the message is run. The result of the message run is sent back to the caller. The response is a JSON object which content depends on the result of the message run:
    • Success: {"Status":true, "responseMessage":"Operation finished"}
    • Error: {"Status":false, "responseMessage":"There was an internal error"}
Arguments

On a source document, ranges can be used to restrict the data to be processed. A range of type ‘Parameter’ can be used as additional argument to call a custom service operation. To do so, in the JSON to call the custom service define the range as argument with the applicable values.

Note:

  • This argument only applies to operation ‘ExportFromD365FO’.
  • If several ranges of type ‘Parameter’ are defined for a document, you can use all these ranges as arguments.
SourceFileName The name of the source file, including the path.
Note:
  • This argument only applies to operation ‘ImportFromFile’.
  • Use either the ‘ SourceFileName ’ or the ‘SourceContent’ argument.
SourceContent The content of the file if the file name is not used.
Note:
  • This argument only applies to operation ‘ImportFromFile’.
  • Use either the ‘ SourceFileName ’ or the ‘SourceContent’ argument.
StagingJournalId The ID of the staging journal to be imported into D365 FO.
Note: This argument only applies to operation ‘ImportFromStaging’.

 

To call the custom service from outside D365 FO, use a URL like:

https://Instancename.cloudax.dynamics.com/api/services/BisMessageStartFromHttp/runMessage/ExportFromD365FO

('Instancename' = Your D365 FO instance identification)

Make sure to call the custom service operation with the arguments. So, the call must include the value for each of the arguments.

Examples of JSON to call custom service: 'runMessage'

The JSON to call the 'ExportFromD365FO' custom service operation can be:

{
"ProjectId": "your project ID",
"MessageId": "your message ID",
"Company": "USMF",
"RunAsyncronize": false,
"Arguments": [
{
"FieldName": "Custaccount",
"FieldValue": "us-027"
]
}

 

The JSON to call the 'ImportFromFile' custom service operation can be:

{

"ProjectId": "your project ID",

"MessageId": "your message ID",

"Company": "USMF",

"RunAsyncronize": false,

"SourceFileName": "path+file name",

"SourceContent": "file content if SourceFileName is not used"

}

 

The JSON to call the 'ImportFromStaging' custom service operation can be:

{

"ProjectId": "your project ID",

"MessageId": "your message ID",

"Company": "USMF",

"RunAsyncronize": false,"

"StagingJournalId": "your staging journal ID"

}

 

For more information on custom services, refer to:

Related to Notes

Run message

 

See also

Provide feedback