Set Variable

<< Click to Display Table of Contents >>

Navigation:  Workflow Designer > Activities >

Set Variable

Previous pageReturn to chapter overviewNext page

Function

 

The Set Variable activity populates a variable with data.

 

SetVariable_Activity

 

Input

 

SetVariable_InputFelder

 

Variable is a selection field where you define the variable into which the result should be loaded.

Value defines the value that should be assigned. This can be of type Default, C#, JavaScript, or Variable. In the example shown in the image “Input Fields”, the first record of an array is taken from an object.

 

 

Further JavaScript examples:

 

const data = getGetAccount();

const tenantName = getInvAppTenant();

 

data.forEach(item => {

 item.InvoiceApprovalTenant = tenantName;

});

A list is loaded, and an additional value is added to each element of this list.

const payType = getPxGetPayTypeParsedContent()[0].ZahlungsartNr;

const currentBooking = getPxBooking();

currentBooking.Zahlungsart.ZahlungsartNr = payType;

currentBooking.Adresse.AdressNr = getPxAddressNo();

return currentBooking;

A JSON object is loaded and two values are modified.

const jsonData = getPxBookingParsedContent();

return jsonData.Fields[0].Message;

The first value of an array in a JSON object is loaded.

const jsonData = getPxBookingResponseHeaders();

const url = jsonData.Location[0];

const match = url.match(/(\d+)$/);

 

const extractedNumber = match ? match[1] : null;

return extractedNumber;

In a JSON object, a specific content is searched for using a regular expression and then output.

 

Output

There is no output.