> For the complete documentation index, see [llms.txt](https://docs.work-relay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.work-relay.com/automations/functions-and-formulas/functions-library/system-functions.md).

# System functions

<details>

<summary>BUILDRECORDTASKLINK</summary>

Builds the task link or HTML `<a>...</a>` tag that leads to the record page layout. The task will be loaded automatically after the record page layout is loaded.

**Usage**:

{% code overflow="wrap" %}

```apex
BUILDRECORDTASKLINK(cursor_id, record_id, as_html_tag_optional, text_optional)
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`cursor_id`</mark>* *<mark style="color:cyan;">with the id of flow instance cursor</mark>*
* *<mark style="color:cyan;">`record_id`</mark>* *<mark style="color:cyan;">with the id of a task record</mark>*
* *<mark style="color:cyan;">`as_html_tag_optional`</mark>* *<mark style="color:cyan;">with the boolean (</mark><mark style="color:cyan;">**true**</mark>* *<mark style="color:cyan;">or</mark>* *<mark style="color:cyan;">**false**</mark><mark style="color:cyan;">) value</mark>*
* *<mark style="color:cyan;">`text_optional`</mark>* *<mark style="color:cyan;">parameter with the link text. This is not mandatory</mark>*

{% hint style="info" %}
If the parameter `as_html_tag_optional` equals **true**, the function will build the HTML link tag.
{% endhint %}

**Example 1**:

{% code overflow="wrap" %}

```apex
BUILDRECORDTASKLINK({$Cursor.Id}, {$Cursor.FlowInstance.ObjectId}) 
```

{% endcode %}

Returns an URL text like this:

{% code overflow="wrap" %}

```html
http://yoursite.domain/lighning/r/object/object_id/view#someParametersHere
```

{% endcode %}

**Example 2**:

{% code overflow="wrap" %}

```apex
BUILDRECORDTASKLINK({$Cursor.Id}, {$Cursor.FlowInstance.ObjectId}, true, '[Link]') 
```

{% endcode %}

Returns a HTML code like this:

{% code overflow="wrap" %}

```html
<a href="http://yoursite.domain/lighning/r/object/object_id/view#someParametersHere">[Link]</a>
```

{% endcode %}

{% hint style="info" %}
Note: to make this link have sense, record page layout should have **WR Workflow Line** component (where proper step will be shown).
{% endhint %}

</details>

<details>

<summary>BUILDDASHBOARDTASKLINK</summary>

Builds the task link or HTML `<a>...</a>` tag that leads to the Work-Relay tasks dashboard. The task will be opened automatically after the dashboard is loaded.

**Usage**:

{% code overflow="wrap" %}

```apex
BUILDDASHBOARDTASKLINK(cursor_id, as_html_tag_optional, text_optional) 
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`cursor_id`</mark>* *<mark style="color:cyan;">with the id of flow instance cursor</mark>*
* *<mark style="color:cyan;">`as_html_tag_optional`</mark>* *<mark style="color:cyan;">with the boolean (</mark><mark style="color:cyan;">**true**</mark>* *<mark style="color:cyan;">or</mark>* *<mark style="color:cyan;">**false**</mark><mark style="color:cyan;">) value</mark>*
* *<mark style="color:cyan;">`text_optionalparameter`</mark>* *<mark style="color:cyan;">with the link text. This is not mandatory</mark>*

{% hint style="info" %}
If the parameter `as_html_tag_optional` equals **true**, the function will build the HTML tag.
{% endhint %}

**Example 1**:

{% code overflow="wrap" %}

```apex
BUILDDASHBOARDTASKLINK({$Cursor.Id}) 
```

{% endcode %}

Returns a simple URL as text.

**Example 2**:

{% code overflow="wrap" %}

```apex
BUILDDASHBOARDTASKLINK({$Cursor.Id}, true, '[Link]') 
```

{% endcode %}

Returns a HTML tag like this:

{% code overflow="wrap" %}

```html
<a href="http://your_dashboard_URL">[Link]</a>
```

{% endcode %}

</details>

<details>

<summary>BUILDFORMLINK</summary>

Builds the link or HTML `<a>...</a>` tag that leads to the specified form.

**Usage:**

{% code overflow="wrap" %}

```apex
BUILDFORMLINK(form_id, record_id, mode, context_fields, parameters, entire_height, as_html_tag_optional, text_optional)
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`form_id`</mark>* *<mark style="color:cyan;">with the ID of the target form</mark>*
* *<mark style="color:cyan;">`record_id`</mark>* *<mark style="color:cyan;">with target form source record</mark>*
* *<mark style="color:cyan;">`mode`</mark>* *<mark style="color:cyan;">with '</mark><mark style="color:cyan;">**view**</mark><mark style="color:cyan;">' or '</mark><mark style="color:cyan;">**edit**</mark><mark style="color:cyan;">'</mark>*
* *<mark style="color:cyan;">`context_fields`</mark>* *<mark style="color:cyan;">with JSON object (use context fields format, see below)</mark>*
* *<mark style="color:cyan;">`parameters`</mark>* *<mark style="color:cyan;">with JSON object</mark>* *<mark style="color:cyan;">**{"key":"value"}**</mark>*
* *<mark style="color:cyan;">`entire_height`</mark>* *<mark style="color:cyan;">with the boolean (</mark><mark style="color:cyan;">**true**</mark>* *<mark style="color:cyan;">or</mark>* *<mark style="color:cyan;">**false**</mark><mark style="color:cyan;">)</mark>*
* *<mark style="color:cyan;">`as_html_tag_optional`</mark>* *<mark style="color:cyan;">with the boolean (</mark><mark style="color:cyan;">**true**</mark>* *<mark style="color:cyan;">or</mark>* *<mark style="color:cyan;">**false**</mark><mark style="color:cyan;">)</mark>*
* *<mark style="color:cyan;">`text_optional`</mark>* *<mark style="color:cyan;">with the link text. This is not mandatory</mark>*

{% hint style="info" %}
If the parameter `as_html_tag_optional` equals **true**, the function will build the HTML tag.
{% endhint %}

**Example**:

{% code overflow="wrap" %}

```apex
BUILDFORMLINK('formId', {$Account.Id}, 'edit', '{"InputText":"Name"}', null, true, true, 'FORM') 
```

{% endcode %}

Returns a HTML link tag like shown below. Link will redirect user to the form in edit mode with context field Name passed as `{$FormParameters.InputText}`:

{% code overflow="wrap" %}

```html
<a href="http://your_form_URL">FORM</a>
```

{% endcode %}

{% hint style="info" %}
Context Field format example:

<mark style="color:orange;">Let the form source object is Contact (FirstName is 'Jim', LastName is 'Lee').</mark>

The `context_fields` parameter in this case may look like: `{"fnameParam":"FirstName", "lnameParam":"LastName"}`.

On the target form merge field `{$FormParameters.fnameParam}` will be replaced with '**Jim**', and `{$FormParameters.lnameParam}` will be replaced with '**Lee**'.

Note:

`context_fields` parameter will only work if `record_Id` is passed.
{% endhint %}

</details>

<details>

<summary>BUILDEMAILASSISTANTLINK</summary>

Builds a link to use email assistant feature, that allows users to proceed process steps via replying to emails with step notifications.

**Usage**:

{% code overflow="wrap" %}

```apex
BUILDEMAILASSISTANTLINK(text, instance_id, cursor_id, step_id, assignee, operation, comment, replyToSender) 
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`text`</mark>* *<mark style="color:cyan;">parameter with the link text</mark>*
* *<mark style="color:cyan;">`instance_id`</mark>* *<mark style="color:cyan;">with the ID of a flow instance</mark>*
* *<mark style="color:cyan;">`cursor_id`</mark>* *<mark style="color:cyan;">with the ID of flow instance cursor</mark>*
* *<mark style="color:cyan;">`step_id`</mark>* *<mark style="color:cyan;">with the ID of the process step</mark>*
* *<mark style="color:cyan;">`assignee`</mark>* *<mark style="color:cyan;">with the cursor assignee</mark>*
* *<mark style="color:cyan;">`operation`</mark>* *<mark style="color:cyan;">with operation that needs to be performed (Proceed, Approve, Reject)</mark>*
* *<mark style="color:cyan;">`comment`</mark>* *<mark style="color:cyan;">with the comment that will be attached to a step</mark>*
* *<mark style="color:cyan;">`replyToSender`</mark>* *<mark style="color:cyan;">with a boolean value. Set it to</mark>* *<mark style="color:cyan;">**true**</mark><mark style="color:cyan;">, if you want to receive notification about the step proceeding result to the email address of the person, who has proceeded the step by clicking this link, otherwise notification will be sent to the email address of the SF user, on whose behalf the step was proceeded</mark>*

{% hint style="info" %}
For more information regarding Email Assistant feature setup please refer to the following article: [Working with Email Assistant](/administration/settings/other-settings/working-with-email-assistant.md)
{% endhint %}

**Example**:

{% code overflow="wrap" %}

```apex
BUILDEMAILASSISTANTLINK('Approve', {$Cursor.FlowInstance.Id}, {$Cursor.Id}, {$Step.Id}, {$Step.AssignTo}, 'Approve', '', true) 
```

{% endcode %}

Returns a link to be included into email; clicking on this link will approve the step and send notification to the same address where email with this link has been sent to.

</details>

<details>

<summary>GETASSIGNEENAMES</summary>

Returns names of Flow Instance Cursor assignees.

**Usage**:

{% code overflow="wrap" %}

```apex
GETASSIGNEENAMES(ids_string) 
```

{% endcode %}

*<mark style="color:cyan;">Replace</mark>* *<mark style="color:cyan;">`ids_string`</mark>* *<mark style="color:cyan;">with a single ID or group of IDs.</mark>*

**Example**:

{% code overflow="wrap" %}

```apex
JOIN(GETASSIGNEENAMES({$Cursor.Assignee}), ',') 
```

{% endcode %}

Returns **'User A, User B, User C'** if cursor assignee type is **User** and 3 users are added as assignees.

</details>

<details>

<summary>USERIN</summary>

Returns boolean (**true** or **false**) result depending on whether given User ID is present in the given list of users (or belongs to some or not.

**Usage**:

{% code overflow="wrap" %}

```apex
USERIN(user_id,ids) 
```

{% endcode %}

*<mark style="color:cyan;">Replace</mark>* *<mark style="color:cyan;">`user_id`</mark>* *<mark style="color:cyan;">with a single ID of some user, and ids with a comma-separated list of IDs.</mark>*

**Example**:

{% code overflow="wrap" %}

```apex
USERIN({$User.Id},'0C341700000JZJ0CAF,0ES78000000CD7D') 
```

{% endcode %}

Returns **'true'** if current user is in the list of given IDs or belongs to group/queue/chatter group which ID is in this list, or has role/profile/permission set, which ID is in the list, assigned to him.

</details>

<details>

<summary>PROPERTYVALUE</summary>

<mark style="color:$success;">Available starting with 8.7 release.</mark>

Returns a value of given Custom Data Field:

* For Custom Data Field that is not a tag, the function returns it's value.
* For a tag, the function returns a tag name.
* If no Custom Data Field with given name exists for given step, the function will return an empty value.

**Usage**:

{% code overflow="wrap" %}

```apex
PROPERTYVALUE(instance_or_record_id, step_id, name) 
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`instance_or_record_id`</mark>* *<mark style="color:cyan;">with a single ID of a Flow Instance or some other record (see note below)</mark>*
* *<mark style="color:cyan;">`step_id`</mark>* *<mark style="color:cyan;">with step ID</mark>*
* *<mark style="color:cyan;">`name`</mark>* *<mark style="color:cyan;">with Custom Data Field name</mark>*

{% hint style="info" %}
Notes:

* If user passes a valid `instance_or_record_id` that is an ID of a started flow instance, function will return an actual value of custom data field (e.g., if it has been edited by some user and saved, the function will return a new value).
* If user passes a valid `instance_or_record_id` that is NOT an ID of a started flow instance but it is a valid ID of some record, function will search for a Flow Instance (of given process) started on this record. If it exists, function will return return an actual value of custom data field, otherwise it returns a value of this Custom Data Field that was configured for the Process in a Process Builder.
  {% endhint %}

<mark style="color:orange;">Let process step has a text field named "</mark><mark style="color:orange;">`custom text`</mark><mark style="color:orange;">" and equal to "test", and user has started some flow instance and changed this value to "test 2"; also this step has a tag "test tag".</mark>

**Example 1**:

{% code overflow="wrap" %}

```apex
PROPERTYVALUE({$Cursor.FlowInstance.Id},{$Step.Id},'custom text') 
```

{% endcode %}

Returns **'test 2'**.

**Example 2**:

{% code overflow="wrap" %}

```apex
PROPERTYVALUE({$User.Id},{$Step.Id},'custom text') 
```

{% endcode %}

Returns **'test'**.

**Example 3**:

{% code overflow="wrap" %}

```apex
PROPERTYVALUE({$Cursor.FlowInstance.Id},{$Step.Id},'test tag') 
```

{% endcode %}

Returns **'test tag'**.

**Example 4**:

{% code overflow="wrap" %}

```apex
PROPERTYVALUE({$Cursor.FlowInstance.Id},{$Step.Id},'non_existing_custom_dateTime') 
```

{% endcode %}

Returns an empty value.

{% hint style="warning" %}
If pass an empty or invalid ID to any argument, user will see a system error message "invalid ID: %passed\_value%".
{% endhint %}

</details>

<details>

<summary>STEPTAGS</summary>

<mark style="color:$success;">Available starting with 8.7 release.</mark>

Returns an array of tag names (Custom Data Fields that have type="tag") for given step.

**Usage**:

{% code overflow="wrap" %}

```apex
STEPTAGS(instance_or_record_id, step_id) 
```

{% endcode %}

*<mark style="color:cyan;">Replace:</mark>*

* *<mark style="color:cyan;">`instance_or_record_id`</mark>* *<mark style="color:cyan;">with a single ID of a Flow Instance or some other record (see note below)</mark>*
* *<mark style="color:cyan;">`step_id`</mark>* *<mark style="color:cyan;">with step ID</mark>*

<mark style="color:orange;">Let process step has tags named "tag 1", "tag 2" and "tag 3".</mark>

**Example 1**:

{% code overflow="wrap" %}

```apex
STEPTAGS({$Cursor.FlowInstance.Id},{$Step.Id}) 
```

{% endcode %}

Returns an array: `(tag 3, tag 1, tag 2)`.

**Example 2**:

{% code overflow="wrap" %}

```apex
STEPTAGS({$Cursor.FlowInstance.Id},{$Another_or_Non-existing_Step.Id})
```

{% endcode %}

Returns an empty array: `()`.

{% hint style="warning" %}
If pass an empty or invalid ID to any argument, user will see a system error message "invalid ID: %passed\_value%".
{% endhint %}

</details>
