Custom services to run messages

Prev Next

D365 F&SCM supports custom services. With a custom service, you can call application logic in D365 F&SCM from outside D365 F&SCM.
For Connectivity Studio, two custom services 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 F&SCM.

executeMessageGet

Runs a message to export data from D365 F&SCM.

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 applies only to the 'executeMessage' operation.

To call the custom service from outside D365 F&SCM, use a URL like:

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

('Instancename' = Your D365 F&SCM instance identification)

Make sure to call the custom service operation with the arguments: the call must include a value for each argument.

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 F&SCM.

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 F&SCM environment.

RunAsyncronize

You can run a message asynchronously. As a result, the message runs directly in a separate background process. Therefore, you can continue working in the client while the message runs.
If the value of this argument is:

  • 'true', a standard response is immediately 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', the message is run first. The result of the message run is sent back to the caller. The response is a JSON object whose 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 an additional argument to call a custom service operation. To do so, in the JSON that calls the custom service, define the range as an argument with the applicable values.

Note

  • This argument applies only to the 'ExportFromD365FO' operation.

  • 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 applies only to the 'ImportFromFile' operation.

  • Use either the 'SourceFileName' or the 'SourceContent' argument.

SourceContent

The content of the file if the file name is not used.

Note

  • This argument applies only to the 'ImportFromFile' operation.

  • Use either the 'SourceFileName' or the 'SourceContent' argument.

StagingJournalId

The ID of the staging journal to be imported into D365 F&SCM.

Note

This argument applies only to the 'ImportFromStaging' operation.

To call the custom service from outside D365 F&SCM, use a URL like:

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

('Instancename' = Your D365 F&SCM instance identification)

Make sure to call the custom service operation with the arguments: the call must include a value for each argument.

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: