Difference between revisions of "RequestFormevent"

From TempusServa wiki
Jump to navigation Jump to search
(Created page with "This Codeunit is not ready for use! == What it does == == How to invoke == == Configuration == {| class="wikitable" !Datapoint ! !Type !Notes |- |when |Required |String |Possible values: "after-update" or "before-update". Determines whether the call is executed before or after an item is updated. |- |status |Optional |Array |An array of the StatusID's where the call should be executed. If "after-update", then this is if the item is in one of these status's after the u...")
 
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


== What it does ==
== What it does ==
This codeunit is capable of performing an HTTP-request with parameters from the updated item and update the item based on the result.


== How to invoke ==
== How to invoke ==
Add the codeunit <code>dk.tempusserva.codeunit.common.RequestFormevent</code> to the entity and add a configuration named <code>RequestFormevent.Setup</code> with content based on the following configuration.
It is possible to add both a "before-update" and an "after-update" action.


== Configuration ==
== Configuration ==
Line 44: Line 48:
|Optional
|Optional
|String
|String
|The datatype of data returned, supported types: "json" or "XML". Default: "json".
|The datatype of data returned, supported types: "json", "raw" or "XML". Default: "json".
|-
|-
|call.headers
|call.headers
Line 65: Line 69:
|Map
|Map
|Fields that should be updated based on the data returned.
|Fields that should be updated based on the data returned.
If type is "raw", only the first item in this list will be updated, and it will be set to the entire response.
|}
|}


Line 85: Line 90:
             "body": "",
             "body": "",
             "update": {
             "update": {
                 "[INFO]": "[info]"
                 "[LINK]": "info.link",
                "[NAME]": "info.name"
             }
             }
         }
         }

Latest revision as of 12:21, 17 December 2021

This Codeunit is not ready for use!

What it does

This codeunit is capable of performing an HTTP-request with parameters from the updated item and update the item based on the result.

How to invoke

Add the codeunit dk.tempusserva.codeunit.common.RequestFormevent to the entity and add a configuration named RequestFormevent.Setup with content based on the following configuration.

It is possible to add both a "before-update" and an "after-update" action.

Configuration

Datapoint Type Notes
when Required String Possible values: "after-update" or "before-update".

Determines whether the call is executed before or after an item is updated.

status Optional Array An array of the StatusID's where the call should be executed.

If "after-update", then this is if the item is in one of these status's after the update, likewise for "before-update".

If not given, then the call is executed every time.

call Required The actual configuration of the call.
call.url Required String The url that is to be called. This supports input of parameters from the item.
call.method Optional String The HTTP-method of the call, one of: "POST", "GET", "PUT" or "DELETE". Default: "GET".
call.type Optional String The datatype of data returned, supported types: "json", "raw" or "XML". Default: "json".
call.headers Optional Map A map of extra headers that should be set
call.params Optional Map Path parameters that should be set and send.
call.body Optional String A string that will be set and send. Not available for "GET".
call.update Optional Map Fields that should be updated based on the data returned.

If type is "raw", only the first item in this list will be updated, and it will be set to the entire response.

Sample

[
    {
        "when": "before-update",
        "status": [69],
        "call": {
            "url": "https://acme.com/resource/[ID]",
            "method": "GET",
            "type": "json",
            "headers": {
                "Authorization": "Bearer XYZ"
            },
            "params": {
                "param": "[DATA]"
            },
            "body": "",
            "update": {
                "[LINK]": "info.link",
                "[NAME]": "info.name"
            }
        }
    }
]

Developer info

  • Type: CodeunitFormevent
  • Security: Requires session