> For the complete documentation index, see [llms.txt](https://docs.appstrategy.com/apprules-r-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/base-activities/base-activities-1.md). Agents can also search and read this documentation through its [MCP server](https://docs.appstrategy.com/apprules-r-documentation/~gitbook/mcp).

# Base Activities

## Base Module

The appRules Base activities module includes activities that are used for initializing your project, closing the project, executing functions, calling other projects and more.&#x20;

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2Fz5TWl2ty8T45amszsl1e%2Fimage.png?alt=media&amp;token=d9112ae5-9d69-4f80-a20a-cd1faf958a07" alt=""><figcaption></figcaption></figure>

### Activities

The table below shows the activities in the appRules Base module including their key properties.

#### Activities

| Activity                | Description                                                                                                       |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------- |
| CallWebService          | Calls a REST or SOAP web service over HTTP(S) and saves the response status, body and headers.                    |
| Delay                   | Pauses workflow execution for a specified amount of time.                                                         |
| EndWorkflow             | Ends the currently running workflow instance.                                                                     |
| EvaluateCondition       | Evaluates a workflow condition and returns True or False.                                                         |
| ExecuteWorkflow         | Runs another workflow, optionally passing parameters and receiving return values.                                 |
| ExecuteWorkflowActivity | Executes an activity of the current workflow. If the activity is open, it is closed and re-opened first.          |
| PerformAction           | Executes a workflow action and optionally saves its result.                                                       |
| SendEmail               | Sends an email, with optional CC/Bcc recipients and file attachments, through an SMTP server.                     |
| SetValues               | Sets values in the workflow (data fields, variables, etc.), optionally clearing records first.                    |
| UpdateWorkflowState     | Updates the state of the running workflow instance, optionally with data source statistics.                       |
| WriteAuditLogsEntry     | Writes an entry to the audit logs detail table.                                                                   |
| WriteLogEntry           | Writes an entry to the workflow log: a message, warning or error, selected values, record contents or statistics. |

#### Activity properties

Properties are listed under the category in which they appear in the property grid.

**CallWebService**

Calls a web service and captures the response. The response is saved even when the call returns an error status, so error payloads remain available to the workflow.

**WebService Url**

| Property | Description                                                                                                  |
| -------- | ------------------------------------------------------------------------------------------------------------ |
| Url      | Address of the web service. Must start with `http` or `https`. The query string is sent exactly as supplied. |

**WebService.Properties**

| Property    | Description                                                                                                                                                     |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method      | GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS.                                                                                                                 |
| ContentType | Content type of the request, e.g. `application/json`, `text/xml` or `application/x-www-form-urlencoded`. Defaults to `application/json` when a payload is sent. |
| Payload     | JSON, XML or form data to send. Ignored for GET and HEAD.                                                                                                       |
| Headers     | Request headers (name/value pairs).                                                                                                                             |
| Cookies     | Cookies to send, combined into a single `Cookie` header.                                                                                                        |

**WebService.Options**

| Property                | Default | Description                                                                                                                                        |
| ----------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| TimeoutSeconds          | 100     | Seconds to wait for a response before failing.                                                                                                     |
| FollowRedirects         | True    | Follow HTTP redirects automatically.                                                                                                               |
| FailOnErrorStatus       | True    | Fail the activity when the response status is outside the 2xx range.                                                                               |
| FormPayloadIsPreEncoded | False   | For form-urlencoded payloads only. Leave False to have names and values percent-encoded automatically; set True if the payload is already encoded. |
| RetryCount              | 0       | Number of retries after a timeout, network error or 5xx response.                                                                                  |
| RetryDelaySeconds       | 5       | Seconds to wait between retries.                                                                                                                   |

**WebService.Authentication**

| Property                | Description                                                                                      |
| ----------------------- | ------------------------------------------------------------------------------------------------ |
| AuthScheme              | None, Basic, Bearer or ApiKeyHeader. Leave None when authentication is supplied through Headers. |
| AuthUser / AuthPassword | Credentials for Basic authentication.                                                            |
| AuthToken               | Bearer token or API key (required for Bearer and ApiKeyHeader).                                  |
| ApiKeyHeaderName        | Header used for ApiKeyHeader authentication. Default `X-API-Key`.                                |

**WebService.Certificate** and **WebService.SSL**

| Property                     | Description                                                                                                                       |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| CertificateFile / Passphrase | Optional client certificate file and its passphrase.                                                                              |
| SSLServerCert                | Server certificate to accept (thumbprint, PEM content or file path). Leave blank for normal validation.                           |
| AcceptAnyServerCertificate   | Disables TLS certificate validation. Use only for trusted internal endpoints with self-signed certificates; prefer SSLServerCert. |

**WebService.Proxy** and **WebService.Firewall**

| Property                                                                           | Description                                                                                                                                       |
| ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| ProxyAutoDetect                                                                    | Use the system proxy settings (default True). Set False to use the custom proxy settings.                                                         |
| ProxyServer, ProxyPort, ProxyAuthScheme, ProxyUser, ProxyPassword, ProxyExceptions | Custom proxy settings. ProxyAuthScheme: BASIC, DIGEST, NONE, NTLM or NEGOTIATE. ProxyExceptions: semicolon-separated hosts that bypass the proxy. |
| FirewallType, FirewallServer, FirewallPort, FirewallUser, FirewallPassword         | Proxy-based firewall settings. FirewallType: NONE, TUNNEL, SOCKS4, SOCKS5 or HTTP.                                                                |

**WebService.Logging**

| Property | Description                                                                                              |
| -------- | -------------------------------------------------------------------------------------------------------- |
| LogFile  | Full path of the log file. Leave blank to use the default activity log folder.                           |
| LogLevel | 0 = disabled, 1 = normal, 2 = verbose (request and response headers and bodies; credentials are masked). |

**WebService.Results** and **WebService.ResultsFunction**

| Property        | Description                                                                             |
| --------------- | --------------------------------------------------------------------------------------- |
| ResponseStatus  | Where to save the response status name (e.g. `OK`, `NotFound`). Required.               |
| ResponseBody    | Where to save the response body. Required.                                              |
| ErrorMessage    | Where to save the error message when the call fails.                                    |
| ResponseHeaders | Response headers to capture: each entry maps a header name to where its value is saved. |
| ParseWith       | Optional workflow action that parses or processes the response after a successful call. |

> **Tip:** Invisible characters picked up by copy and paste (zero-width spaces, byte order marks, non-breaking spaces) are removed from the Url, Payload and header values before sending, and a warning is logged.

**Delay**

| Property                                    | Description                                                                                      |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Days, Hours, Minutes, Seconds, Milliseconds | The length of the delay. At least one value must be greater than zero, and none can be negative. |

**EndWorkflow**

| Property               | Default | Description                                                                                     |
| ---------------------- | ------- | ----------------------------------------------------------------------------------------------- |
| AutoCloseAllActivities | True    | Close all activities automatically. Set False to apply each activity's KeepAliveOption instead. |
| JobState               | End     | The ending state of the job.                                                                    |

**EvaluateCondition**

| Property     | Description                                         |
| ------------ | --------------------------------------------------- |
| Condition    | The workflow condition to evaluate. Required.       |
| SaveResultIn | Optional. Where to save the result (True or False). |

**ExecuteWorkflow**

| Property     | Description                                                                                                                                                                                                         |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| WorkflowName | Name of the workflow to run. Required.                                                                                                                                                                              |
| Reference    | Optional reference for the run instance. Defaults to the workflow name.                                                                                                                                             |
| Parameters   | Optional parameters to pass. Each has a name, data type (String, Int16, Int32, DateTime, Decimal, Double, Single) and direction. For Out and InOut parameters, SaveResultIn sets where the returned value is saved. |
| RunMode      | Current (default) runs the workflow the same way as the calling one; Interactive or Background forces that mode. A workflow called from a background run always runs in the background.                             |
| RunOnServer  | Server on which to run the workflow. Default runs it locally.                                                                                                                                                       |

**ExecuteWorkflowActivity**

| Property     | Description                                                                                       |
| ------------ | ------------------------------------------------------------------------------------------------- |
| ActivityName | The activity of the current workflow to execute. If it is open, it is closed and re-opened first. |

**PerformAction**

| Property     | Description                                       |
| ------------ | ------------------------------------------------- |
| Action       | The workflow action to execute. Required.         |
| SaveResultIn | Optional. Where to save the result of the action. |

**SendEmail**

**Email**

| Property  | Description                                              |
| --------- | -------------------------------------------------------- |
| FromEmail | Sender's email address. Required.                        |
| FromName  | Sender's display name.                                   |
| Subject   | Subject of the email.                                    |
| To        | Recipients (address and name). At least one is required. |

**Email CC**

| Property | Description                   |
| -------- | ----------------------------- |
| CC       | Carbon-copy recipients.       |
| Bcc      | Blind carbon-copy recipients. |

**Email.Body**

| Property                | Description                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------- |
| Body                    | Body of the email, as HTML (default) or text. Required.                                |
| BodyContainsMergeFields | Whether the body contains merge fields to replace with workflow values (default True). |

**Email.FileAttachments**

| Property    | Description                   |
| ----------- | ----------------------------- |
| Attachments | Files to attach to the email. |

**Email.Server**

| Property                | Default | Description                                                                                            |
| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------ |
| Host                    |         | SMTP host name, e.g. `smtp.office365.com`. Required.                                                   |
| SMTPPort                | 0       | SMTP port. 0 uses the default port.                                                                    |
| EnableSSL               | True    | Use SSL/TLS.                                                                                           |
| RequiresAuthentication  | True    | Whether the server requires authentication.                                                            |
| UserName / UserPassword |         | Credentials, required when RequiresAuthentication is True.                                             |
| KeepConnectionOpen      | True    | Keep the SMTP connection open until the end of the job. Useful when the activity sends several emails. |

**SetValues**

| Property | Description                                                                                                                                                                      |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Record   | Optional. A Source or Target whose active record is cleared before the values are set, or All to clear every record. Default None.                                               |
| Values   | The values to set. Each item specifies the value to set (SetValueOf), the new value (ToNewValue) and an optional condition; the item is applied only when the condition is true. |

In debug mode, the values that were set are displayed after the activity runs.

**UpdateWorkflowState**

| Property                    | Description                                                                                                                     |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| State                       | The new state of the running workflow instance. Required.                                                                       |
| IncludeDataSourceStatistics | Also update the statistics (records read, inserted, updated and deleted so far) of every open Source and Target. Default False. |

**WriteAuditLogsEntry**

| Property   | Description                                                                                |
| ---------- | ------------------------------------------------------------------------------------------ |
| Properties | The entry to write to the audit logs detail table. A Description or a Message is required. |

**WriteLogEntry**

| Property     | Description                                                                                                     |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| LogEntryType | Message (default), Warning, Error, SelectedValues, DataSourceRecord, DataSourceStatistics or ProjectStatistics. |
| LogText      | Text of the entry. Required for Message, Warning and Error.                                                     |
| DataManager  | The Source or Target (or All) for DataSourceRecord and DataSourceStatistics.                                    |
| Values       | The values to log. Required for SelectedValues.                                                                 |

What each entry type writes:

| LogEntryType            | Logged content                                                           |
| ----------------------- | ------------------------------------------------------------------------ |
| Message, Warning, Error | LogText, at the corresponding level.                                     |
| SelectedValues          | Each selected value as `source:name=value`.                              |
| DataSourceRecord        | Every field of the active record of the selected Source or Target.       |
| DataSourceStatistics    | Record count, and records read, inserted, updated, deleted and in error. |
| ProjectStatistics       | Database connection statistics (written to the log file in debug mode).  |

### Dialogs Module


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/base-activities/base-activities-1.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
