Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In ConnectIT you can make Tasks. Tasks can be used for:

  • Send e-mails (body + pdf of report in attachment)

  • Run objects (report or codeunit)

  • Start secondary imports based on a field value in an import definition

  • Start imports sequentionally

Overview

Export:

Image Modified

Import:

REST Parameter Tasks

On the General tab, give the Task a name. In a task a definition is selected (Definition No.) for which data will be imported when the task is executed.
When ‘process’ is set to true, the entry that was created during executing the task will always be processed immediately afterwards.

Tasks can be called per definition (pre- and post processing). To check how to set this up, see the Import Definitions Section.
In this case the task will be executed before or after processing a single item* from the import entry.
*If the import data contains an array of records, the pre- and or processing task will be executed before and/ or after each record.

A second way to start a task is on field level. To do this, you will need to use the TASK function from the field functions.

TASK Function
The Task Function can be used to alter the value of a Task Parameter. Task Parameters are used in REST calls to replace the %1, %2, etc. in the URL.
Select the task that has to be altered and provide the parameter name for which the value has to be set/altered. Currently there is a maximum of five replacements possible.

EXECUTETASK Function
Executes the selected task.

Example – Using Tasks for underlying REST calls
The value of a certain field in the import (Initial REST call) has to be used to do a second REST call to get details.
For example, the order_id is 1000, in BC you want to give the Sales Order a no. from the sales order no. series (SORD).
The functions for this field will look something like this: 1. Call the TASK function to set the parameter value in the task.

  • For Par1, select the TASK, for Par2, select the Parameter Name.

  • So, now the parameter value for OrderID will be ‘1000’. 2. Call the NOSERIES function and select SORD for no. series.

  • Now, the field value will be the next no. from the SORD no.series. 3. Call the SETTEMPVAL function to temporary save the field value (so, the retrieved no from the SORD no. series).

  • Enter a code to identify the value later on. For example **DefinitionNo*_ORDNO*. 4. Call the EXECUTETASK function to execute the task with the parameter value as set in the first function called (‘1000’).
    Now the REST call to get details for order_id 1000 is executed. Depending on the settings on the Task, the imported entry will or will not be processed immediately. In this case it should be set to process immediately as we will use a temporary saved value from the initial REST call.
    During processing this entry, the saved temporary value (*DefinitionNo*_ORDNO) will be used to make sure the order no. in this call is the same as how it was in the parent call (so the record from the parent call will be updated with details from the secondary call).