From 0585611e9d135a59ac289e3680a2aa121fc538ea Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Thu, 22 Jan 2026 10:54:52 +0300 Subject: [PATCH 01/10] update custom.css --- src/css/custom.css | 57 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/css/custom.css b/src/css/custom.css index f7f65e0..85540e0 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -45,4 +45,59 @@ article a[href^="http"]:not([href*="docs.alexacrm.com"]):after { margin-left: 4px; font-size: 0.9em; vertical-align: middle; -} \ No newline at end of file +} + +/* Limit content width for better readability on long pages */ +.markdown, +.theme-doc-markdown { + max-width: 780px; +} + +/* Section headers (H2) */ +.markdown h2 { + margin-top: 3.5rem; + margin-bottom: 1.2rem; + padding-bottom: 0.4rem; + border-bottom: 1px solid var(--ifm-toc-border-color); +} + +/* Subsection headers (H3) */ +.markdown h3 { + margin-top: 2.2rem; + margin-bottom: 0.6rem; +} + +/* Minor headers (H4) */ +.markdown h4 { + margin-top: 1.6rem; + font-weight: 600; +} + +/* Paragraph readability */ +.markdown p { + line-height: 1.7; + margin-bottom: 1rem; +} + + +/* Lists spacing */ +.markdown ul, +.markdown ol { + margin-top: 0.5rem; + margin-bottom: 1.2rem; +} + +.markdown li { + margin-bottom: 0.3rem; +} + + +/* Admonitions as visual anchors */ +.theme-admonition { + margin: 2rem 0; +} + +/* Add breathing space between sections */ +.markdown > h2 + p { + margin-top: 1.2rem; +} From f528b29831730e4162ade4f9527cbc344f838eae Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Fri, 23 Jan 2026 10:35:35 +0300 Subject: [PATCH 02/10] update premium form pages --- datapress/Forms/custom-forms.md | 2 +- datapress/Forms/forms-capabilities.md | 135 ++++++++++++++++++++ datapress/Forms/forms-configuration.md | 136 ++++++++++++++++++++ datapress/Forms/forms-examples.md | 169 +++++++++++++++++++++++++ datapress/Forms/forms-overview.md | 51 ++++++++ datapress/Forms/forms.md | 4 +- datapress/Forms/recaptcha.md | 2 +- 7 files changed, 495 insertions(+), 4 deletions(-) create mode 100644 datapress/Forms/forms-capabilities.md create mode 100644 datapress/Forms/forms-configuration.md create mode 100644 datapress/Forms/forms-examples.md create mode 100644 datapress/Forms/forms-overview.md diff --git a/datapress/Forms/custom-forms.md b/datapress/Forms/custom-forms.md index 76aeb5a..be22c5a 100644 --- a/datapress/Forms/custom-forms.md +++ b/datapress/Forms/custom-forms.md @@ -1,6 +1,6 @@ --- title: Custom Forms -sidebar_position: 2 +sidebar_position: 6 slug: /forms/custom-forms tags: - Form diff --git a/datapress/Forms/forms-capabilities.md b/datapress/Forms/forms-capabilities.md new file mode 100644 index 0000000..6bf6938 --- /dev/null +++ b/datapress/Forms/forms-capabilities.md @@ -0,0 +1,135 @@ +--- +title: Reference (Capabilities & Limitations) +sidebar_position: 3 +premium: true +slug: /forms/forms/forms-reference +tags: + - Form + - DataPress +keywords: [DataPress forms configuration] +--- + +## Supported controls + +DataPress renders forms close to their Dataverse definitions. + +Supported control types include: + +- Single‑line and multi‑line text +- Email and numeric fields +- Money and integer fields +- Radio buttons and checkboxes +- Date and time pickers +- Lookup fields + +--- + +## Limitations + +### Lookup selection +- Lookup dialogs do **not** support selecting multiple records +- Multi‑select picklists are **not supported** + +### Unsupported composite controls +The following controls are not currently supported: + +- Subgrids +- Maps +- Quick (nested) forms +- Notes, activities, posts, assistant panels + +### Web resources +Custom JavaScript web resources embedded in Dataverse forms are not supported. + +You may still use WordPress‑level CSS and JavaScript to customize appearance and behavior. + +--- + +## Composite columns + +### Full Name (`fullname`) + +`fullname` is a calculated field composed of name attributes. + +If present on the form, DataPress automatically decomposes it into individual controls (such as `firstname` and `lastname`) instead of using a popup editor. + +Microsoft reference: +https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013 + +### Address (`addressN_composite`) + +Address composite columns are handled similarly and decomposed into their underlying attributes. + +The plugin allows configuring which attributes are used for Full Name and Address fields. + +--- + +## Date and time behavior + +Dataverse supports multiple date behaviors: + +- **User Local**: Adjusts values based on the user’s time zone. +- **Time Zone Independent**: No time zone conversion is applied. +- **Date Only**: Displays only the date portion without time zone conversion. + +Documentation: +https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field + +### Time zone handling + +For **User Local** fields, displayed values depend on: + +- `ICDS_DATETIME_VALUE` setting (Legacy или Local) +- User time zone + +Example: + +| Stored Value | Timezone | Displayed Value | +|-------------|----------|----------------| +| 5/15/2028 03:00 AM | UTC+2 | 5/15/2028 05:00 AM | +| 5/15/2028 03:00 AM | UTC‑4 | 5/14/2028 11:00 PM | + +Anonymous visitors see values using the WordPress site time zone. + +--- + +## Lookup behavior and security + +### Display modes + +1. **Dialog** — searchable modal lookup +2. **Dropdown** — filtered list with optional search +3. **Select** — simple dropdown (≈ 50 options) + +--- + +### Security measures + +To prevent unauthorized data access: + +1. WordPress nonces are enforced + https://developer.wordpress.org/apis/security/nonces/ + +2. Access can be restricted using a filter hook: + +```php +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ + if ( !is_user_logged_in() ) { + return false; + } + return $isAllowed; +}, 10, 3 ); +``` + +3. FetchXML templates can filter lookup results. + +## Unsupported Whole Number Formats +These Dataverse formats are not supported: + +Language code +Duration +Time zone + +## Decimal & Float Fields +Handled according to Dataverse settings (min/max, decimals). +[Reference](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) diff --git a/datapress/Forms/forms-configuration.md b/datapress/Forms/forms-configuration.md new file mode 100644 index 0000000..e8ee9e1 --- /dev/null +++ b/datapress/Forms/forms-configuration.md @@ -0,0 +1,136 @@ +--- +title: Form Configuration +sidebar_position: 2 +premium: true +slug: /forms/forms/forms-configuration +tags: + - Form + - DataPress +keywords: [DataPress forms configuration] +--- + +## Before you begin + +Make sure that: + +1. The premium extension is active and licensed +2. A Dataverse (model‑driven) form already exists +3. You know whether the form should create, update, or display records + +--- + +## Creating a form registration + +To start collecting data, you must create a form registration. + +1. Open the plugin dashboard +2. Go to **Forms** +3. Click **Create new** + +Fill in the following fields: + +- **Form Name** +- **CRM Form** — select a Dataverse form +- **Mode** — choose how data is processed + +Click **Create** to save the registration. + +--- + +## Form modes + +### Create a new record + +Each submission creates a **new Dataverse record**. + +### Update or create a record + +The form uses table binding to: + +- load an existing record into the form +- update it on submission + +If no record is found, a new one is created. + +### Read‑only + +Table binding is used to load a record, but the form cannot be edited or submitted. + +--- + +## Allow deleting records + +When using **Update** or **Read‑only** mode, you can enable record deletion: + +- Enable **Allow deleting the record** + +⚠️ To prevent unauthorized deletes, implement the filter: + +`integration-cds/forms/authorize-delete` + +Parameters passed to the filter: + +- `$isAuthorized` — whether deletion is allowed +- `$reg` — the active form registration +- `$target` — the record being deleted (or `NULL`) + +Return `false` if deletion should not be allowed. + +--- + +## Required and optional attributes + +Dataverse defines required fields at the form level. +DataPress allows additional customization **without modifying the Dataverse form**. + +To change requiredness: + +1. Select attributes in **Attributes** +2. Move them to: + - **Required →** + - **Optional →** +3. Remove items by double‑clicking or using **Remove selected** + +--- + +## Global settings overrides + +Each form registration can override global form behavior, including: + +- reCAPTCHA +- Front‑end dependencies +- Form messages and behavior +- Full Name / Address decomposition + +--- + +## Front‑end dependencies + +Power Apps forms require the following libraries: + +- **Bootstrap 4** — https://getbootstrap.com/ +- **Font Awesome 5** — https://fontawesome.com/ + +DataPress ships custom, isolated builds of these libraries. +You may disable them if your WordPress theme already includes compatible versions. + +--- + +## reCAPTCHA support + +Dataverse forms integrate with reCAPTCHA. + +[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) + +--- + +## Adding the form to a page + +Use the Twig tag and the form registration ID: + +```twig +{% form id=42 %} + +This renders the form and starts accepting submissions. + +--- \ No newline at end of file diff --git a/datapress/Forms/forms-examples.md b/datapress/Forms/forms-examples.md new file mode 100644 index 0000000..775aa4c --- /dev/null +++ b/datapress/Forms/forms-examples.md @@ -0,0 +1,169 @@ + +--- +title: Forms Examples +sidebar_position: 4 +premium: true +slug: /forms/forms/examples +tags: + - Form + - DataPress + - Examples +keywords: [DataPress forms, Power Apps Forms examples, Dataverse forms examples] +--- + +# Examples + +This page provides copy/paste examples for rendering **Power Apps / Dataverse forms** on WordPress using **DataPress** form registrations. + +> **Prerequisite:** You must create a **form registration** in the plugin admin area. +> You will need its registration ID (for example, `id=42`). + +--- + +## Render a basic form + +Render a form using its **form registration ID**: + +```twig +{% form id=42 %} +``` + +## Render a form with default field values +Use the defaults attribute to pre-populate fields: + +``` +{% form id=42 defaults={ + "leadsourcecode": 8, + "donotfax": true, + "address1_country": "United States" +} %} +``` + +**Notes:** + +- Defaults values must match Dataverse attribute logical names. +- Boolean fields accept true/false. +- For choice fields, pass the numeric option value (see next section). + +## Set a default value for a Choice (Option Set) field + +For choice fields, pass the integer value of the option. +**Example:** set gendercode to “Male” where “Male” has value 1: + +``` +{% form id=4 defaults={"gendercode": 1} %} +``` + +You can find label/value mapping in Dataverse column settings or metadata. + +## Set a default value for a Multi-Select Choice field + +Multi-select values are passed as a comma-separated string: + +``` + +{% form id=2 defaults={"multipleChoiceColumnName": "3,4"} %} +``` + +### Pre-select lead source + +``` +{% form id=42 defaults={"leadsourcecode": 8} %} +``` + +## Redirect after submit and capture the created record GUID + +When a record is successfully created, you can inject the record GUID into a redirect URL using %s. +Example: + +- Redirect setting: /?id=%s +- After create: /?id=00000000-0000-0000-0000-000000000000 + +Use this to forward users to a “Thank you” page, a confirmation screen, or a details page. + +## Set default values via Admin UI (no Twig changes) + +You can define default values inside the Dataverse Admin Area: + +1. Choose the form +2. Go to Fields Customization +3. Find Default Field Values +4. Add field name + default value + +This method supports defaults for: + +- text/number fields +- choice fields +- lookup fields (when configured) + +## Deletion security — authorize delete requests + +If your form registration enables **Allow deleting the record**, you should guard it with the `integration-cds/forms/authorize-delete filter`. + +Add to functions.php: + +``` +add_filter( 'integration-cds/forms/authorize-delete', function( $isAuthorized, $reg, $target ) { + // Reject if no record was resolved + if ( $target === null ) { + return false; + } + + // Example rule: only signed-in users can delete + if ( ! is_user_logged_in() ) { + return false; + } + + // You can add more rules here: + // - check user role/capability + // - check ownership against $target + // - check registration ID via $reg + + return $isAuthorized; +}, 10, 3 ); +``` + +## Lookup security — restrict lookup access to signed-in users + +Lookups use a REST API endpoint and should be protected to avoid accidental data exposure. +The snippet below restricts lookups to **authenticated users only**. + +Add it to the active theme’s functions.php: + +``` +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ) { + if ( ! is_user_logged_in() ) { + return false; + } + + return $isAllowed; +}, 10, 3 ); +``` + +## Date & Time behavior — what users will see + +Dataverse fields can behave as: + +**User Local**: value converts to user timezone +**Time Zone Independent**: no conversion +**Date Only**: date without time conversion + +Example value stored: 5/15/2028 03:00:00 AM (User Local field) + +If timezone is UTC + 2, users see 5/15/2028 05:00:00 AM +If timezone is UTC - 4, users see 5/14/2028 11:00:00 PM + +Set timezone per WordPress user + +Users → Edit +Dataverse Extra Fields +Choose Timezone + +Anonymous visitors use the site timezone configured in: +Settings → General → + +## Troubleshooting tips (quick) + +- If the premium plugin is not licensed, forms may fail with syntax errors — verify licensing first. +- If your theme already includes Bootstrap/Font Awesome, consider disabling DataPress dependencies to avoid conflicts. +- If lookup results look too broad, use view filters and/or FetchXML templates in conditional access settings. \ No newline at end of file diff --git a/datapress/Forms/forms-overview.md b/datapress/Forms/forms-overview.md new file mode 100644 index 0000000..9c25068 --- /dev/null +++ b/datapress/Forms/forms-overview.md @@ -0,0 +1,51 @@ + +--- +title: Power Apps Forms +sidebar_position: 1 +premium: true +slug: /forms/forms-overview +tags: + - Form + - DataPress +keywords: [DataPress forms] +--- + +:::note +The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. +All references in the documentation and user interface will be gradually updated. +::: + +

+Capture leads, feedback, and other data from your website using forms designed in Power Apps and Dynamics 365. +

+ +## What are Power Apps Forms in DataPress? + +**Power Apps Forms** allow you to display Dataverse (Dynamics 365) forms on your WordPress website and submit user input directly back to Dataverse. + +With DataPress, you can: + +- Render Dataverse forms on public or protected pages +- Create new records from form submissions +- Update existing records using table binding +- Display data in a read‑only mode + +## Key concept: Form Registration + +To use a Dataverse form on a WordPress page, DataPress introduces the concept of a **form registration**. + +A form registration acts as a proxy between WordPress and Dataverse. It defines: + +- Which Dataverse form to display +- How the form handles submissions +- Which attributes are required or optional +- Which form‑level settings override global defaults + +## How forms are rendered on the website + +Forms are embedded into pages using the Twig templating engine. + +```twig +{% form id=42 %} +``` + diff --git a/datapress/Forms/forms.md b/datapress/Forms/forms.md index a1b76f6..574b478 100644 --- a/datapress/Forms/forms.md +++ b/datapress/Forms/forms.md @@ -1,6 +1,6 @@ --- -title: Power Apps Forms -sidebar_position: 1 +title: Power Apps Forms - old +sidebar_position: 5 premium: true slug: /forms/forms tags: diff --git a/datapress/Forms/recaptcha.md b/datapress/Forms/recaptcha.md index 21e9dac..5a8dca1 100644 --- a/datapress/Forms/recaptcha.md +++ b/datapress/Forms/recaptcha.md @@ -1,6 +1,6 @@ --- title: reCAPTCHA support -sidebar_position: 3 +sidebar_position: 7 premium: true slug: /forms/recaptcha tags: From 7efcd55198dced2e8f66f9fe02993dff7168bccd Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Fri, 23 Jan 2026 10:40:12 +0300 Subject: [PATCH 03/10] update slug --- datapress/Forms/forms-capabilities.md | 2 +- datapress/Forms/forms-configuration.md | 2 +- datapress/Forms/forms-examples.md | 3 +-- datapress/Forms/forms-overview.md | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/datapress/Forms/forms-capabilities.md b/datapress/Forms/forms-capabilities.md index 6bf6938..c509707 100644 --- a/datapress/Forms/forms-capabilities.md +++ b/datapress/Forms/forms-capabilities.md @@ -2,7 +2,7 @@ title: Reference (Capabilities & Limitations) sidebar_position: 3 premium: true -slug: /forms/forms/forms-reference +slug: /forms/forms-reference tags: - Form - DataPress diff --git a/datapress/Forms/forms-configuration.md b/datapress/Forms/forms-configuration.md index e8ee9e1..28470b8 100644 --- a/datapress/Forms/forms-configuration.md +++ b/datapress/Forms/forms-configuration.md @@ -2,7 +2,7 @@ title: Form Configuration sidebar_position: 2 premium: true -slug: /forms/forms/forms-configuration +slug: /forms/forms-configuration tags: - Form - DataPress diff --git a/datapress/Forms/forms-examples.md b/datapress/Forms/forms-examples.md index 775aa4c..2cf0389 100644 --- a/datapress/Forms/forms-examples.md +++ b/datapress/Forms/forms-examples.md @@ -1,9 +1,8 @@ - --- title: Forms Examples sidebar_position: 4 premium: true -slug: /forms/forms/examples +slug: /forms/forms-examples tags: - Form - DataPress diff --git a/datapress/Forms/forms-overview.md b/datapress/Forms/forms-overview.md index 9c25068..d2a0688 100644 --- a/datapress/Forms/forms-overview.md +++ b/datapress/Forms/forms-overview.md @@ -1,4 +1,3 @@ - --- title: Power Apps Forms sidebar_position: 1 From 5ee9d97ce605ffa68be8fde39c04ae7b897242bc Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Fri, 23 Jan 2026 18:36:37 +0300 Subject: [PATCH 04/10] update custom forms --- datapress/Forms/custom-forms-example.md | 137 ++++++++++++++++++++++ datapress/Forms/custom-forms-overview.md | 64 ++++++++++ datapress/Forms/custom-forms-reference.md | 96 +++++++++++++++ datapress/Forms/custom-forms.md | 2 +- datapress/Forms/recaptcha.md | 2 +- 5 files changed, 299 insertions(+), 2 deletions(-) create mode 100644 datapress/Forms/custom-forms-example.md create mode 100644 datapress/Forms/custom-forms-overview.md create mode 100644 datapress/Forms/custom-forms-reference.md diff --git a/datapress/Forms/custom-forms-example.md b/datapress/Forms/custom-forms-example.md new file mode 100644 index 0000000..21a087b --- /dev/null +++ b/datapress/Forms/custom-forms-example.md @@ -0,0 +1,137 @@ +--- +title: Custom Forms examples +sidebar_position: 9 +slug: /forms/custom-forms-example +tags: + - Form + - DataPress +keywords: [DataPress custom form] +--- + +:::note +The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. All references in documentation and UI are being updated accordingly. [1](https://docs.alexacrm.com/forms/custom-forms/) +::: + +## Custom form examples + +### 1. Update a Contact + +``` +{% form entity="contact" mode="update" record=record|to_entity_reference %} +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+{% endform %} +``` + +### 2. Contact Us Form (Create) + reCAPTCHA + +``` +{% form entity="lead" mode="create" recaptcha=true %} +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+{% endform %} +``` + +### 3. Date Only & Date Time fields + +``` +{% form entity="contact" mode="create" %} +
+
+ +
+ +
+ +
+ +
+ +
+ + +
+{% endform %} +``` + +### 4. Display extracted date/time values + +``` +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+``` \ No newline at end of file diff --git a/datapress/Forms/custom-forms-overview.md b/datapress/Forms/custom-forms-overview.md new file mode 100644 index 0000000..3329c85 --- /dev/null +++ b/datapress/Forms/custom-forms-overview.md @@ -0,0 +1,64 @@ +--- +title: Custom Forms - Overview +sidebar_position: 7 +slug: /forms/custom-forms-overview +tags: + - Form + - DataPress +keywords: [DataPress custom form] +--- + +:::note +The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. All references in documentation and UI are being updated accordingly. [1](https://docs.alexacrm.com/forms/custom-forms/) +::: + +

Use Twig + HTML to build custom forms and send submissions directly into Dataverse.

+ +# Overview + +Custom Forms let you capture data from your WordPress site **without** using Power Apps or Dynamics 365 forms. +Instead, you build the layout yourself using regular HTML form markup and wrap it inside Twig tags. + +Key capabilities: +- Build any HTML layout using your own design. +- Map form fields to Dataverse table columns via input `name` attributes. +- Submit data directly into Dataverse (create or update records). +- Optionally add reCAPTCHA protection. + +Custom Forms are included in the **free** DataPress plugin on WordPress.org. + +--- + +# Configuration + +## 1. Wrap your HTML form with `{% form %} ... {% endform %}` + +A custom form begins with a pair of Twig tags: +`{% form ... %}` → configuration +`{% endform %}` → closing tag + +Inside them, you **must** place a standard HTML `
...
` element. +The submit event is handled automatically when the user submits the form. + +## 2. Connect form inputs to Dataverse columns + +Use the Dataverse column logical name for each ``: + +```html + + +``` + +The plugin uses these names to map the values to Dataverse. + +## 3. Enable reCAPTCHA (optional) + +To protect from spam: + +- Add recaptcha=true to `{% form %}`. +- Add the placeholder `` inside your `
`. +- Configure reCAPTCHA keys in plugin settings — otherwise the form may not load or submit. + +## 4. Place the form on a WordPress page + +Use the Gutenberg block **Dataverse Plain**, which accepts Twig and renders it as HTML on the frontend. diff --git a/datapress/Forms/custom-forms-reference.md b/datapress/Forms/custom-forms-reference.md new file mode 100644 index 0000000..0d9af78 --- /dev/null +++ b/datapress/Forms/custom-forms-reference.md @@ -0,0 +1,96 @@ +--- +title: Custom Forms - Reference +sidebar_position: 8 +slug: /forms/custom-forms-reference +tags: + - Form + - DataPress +keywords: [DataPress custom form] +--- + +# Reference (Capabilities & Limitations) + +## What Custom Forms can do + +- **Create** new Dataverse records (rows) from a WordPress page. +- **Update** existing Dataverse records when `mode="update"` and `record` is provided. +- Map HTML inputs to Dataverse columns using the input `name` attribute (Dataverse logical column name). +- Optionally enable **reCAPTCHA** [protection for custom forms](https://docs.alexacrm.com/forms/recaptcha/) + +## How submission works (important note) + +DataPress processes submissions using the HTML form **submit** event (standard browser behavior). [1](https://docs.alexacrm.com/forms/custom-forms/)[3](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event) + +Make sure your markup contains a real `...
` element, because [submission is tied to the form itself](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event) + +--- + +## `{% form %}` parameters + +Use these parameters in the opening Twig tag: + + +| Parameter | Type | Description | +|-------------|---------------------|-------------| +| **entity** | string (required) | Logical name of the target Dataverse table. | +| **mode** | string (required) | Form mode: `create` to create a new record, `update` to update an existing one. | +| **record** | EntityReference | Record GUID, EntityReference, or Table object used in `update` mode.| +| **recaptcha** | boolean | Enables reCAPTCHA validation. Requires `` placeholder inside the form. See *Protect form submissions with reCAPTCHA*. | +| **redirect** | string | URL to redirect the user to after a successful submission. Supports `%s` for record GUID. | +| **message** | string | Custom success message displayed after form submission. | +| **messages** | object | Custom messages object (e.g., success / failure messages). Example: `{ "success": "Thanks!", "failure": "Please try again later." }` | +| **keep** | boolean | Keeps the form visible after a successful submission (`false` by default; form collapses). | +| **keep_data** | boolean | Keeps form field values after a successful submission (`false` by default; values are cleared). | + +[Examples](/forms/custom-forms-example) + +--- + +## Premium behavior (Power Apps forms) + +If the premium add‑on is installed and an `id` parameter is used, the `{% form %}` tag behaves like a Power Apps form [tag](/forms/forms-configuration/) + +--- + +## reCAPTCHA requirements (Custom Forms) + +If you enable reCAPTCHA with `recaptcha=true`, you must do **both**: + +1. Configure [reCAPTCHA keys in DataPress settings](/forms/recaptcha/) +2. Add the `` placeholder **inside** your `
` markup. + DataPress replaces it with the actual reCAPTCHA widget at runtime. + +If reCAPTCHA is enabled but not configured, the form may fail to render or submit. + +Read more: [reCAPTCHA support](/forms/recaptcha/) + +--- + +## Date/Time fields in Custom Forms + +### Expected input formats + +When you fill date fields manually in a custom form, use these formats: + +- **Date Only**: `yyyy-mm-dd` or `yyyy/mm/dd` + Example: `2023-01-20` or `2023/01/20` [1](https://docs.alexacrm.com/forms/custom-forms/) +- **Date Time**: `yyyy-mm-ddThh:mm` + Example: `2023-01-20T12:30` [1](https://docs.alexacrm.com/forms/custom-forms/) + +### Time zone behavior + +How date/time values are displayed can depend on Dataverse behavior (User Local / Time Zone Independent / Date Only) and DataPress settings such as [`ICDS_DATETIME_VALUE`](/date-and-time/) +[1](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field) + +Read more: [Date and Time columns](https://docs.alexacrm.com/date-and-time/) + +--- + +## Getting the created record GUID via redirect + +After a record is created successfully, you can capture its GUID using `redirect` with a `%s` placeholder. + +Example: + +- `redirect="/?id=%s"` becomes: + `/?id=00000000-0000-0000-0000-000000000000` diff --git a/datapress/Forms/custom-forms.md b/datapress/Forms/custom-forms.md index be22c5a..fac3887 100644 --- a/datapress/Forms/custom-forms.md +++ b/datapress/Forms/custom-forms.md @@ -1,5 +1,5 @@ --- -title: Custom Forms +title: Custom Forms - old sidebar_position: 6 slug: /forms/custom-forms tags: diff --git a/datapress/Forms/recaptcha.md b/datapress/Forms/recaptcha.md index 5a8dca1..c3c0d17 100644 --- a/datapress/Forms/recaptcha.md +++ b/datapress/Forms/recaptcha.md @@ -1,6 +1,6 @@ --- title: reCAPTCHA support -sidebar_position: 7 +sidebar_position: 10 premium: true slug: /forms/recaptcha tags: From d027acab51d48fb9d94578935fd3c2457649fa7e Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Mon, 26 Jan 2026 19:20:28 +0300 Subject: [PATCH 05/10] twig rewriting --- datapress/using-twig/filters_and_function.md | 2 +- .../using-twig/separate_columns_in_twig.md | 4 +- datapress/using-twig/twig_configuration.md | 84 ++++++++++++ datapress/using-twig/twig_examples.md | 127 ++++++++++++++++++ datapress/using-twig/twig_introduction.md | 4 +- datapress/using-twig/twig_overview.md | 23 ++++ datapress/using-twig/twig_reference.md | 35 +++++ 7 files changed, 274 insertions(+), 5 deletions(-) create mode 100644 datapress/using-twig/twig_configuration.md create mode 100644 datapress/using-twig/twig_examples.md create mode 100644 datapress/using-twig/twig_overview.md create mode 100644 datapress/using-twig/twig_reference.md diff --git a/datapress/using-twig/filters_and_function.md b/datapress/using-twig/filters_and_function.md index 3f377a7..24f05c3 100644 --- a/datapress/using-twig/filters_and_function.md +++ b/datapress/using-twig/filters_and_function.md @@ -1,5 +1,5 @@ --- -sidebar_position: 3 +sidebar_position: 7 title: Filters and function slug: /twig/filters_and_function tags: diff --git a/datapress/using-twig/separate_columns_in_twig.md b/datapress/using-twig/separate_columns_in_twig.md index 476be45..765e060 100644 --- a/datapress/using-twig/separate_columns_in_twig.md +++ b/datapress/using-twig/separate_columns_in_twig.md @@ -1,6 +1,6 @@ --- -sidebar_position: 2 -title: Using Twig to display the value of separate columns +sidebar_position: 6 +title: Using Twig to display the value of separate columns - old slug: /twig/display-separate-column-value tags: - Twig diff --git a/datapress/using-twig/twig_configuration.md b/datapress/using-twig/twig_configuration.md new file mode 100644 index 0000000..9c2c012 --- /dev/null +++ b/datapress/using-twig/twig_configuration.md @@ -0,0 +1,84 @@ +--- +sidebar_position: 2 +title: Twig Configuration +slug: /twig/configuration +tags: [Twig, Configuration] +keywords: [DataPress twig configuration] +--- + +## Debug Mode + +Twig debugging allows use of `dump()` to inspect Twig variables. +It becomes active when: + +- WordPress debug mode (`WP_DEBUG`) is enabled, or +- `ICDS_TWIG_DEBUG = true`. + +## Template Caching + +Caching improves Twig template rendering performance. +Enable it with (Advanced settings in DataPress Admin Area): + +``` +ICDS_TWIG_CACHE = true +``` + +## Mobile Device Detection + +DataPress exposes **MobileDetect** helpers in Twig: + +```twig +isMobile: {% if isMobile %}Yes{% else %}No{% endif %} +isChrome: {% if isChrome %}Yes{% else %}No{% endif %} +isFirefox: {% if isFirefox %}Yes{% else %}No{% endif %} +``` + +Intellisense hints are available when typing `{{` inside a Dataverse Twig block. + +## Date/Time Mode + +Your Dataverse **ICDS_DATETIME_VALUE** setting controls how date columns behave: + +- Legacy +- UTC +- Local + +Different fields (e.g., User Local) adjust their output accordingly. +Use `format_datetime()` for consistent locale/timezone formatting. + +Examples for the **createdon** column which has User Local behavior: + +| | Legacy | UTC | Local | +|----------------------|--------------|----------------|-----------| +|`{{record.createdon}}` | UTC | UTC | convert the date and time to the user's timezone | +|`{{record.createdon_utc}}` | UTC | UTC | UTC | +|`{{record.createdon_local}}` | convert the date and time to the user's timezone | convert the date and time to the user's timezone | convert the date and time to the user's timezone | + +[Usage Scenarios](/date-and-time/#usage-scenarios) + +### Timezone & Locale Sources + +- user.timezone / user.locale +- site.timezone / site.locale + +These follow the IANA timezone format (e.g., Europe/Paris, UTC). + +## Request Context + +Object `request` contains information about the current request. It has the following members: + +- `params` -- merged map of cookies, POST form values and GET query arguments +- `path` -- relative page URL +- `path_and_query` -- relative page URL with query arguments +- `query` -- query arguments, start with `?` if not empty +- `url` -- full request URL + +Global object `params` is the alias of `request.params`. + +### Dataverse Connection Status + +``` +{% if crm.connected %} + Dataverse connection active +{% endif %} +``` \ No newline at end of file diff --git a/datapress/using-twig/twig_examples.md b/datapress/using-twig/twig_examples.md new file mode 100644 index 0000000..69bbaa3 --- /dev/null +++ b/datapress/using-twig/twig_examples.md @@ -0,0 +1,127 @@ +--- +sidebar_position: 4 +title: Twig Examples +slug: /twig/examples +tags: [Twig, DataPress] +keywords: [DataPress twig examples] +--- + +# Twig Examples + +This page provides practical Twig snippets for displaying data, formatting values, and building custom forms in DataPress. + +--- + +## Render a Page-Bound Record + +```twig +{% if binding.is_bound %} + {% set contact = binding.record %} + {{ contact["fullname"] }} <{{ contact["emailaddress1"] }}> +{% endif %} +``` + +## Display Current User Information + +```twig + +{% if user.is_bound %} + {{ user.record["fullname"] }} +{% endif %} +``` + +## Access your Dataverse Integration organization metadata + +`metadata` object allows accessing metadata of your Dataverse instance. It follows the interface of `EntityMetadata` in XRM SDK. See [Microsoft reference docs](https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.metadata.entitymetadata). + +```twig +{% set options = metadata["contact"].Attributes["gendercode"].OptionSet.Options %} +{% for option in options %} +
  • {{option.Value}} - {{option.Label.UserLocalizedLabel.Label}}
  • +{% endfor %} +``` + +## Format Date Using User Locale & Timezone + +```twig +{{ "now" | format_datetime('short', 'short', locale=user.locale, timezone=user.timezone) }} +``` + +## Access Any Dataverse Record + +```twig +{{ entities.contact["00000000-0000-0000-0000-000000000000"]["fullname"] }} +``` + +## Using Twig to display the value of separate columns + +### Working with Date Columns + +Standard formatting + +```twig +{{ record.birthdate | format_datetime( + dateFormat='short', + timeFormat='short', + locale=user.locale, + timezone=user.timezone +) }} +``` + +Convert timezone + +```twig +{{ record.birthdate | date("F jS \\a\\t g:ia", "Europe/Paris") }} +``` + +Custom datetime pattern + +```twig +{{ record.birthdate | format_datetime(pattern="hh 'oclock' a, zzzz") }} +``` + +Calculate real GMT offset + +```twig +{{ "2024-08-11T17:39:00+03" | timezone_offset("Australia/Sydney") }} +``` + +### Lookup Fields + +```twig +{{ record.parentcustomerid.Name }} +{{ record.parentcustomerid.Id }} +``` + +### Choice Fields + +```twig +{{ record | formatted_value("cr1d1_choiceday") }} +``` + +### Currency Fields + +```twig +{{ record | formatted_value("cr1d1_currency") }} +``` + +### Duration Fields + +Convert CRM duration (minutes) → readable format: + +```twig +{% set record=entities.contact["dad5909a-973c-ef11-a316-000d3ad268c1"] %} +{{ record.cr8d6_duration*60 | format_time(pattern: 'mm min. ss sec.') }} +``` + +## Specify fields to display + +When using the `expand` filter, you can specify which fields to display. If you don’t specify any fields, all of them will be selected. Fields are specified as an array or a comma-delimited string. + +```twig +{% set contact = entities.contact['ea8157fa-cc32-ef11-8409-000d3a38d58d']|expand('createdby','fullname,Id') %} + +{% set contact = entities.contact['ea8157fa-cc32-ef11-8409-000d3a38d58d']|expand('createdby',['fullname']) %} + +{% set contact = entities.contac​t['ea8157fa-cc32-ef11-8409-000d3a38d58d']|expand('createdby') %} +``` \ No newline at end of file diff --git a/datapress/using-twig/twig_introduction.md b/datapress/using-twig/twig_introduction.md index 06c59da..71453a2 100644 --- a/datapress/using-twig/twig_introduction.md +++ b/datapress/using-twig/twig_introduction.md @@ -1,6 +1,6 @@ --- -sidebar_position: 1 -title: Using Twig +sidebar_position: 5 +title: Using Twig - old slug: /twig/introduction tags: - Twig diff --git a/datapress/using-twig/twig_overview.md b/datapress/using-twig/twig_overview.md new file mode 100644 index 0000000..3e2d50e --- /dev/null +++ b/datapress/using-twig/twig_overview.md @@ -0,0 +1,23 @@ +--- +sidebar_position: 1 +title: Twig Overview +slug: /twig/overview +tags: [Twig, DataPress] +keywords: [DataPress twig] +--- + +> **Note:** Dataverse Integration has been renamed to **DataPress**. All references will be gradually updated. + +Use **Twig templates** to build custom layouts and display Dataverse data directly inside WordPress. +DataPress extends Twig with additional objects, helpers, and filters to simplify working with Dataverse entities, metadata, user binding, and environment settings. + +## What You Can Do with Twig in DataPress + +- Render Dataverse records in custom layouts. +- Access page-bound records and current user data. +- Query any Dataverse table by logical name and GUID. +- Read site, user, and request context. +- Format dates, currencies, durations, choices, and lookup values. +- Build dynamic forms (including multiple‑choice fields). + +[Refer to the official Twig documentation for templating basics](https://twig.symfony.com/doc/2.x/templates.html) diff --git a/datapress/using-twig/twig_reference.md b/datapress/using-twig/twig_reference.md new file mode 100644 index 0000000..74970f6 --- /dev/null +++ b/datapress/using-twig/twig_reference.md @@ -0,0 +1,35 @@ +--- +sidebar_position: 3 +title: Twig Reference. Capabilities & Limitations +slug: /twig/reference +tags: [Twig, DataPress] +keywords: [DataPress twig reference] +--- + +## Global Objects Overview + +### `binding` — Current Page-Bound Record + +- `is_bound` +- `reference` — lightweight entity reference +- `record` — full entity data (slower) +- `currentrecord` — legacy alias (use only for backward compatibility) + +### `user` — Current User Information + +- `is_bound` +- `reference` +- `record` +- `wp_user` +- `timezone` +- `locale` + +**Performance tip:** prefer `.reference` unless the full record is needed. + +### `entities` — Any Record by Table & GUID + +Example: + +```twig +{{ entities.contact["GUID"]["fullname"] }} +``` From e332eafd314d2d6ca6d70ed9a916464c1e1589dc Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Tue, 27 Jan 2026 21:32:19 +0300 Subject: [PATCH 06/10] change extension --- datapress/Forms/{elementor.mdx => elementor.md} | 0 datapress/addons/{gravity-forms.mdx => gravity-forms.md} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename datapress/Forms/{elementor.mdx => elementor.md} (100%) rename datapress/addons/{gravity-forms.mdx => gravity-forms.md} (100%) diff --git a/datapress/Forms/elementor.mdx b/datapress/Forms/elementor.md similarity index 100% rename from datapress/Forms/elementor.mdx rename to datapress/Forms/elementor.md diff --git a/datapress/addons/gravity-forms.mdx b/datapress/addons/gravity-forms.md similarity index 100% rename from datapress/addons/gravity-forms.mdx rename to datapress/addons/gravity-forms.md From 05fc79e9b4a2ec4e00552b490cddc81a5259a6dc Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Tue, 27 Jan 2026 21:35:13 +0300 Subject: [PATCH 07/10] update redirect in config --- docusaurus.config.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 053e7fd..7e354cf 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -89,7 +89,7 @@ const config: Config = { from: ['/integration-cds/forms'], }, { - to: '/addons/gravity-forms', + to: '/forms/gravity-forms', from: ['/integration-cds/gravity-forms'], }, { @@ -112,10 +112,6 @@ const config: Config = { to: '/binding/fields', from: ['/integration-cds/fields-binding'], }, - { - to: '/forms/gravity-forms', - from: ['/addons/gravity-forms'], - }, ], } ] From 513aad9f51ebd57a8e28eb411e60b01e75c5ef38 Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Wed, 28 Jan 2026 17:15:59 +0300 Subject: [PATCH 08/10] not final option, but styles for tabs are ready --- .../power-apps-forms/forms-capabilities.md | 135 ----- .../power-apps-forms/forms-configuration.md | 136 ----- .../Forms/power-apps-forms/forms-examples.md | 168 ------ .../Forms/power-apps-forms/forms-overview.md | 50 -- .../Forms/power-apps-forms/forms-tabs.mdx | 504 ++++++++++++++++++ datapress/Samples/_category_.json | 2 +- src/components/TabTOC/index.tsx | 93 ++++ src/css/custom.css | 78 +-- 8 files changed, 643 insertions(+), 523 deletions(-) delete mode 100644 datapress/Forms/power-apps-forms/forms-capabilities.md delete mode 100644 datapress/Forms/power-apps-forms/forms-configuration.md delete mode 100644 datapress/Forms/power-apps-forms/forms-examples.md delete mode 100644 datapress/Forms/power-apps-forms/forms-overview.md create mode 100644 datapress/Forms/power-apps-forms/forms-tabs.mdx create mode 100644 src/components/TabTOC/index.tsx diff --git a/datapress/Forms/power-apps-forms/forms-capabilities.md b/datapress/Forms/power-apps-forms/forms-capabilities.md deleted file mode 100644 index c509707..0000000 --- a/datapress/Forms/power-apps-forms/forms-capabilities.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Reference (Capabilities & Limitations) -sidebar_position: 3 -premium: true -slug: /forms/forms-reference -tags: - - Form - - DataPress -keywords: [DataPress forms configuration] ---- - -## Supported controls - -DataPress renders forms close to their Dataverse definitions. - -Supported control types include: - -- Single‑line and multi‑line text -- Email and numeric fields -- Money and integer fields -- Radio buttons and checkboxes -- Date and time pickers -- Lookup fields - ---- - -## Limitations - -### Lookup selection -- Lookup dialogs do **not** support selecting multiple records -- Multi‑select picklists are **not supported** - -### Unsupported composite controls -The following controls are not currently supported: - -- Subgrids -- Maps -- Quick (nested) forms -- Notes, activities, posts, assistant panels - -### Web resources -Custom JavaScript web resources embedded in Dataverse forms are not supported. - -You may still use WordPress‑level CSS and JavaScript to customize appearance and behavior. - ---- - -## Composite columns - -### Full Name (`fullname`) - -`fullname` is a calculated field composed of name attributes. - -If present on the form, DataPress automatically decomposes it into individual controls (such as `firstname` and `lastname`) instead of using a popup editor. - -Microsoft reference: -https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013 - -### Address (`addressN_composite`) - -Address composite columns are handled similarly and decomposed into their underlying attributes. - -The plugin allows configuring which attributes are used for Full Name and Address fields. - ---- - -## Date and time behavior - -Dataverse supports multiple date behaviors: - -- **User Local**: Adjusts values based on the user’s time zone. -- **Time Zone Independent**: No time zone conversion is applied. -- **Date Only**: Displays only the date portion without time zone conversion. - -Documentation: -https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field - -### Time zone handling - -For **User Local** fields, displayed values depend on: - -- `ICDS_DATETIME_VALUE` setting (Legacy или Local) -- User time zone - -Example: - -| Stored Value | Timezone | Displayed Value | -|-------------|----------|----------------| -| 5/15/2028 03:00 AM | UTC+2 | 5/15/2028 05:00 AM | -| 5/15/2028 03:00 AM | UTC‑4 | 5/14/2028 11:00 PM | - -Anonymous visitors see values using the WordPress site time zone. - ---- - -## Lookup behavior and security - -### Display modes - -1. **Dialog** — searchable modal lookup -2. **Dropdown** — filtered list with optional search -3. **Select** — simple dropdown (≈ 50 options) - ---- - -### Security measures - -To prevent unauthorized data access: - -1. WordPress nonces are enforced - https://developer.wordpress.org/apis/security/nonces/ - -2. Access can be restricted using a filter hook: - -```php -add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ - if ( !is_user_logged_in() ) { - return false; - } - return $isAllowed; -}, 10, 3 ); -``` - -3. FetchXML templates can filter lookup results. - -## Unsupported Whole Number Formats -These Dataverse formats are not supported: - -Language code -Duration -Time zone - -## Decimal & Float Fields -Handled according to Dataverse settings (min/max, decimals). -[Reference](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) diff --git a/datapress/Forms/power-apps-forms/forms-configuration.md b/datapress/Forms/power-apps-forms/forms-configuration.md deleted file mode 100644 index 28470b8..0000000 --- a/datapress/Forms/power-apps-forms/forms-configuration.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: Form Configuration -sidebar_position: 2 -premium: true -slug: /forms/forms-configuration -tags: - - Form - - DataPress -keywords: [DataPress forms configuration] ---- - -## Before you begin - -Make sure that: - -1. The premium extension is active and licensed -2. A Dataverse (model‑driven) form already exists -3. You know whether the form should create, update, or display records - ---- - -## Creating a form registration - -To start collecting data, you must create a form registration. - -1. Open the plugin dashboard -2. Go to **Forms** -3. Click **Create new** - -Fill in the following fields: - -- **Form Name** -- **CRM Form** — select a Dataverse form -- **Mode** — choose how data is processed - -Click **Create** to save the registration. - ---- - -## Form modes - -### Create a new record - -Each submission creates a **new Dataverse record**. - -### Update or create a record - -The form uses table binding to: - -- load an existing record into the form -- update it on submission - -If no record is found, a new one is created. - -### Read‑only - -Table binding is used to load a record, but the form cannot be edited or submitted. - ---- - -## Allow deleting records - -When using **Update** or **Read‑only** mode, you can enable record deletion: - -- Enable **Allow deleting the record** - -⚠️ To prevent unauthorized deletes, implement the filter: - -`integration-cds/forms/authorize-delete` - -Parameters passed to the filter: - -- `$isAuthorized` — whether deletion is allowed -- `$reg` — the active form registration -- `$target` — the record being deleted (or `NULL`) - -Return `false` if deletion should not be allowed. - ---- - -## Required and optional attributes - -Dataverse defines required fields at the form level. -DataPress allows additional customization **without modifying the Dataverse form**. - -To change requiredness: - -1. Select attributes in **Attributes** -2. Move them to: - - **Required →** - - **Optional →** -3. Remove items by double‑clicking or using **Remove selected** - ---- - -## Global settings overrides - -Each form registration can override global form behavior, including: - -- reCAPTCHA -- Front‑end dependencies -- Form messages and behavior -- Full Name / Address decomposition - ---- - -## Front‑end dependencies - -Power Apps forms require the following libraries: - -- **Bootstrap 4** — https://getbootstrap.com/ -- **Font Awesome 5** — https://fontawesome.com/ - -DataPress ships custom, isolated builds of these libraries. -You may disable them if your WordPress theme already includes compatible versions. - ---- - -## reCAPTCHA support - -Dataverse forms integrate with reCAPTCHA. - -[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) - ---- - -## Adding the form to a page - -Use the Twig tag and the form registration ID: - -```twig -{% form id=42 %} - -This renders the form and starts accepting submissions. - ---- \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-examples.md b/datapress/Forms/power-apps-forms/forms-examples.md deleted file mode 100644 index 2cf0389..0000000 --- a/datapress/Forms/power-apps-forms/forms-examples.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -title: Forms Examples -sidebar_position: 4 -premium: true -slug: /forms/forms-examples -tags: - - Form - - DataPress - - Examples -keywords: [DataPress forms, Power Apps Forms examples, Dataverse forms examples] ---- - -# Examples - -This page provides copy/paste examples for rendering **Power Apps / Dataverse forms** on WordPress using **DataPress** form registrations. - -> **Prerequisite:** You must create a **form registration** in the plugin admin area. -> You will need its registration ID (for example, `id=42`). - ---- - -## Render a basic form - -Render a form using its **form registration ID**: - -```twig -{% form id=42 %} -``` - -## Render a form with default field values -Use the defaults attribute to pre-populate fields: - -``` -{% form id=42 defaults={ - "leadsourcecode": 8, - "donotfax": true, - "address1_country": "United States" -} %} -``` - -**Notes:** - -- Defaults values must match Dataverse attribute logical names. -- Boolean fields accept true/false. -- For choice fields, pass the numeric option value (see next section). - -## Set a default value for a Choice (Option Set) field - -For choice fields, pass the integer value of the option. -**Example:** set gendercode to “Male” where “Male” has value 1: - -``` -{% form id=4 defaults={"gendercode": 1} %} -``` - -You can find label/value mapping in Dataverse column settings or metadata. - -## Set a default value for a Multi-Select Choice field - -Multi-select values are passed as a comma-separated string: - -``` - -{% form id=2 defaults={"multipleChoiceColumnName": "3,4"} %} -``` - -### Pre-select lead source - -``` -{% form id=42 defaults={"leadsourcecode": 8} %} -``` - -## Redirect after submit and capture the created record GUID - -When a record is successfully created, you can inject the record GUID into a redirect URL using %s. -Example: - -- Redirect setting: /?id=%s -- After create: /?id=00000000-0000-0000-0000-000000000000 - -Use this to forward users to a “Thank you” page, a confirmation screen, or a details page. - -## Set default values via Admin UI (no Twig changes) - -You can define default values inside the Dataverse Admin Area: - -1. Choose the form -2. Go to Fields Customization -3. Find Default Field Values -4. Add field name + default value - -This method supports defaults for: - -- text/number fields -- choice fields -- lookup fields (when configured) - -## Deletion security — authorize delete requests - -If your form registration enables **Allow deleting the record**, you should guard it with the `integration-cds/forms/authorize-delete filter`. - -Add to functions.php: - -``` -add_filter( 'integration-cds/forms/authorize-delete', function( $isAuthorized, $reg, $target ) { - // Reject if no record was resolved - if ( $target === null ) { - return false; - } - - // Example rule: only signed-in users can delete - if ( ! is_user_logged_in() ) { - return false; - } - - // You can add more rules here: - // - check user role/capability - // - check ownership against $target - // - check registration ID via $reg - - return $isAuthorized; -}, 10, 3 ); -``` - -## Lookup security — restrict lookup access to signed-in users - -Lookups use a REST API endpoint and should be protected to avoid accidental data exposure. -The snippet below restricts lookups to **authenticated users only**. - -Add it to the active theme’s functions.php: - -``` -add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ) { - if ( ! is_user_logged_in() ) { - return false; - } - - return $isAllowed; -}, 10, 3 ); -``` - -## Date & Time behavior — what users will see - -Dataverse fields can behave as: - -**User Local**: value converts to user timezone -**Time Zone Independent**: no conversion -**Date Only**: date without time conversion - -Example value stored: 5/15/2028 03:00:00 AM (User Local field) - -If timezone is UTC + 2, users see 5/15/2028 05:00:00 AM -If timezone is UTC - 4, users see 5/14/2028 11:00:00 PM - -Set timezone per WordPress user - -Users → Edit -Dataverse Extra Fields -Choose Timezone - -Anonymous visitors use the site timezone configured in: -Settings → General → - -## Troubleshooting tips (quick) - -- If the premium plugin is not licensed, forms may fail with syntax errors — verify licensing first. -- If your theme already includes Bootstrap/Font Awesome, consider disabling DataPress dependencies to avoid conflicts. -- If lookup results look too broad, use view filters and/or FetchXML templates in conditional access settings. \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-overview.md b/datapress/Forms/power-apps-forms/forms-overview.md deleted file mode 100644 index d2a0688..0000000 --- a/datapress/Forms/power-apps-forms/forms-overview.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Power Apps Forms -sidebar_position: 1 -premium: true -slug: /forms/forms-overview -tags: - - Form - - DataPress -keywords: [DataPress forms] ---- - -:::note -The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. -All references in the documentation and user interface will be gradually updated. -::: - -

    -Capture leads, feedback, and other data from your website using forms designed in Power Apps and Dynamics 365. -

    - -## What are Power Apps Forms in DataPress? - -**Power Apps Forms** allow you to display Dataverse (Dynamics 365) forms on your WordPress website and submit user input directly back to Dataverse. - -With DataPress, you can: - -- Render Dataverse forms on public or protected pages -- Create new records from form submissions -- Update existing records using table binding -- Display data in a read‑only mode - -## Key concept: Form Registration - -To use a Dataverse form on a WordPress page, DataPress introduces the concept of a **form registration**. - -A form registration acts as a proxy between WordPress and Dataverse. It defines: - -- Which Dataverse form to display -- How the form handles submissions -- Which attributes are required or optional -- Which form‑level settings override global defaults - -## How forms are rendered on the website - -Forms are embedded into pages using the Twig templating engine. - -```twig -{% form id=42 %} -``` - diff --git a/datapress/Forms/power-apps-forms/forms-tabs.mdx b/datapress/Forms/power-apps-forms/forms-tabs.mdx new file mode 100644 index 0000000..fa72256 --- /dev/null +++ b/datapress/Forms/power-apps-forms/forms-tabs.mdx @@ -0,0 +1,504 @@ +--- +title: Power Apps Forms - tabs +sidebar_position: 5 +premium: true +slug: /forms/forms-tabs +tags: + - Form + - DataPress +keywords: [DataPress forms] +hide_table_of_contents: true +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import { TabTOCBrowserOnly } from '@site/src/components/TabTOC' + +
    +
    + + + + + +# Overview + +:::note +The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. +All references in the documentation and user interface will be gradually updated. +::: + +

    +Capture leads, feedback, and other data from your website using forms designed in Power Apps and Dynamics 365. +

    + +## What are Power Apps Forms in DataPress? + +**Power Apps Forms** allow you to display Dataverse (Dynamics 365) forms on your WordPress website and submit user input directly back to Dataverse. + +With DataPress, you can: + +- Render Dataverse forms on public or protected pages +- Create new records from form submissions +- Update existing records using table binding +- Display data in a read‑only mode + +## Key concept: Form Registration + +To use a Dataverse form on a WordPress page, DataPress introduces the concept of a **form registration**. + +A form registration acts as a proxy between WordPress and Dataverse. It defines: + +- Which Dataverse form to display +- How the form handles submissions +- Which attributes are required or optional +- Which form‑level settings override global defaults + +## How forms are rendered on the website + +Forms are embedded into pages using the Twig templating engine. + +```twig +{% form id=42 %} +``` + + +
    + + + +# Configuration + +## Before you begin + +Make sure that: + +1. The premium extension is active and licensed +2. A Dataverse (model‑driven) form already exists +3. You know whether the form should create, update, or display records + +--- + +## Creating a form registration + +To start collecting data, you must create a form registration. + +1. Open the plugin dashboard +2. Go to **Forms** +3. Click **Create new** + +Fill in the following fields: + +- **Form Name** +- **CRM Form** — select a Dataverse form +- **Mode** — choose how data is processed + +Click **Create** to save the registration. + +--- + +## Form modes + +### Create a new record + +Each submission creates a **new Dataverse record**. + +### Update or create a record + +The form uses table binding to: + +- load an existing record into the form +- update it on submission + +If no record is found, a new one is created. + +### Read‑only + +Table binding is used to load a record, but the form cannot be edited or submitted. + +--- + +## Allow deleting records + +When using **Update** or **Read‑only** mode, you can enable record deletion: + +- Enable **Allow deleting the record** + +⚠️ To prevent unauthorized deletes, implement the filter: + +`integration-cds/forms/authorize-delete` + +Parameters passed to the filter: + +- `$isAuthorized` — whether deletion is allowed +- `$reg` — the active form registration +- `$target` — the record being deleted (or `NULL`) + +Return `false` if deletion should not be allowed. + +--- + +## Required and optional attributes + +Dataverse defines required fields at the form level. +DataPress allows additional customization **without modifying the Dataverse form**. + +To change requiredness: + +1. Select attributes in **Attributes** +2. Move them to: + - **Required →** + - **Optional →** +3. Remove items by double‑clicking or using **Remove selected** + +--- + +## Global settings overrides + +Each form registration can override global form behavior, including: + +- reCAPTCHA +- Front‑end dependencies +- Form messages and behavior +- Full Name / Address decomposition + +--- + +## Front‑end dependencies + +Power Apps forms require the following libraries: + +- **Bootstrap 4** — https://getbootstrap.com/ +- **Font Awesome 5** — https://fontawesome.com/ + +DataPress ships custom, isolated builds of these libraries. +You may disable them if your WordPress theme already includes compatible versions. + +--- + +## reCAPTCHA support + +Dataverse forms integrate with reCAPTCHA. + +[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) + +--- + +## Adding the form to a page + +Use the Twig tag and the form registration ID: + +```twig +{% form id=42 %} +``` + +This renders the form and starts accepting submissions. + + + + + +# Notes (capabilities & limitations) + +## Supported controls + +DataPress renders forms close to their Dataverse definitions. + +Supported control types include: + +- Single‑line and multi‑line text +- Email and numeric fields +- Money and integer fields +- Radio buttons and checkboxes +- Date and time pickers +- Lookup fields + +--- + +## Limitations + +### Lookup selection +- Lookup dialogs do **not** support selecting multiple records +- Multi‑select picklists are **not supported** + +### Unsupported composite controls +The following controls are not currently supported: + +- Subgrids +- Maps +- Quick (nested) forms +- Notes, activities, posts, assistant panels + +### Web resources +Custom JavaScript web resources embedded in Dataverse forms are not supported. + +You may still use WordPress‑level CSS and JavaScript to customize appearance and behavior. + +--- + +## Composite columns + +### Full Name (`fullname`) + +`fullname` is a calculated field composed of name attributes. + +If present on the form, DataPress automatically decomposes it into individual controls (such as `firstname` and `lastname`) instead of using a popup editor. + +Microsoft reference: +https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013 + +### Address (`addressN_composite`) + +Address composite columns are handled similarly and decomposed into their underlying attributes. + +The plugin allows configuring which attributes are used for Full Name and Address fields. + +--- + +## Date and time behavior + +Dataverse supports multiple date behaviors: + +- **User Local**: Adjusts values based on the user’s time zone. +- **Time Zone Independent**: No time zone conversion is applied. +- **Date Only**: Displays only the date portion without time zone conversion. + +Documentation: +https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field + +### Time zone handling + +For **User Local** fields, displayed values depend on: + +- `ICDS_DATETIME_VALUE` setting (Legacy или Local) +- User time zone + +Example: + +| Stored Value | Timezone | Displayed Value | +|-------------|----------|----------------| +| 5/15/2028 03:00 AM | UTC+2 | 5/15/2028 05:00 AM | +| 5/15/2028 03:00 AM | UTC‑4 | 5/14/2028 11:00 PM | + +Anonymous visitors see values using the WordPress site time zone. + +--- + +## Lookup behavior and security + +### Display modes + +1. **Dialog** — searchable modal lookup +2. **Dropdown** — filtered list with optional search +3. **Select** — simple dropdown (≈ 50 options) + +--- + +### Security measures + +To prevent unauthorized data access: + +1. WordPress nonces are enforced + https://developer.wordpress.org/apis/security/nonces/ + +2. Access can be restricted using a filter hook: + +```php +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ + if ( !is_user_logged_in() ) { + return false; + } + return $isAllowed; +}, 10, 3 ); +``` + +3. FetchXML templates can filter lookup results. + +## Unsupported Whole Number Formats +These Dataverse formats are not supported: + +Language code +Duration +Time zone + +## Decimal & Float Fields +Handled according to Dataverse settings (min/max, decimals). +[Reference](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) + + + + + +# Examples + +This page provides copy/paste examples for rendering **Power Apps / Dataverse forms** on WordPress using **DataPress** form registrations. + +> **Prerequisite:** You must create a **form registration** in the plugin admin area. +> You will need its registration ID (for example, `id=42`). + +--- + +## Render a basic form + +Render a form using its **form registration ID**: + +```twig +{% form id=42 %} +``` + +## Render a form with default field values +Use the defaults attribute to pre-populate fields: + +``` +{% form id=42 defaults={ + "leadsourcecode": 8, + "donotfax": true, + "address1_country": "United States" +} %} +``` + +**Notes:** + +- Defaults values must match Dataverse attribute logical names. +- Boolean fields accept true/false. +- For choice fields, pass the numeric option value (see next section). + +## Set a default value for a Choice (Option Set) field + +For choice fields, pass the integer value of the option. +**Example:** set gendercode to “Male” where “Male” has value 1: + +``` +{% form id=4 defaults={"gendercode": 1} %} +``` + +You can find label/value mapping in Dataverse column settings or metadata. + +## Set a default value for a Multi-Select Choice field + +Multi-select values are passed as a comma-separated string: + +``` + +{% form id=2 defaults={"multipleChoiceColumnName": "3,4"} %} +``` + +### Pre-select lead source + +``` +{% form id=42 defaults={"leadsourcecode": 8} %} +``` + +## Redirect after submit and capture the created record GUID + +When a record is successfully created, you can inject the record GUID into a redirect URL using %s. +Example: + +- Redirect setting: /?id=%s +- After create: /?id=00000000-0000-0000-0000-000000000000 + +Use this to forward users to a “Thank you” page, a confirmation screen, or a details page. + +## Set default values via Admin UI (no Twig changes) + +You can define default values inside the Dataverse Admin Area: + +1. Choose the form +2. Go to Fields Customization +3. Find Default Field Values +4. Add field name + default value + +This method supports defaults for: + +- text/number fields +- choice fields +- lookup fields (when configured) + +## Deletion security — authorize delete requests + +If your form registration enables **Allow deleting the record**, you should guard it with the `integration-cds/forms/authorize-delete filter`. + +Add to functions.php: + +``` +add_filter( 'integration-cds/forms/authorize-delete', function( $isAuthorized, $reg, $target ) { + // Reject if no record was resolved + if ( $target === null ) { + return false; + } + + // Example rule: only signed-in users can delete + if ( ! is_user_logged_in() ) { + return false; + } + + // You can add more rules here: + // - check user role/capability + // - check ownership against $target + // - check registration ID via $reg + + return $isAuthorized; +}, 10, 3 ); +``` + +## Lookup security — restrict lookup access to signed-in users + +Lookups use a REST API endpoint and should be protected to avoid accidental data exposure. +The snippet below restricts lookups to **authenticated users only**. + +Add it to the active theme’s functions.php: + +``` +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ) { + if ( ! is_user_logged_in() ) { + return false; + } + + return $isAllowed; +}, 10, 3 ); +``` + +## Date & Time behavior — what users will see + +Dataverse fields can behave as: + +**User Local**: value converts to user timezone +**Time Zone Independent**: no conversion +**Date Only**: date without time conversion + +Example value stored: 5/15/2028 03:00:00 AM (User Local field) + +If timezone is UTC + 2, users see 5/15/2028 05:00:00 AM +If timezone is UTC - 4, users see 5/14/2028 11:00:00 PM + +Set timezone per WordPress user + +Users → Edit +Dataverse Extra Fields +Choose Timezone + +Anonymous visitors use the site timezone configured in: +Settings → General → + +## Troubleshooting tips (quick) + +- If the premium plugin is not licensed, forms may fail with syntax errors — verify licensing first. +- If your theme already includes Bootstrap/Font Awesome, consider disabling DataPress dependencies to avoid conflicts. +- If lookup results look too broad, use view filters and/or FetchXML templates in conditional access settings. + + + +
    + + +
    + +
    + +
    +
    diff --git a/datapress/Samples/_category_.json b/datapress/Samples/_category_.json index e8cf522..a9e7df4 100644 --- a/datapress/Samples/_category_.json +++ b/datapress/Samples/_category_.json @@ -1,5 +1,5 @@ { - "label": "Samples", + "label": "Reference Implementations", "position": 16, "link": { "type": "generated-index" diff --git a/src/components/TabTOC/index.tsx b/src/components/TabTOC/index.tsx new file mode 100644 index 0000000..18c4190 --- /dev/null +++ b/src/components/TabTOC/index.tsx @@ -0,0 +1,93 @@ +import React, {useEffect, useMemo, useState} from 'react'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +import Link from '@docusaurus/Link'; + +type HeadingItem = { + id: string; + value: string; + level: number; // 2..4 +}; + +function extractHeadingsFrom(container: HTMLElement, minLevel = 2, maxLevel = 4): HeadingItem[] { + const headings = Array.from(container.querySelectorAll( + Array.from({length: maxLevel - minLevel + 1}, (_, i) => `h${i + minLevel}`).join(',') + )); + + return headings + .filter(h => !!h.id) // docusaurus/remark обычно ставит id + .map(h => ({ + id: h.id, + value: h.innerText.trim(), + level: Number(h.tagName.substring(1)), + })); +} + +export default function TabTOC() { + const [items, setItems] = useState([]); + + useEffect(() => { + // Находим активный tabpanel (Tabs из @theme/Tabs рендерит их как role="tabpanel") + const update = () => { + const panels = Array.from(document.querySelectorAll('[role="tabpanel"]')); + // Активная панель — та, которая не скрыта (обычно невидимые имеют hidden или aria-hidden) + const active = panels.find(p => !p.hasAttribute('hidden') && p.getAttribute('aria-hidden') !== 'true'); + if (!active) { + setItems([]); + return; + } + const headings = extractHeadingsFrom(active, 2, 4); + setItems(headings); + }; + + update(); + + // Перестраиваем TOC при клике по табам и при навигации по якорям + const clickHandler = (e: Event) => { + const target = e.target as HTMLElement | null; + if (!target) return; + if (target.closest('[role="tab"]')) { + // Немного отложим, чтобы вкладка успела смениться + setTimeout(update, 0); + } + }; + + document.addEventListener('click', clickHandler); + window.addEventListener('hashchange', update); + + // На всякий случай перестроим на ресайз (иногда меняются скрытые статусы) + window.addEventListener('resize', update); + + return () => { + document.removeEventListener('click', clickHandler); + window.removeEventListener('hashchange', update); + window.removeEventListener('resize', update); + }; + }, []); + + if (!items.length) { + return null; + } + + // Строим вложенные уровни (h2 → h3 → h4) простым списком с отступами + return ( + + ); +} + +// Обёртка для SSR +export function TabTOCBrowserOnly() { + return ( + + {() => } + + ); +} \ No newline at end of file diff --git a/src/css/custom.css b/src/css/custom.css index a98a757..011ac19 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -272,12 +272,6 @@ span[itemprop="name"] { font-weight: 600 !important; } -/* Limit content width for better readability on long pages */ -.markdown, -.theme-doc-markdown { - max-width: 780px; -} - /* Section headers (H2) */ .markdown h2 { margin-top: 3.5rem; @@ -335,31 +329,11 @@ span[itemprop="name"] { --doc-content-max-width: 780px; } -.theme-doc-page .container, -.theme-doc-page .container-fluid { - justify-content: center; -} - -.theme-doc-page .col.col--7, -.theme-doc-page .col.col--8, -.theme-doc-page .col.col--9, -.theme-doc-page .docItemCol { - max-width: var(--doc-content-max-width); - width: 100%; - margin-left: auto; - margin-right: auto; -} - .theme-doc-markdown, .markdown { max-width: var(--doc-content-max-width); - margin-left: auto; - margin-right: auto; } -.theme-doc-page .row { - justify-content: center; -} /* Desktop TOC */ .theme-doc-toc-desktop, @@ -374,16 +348,54 @@ span[itemprop="name"] { font-weight: 500; } -.theme-doc-toc-desktop .table-of-contents { - padding-left: 0.25rem; -} - .markdown > h2 + p { margin-top: 1.2rem; } +.tab-toc { + position: sticky; + top: var(--ifm-navbar-height); + max-height: calc(100vh - var(--ifm-navbar-height)); + overflow: auto; + padding: 0.5rem 0 0.5rem 0.25rem; + margin-bottom: 1rem; + border-left: 2px solid var(--ifm-toc-border-color, #eaecef); +} + +.tab-toc strong { + display: block; + font-size: 0.9rem; + margin: 0 0 0.5rem 0.5rem; + color: var(--ifm-color-emphasis-700); +} + +.tab-toc-list { + list-style: none; + padding-left: 0.5rem; + margin: 0; +} + +.tab-toc-list li { + margin: 0.2rem 0; +} + +.tab-toc-list li.level-2 { margin-left: 0.25rem; } +.tab-toc-list li.level-3 { margin-left: 1rem; font-size: 0.95em; } +.tab-toc-list li.level-4 { margin-left: 1.75rem; font-size: 0.9em; } + .theme-doc-toc-desktop { - width: 350px; - max-width: 300px; - flex: 0 0 300px; + width: var(--doc-toc-width); + flex: 0 0 var(--doc-toc-width); + max-width: var(--doc-toc-width); } + +@media (max-width: 997px) { + .theme-doc-toc-desktop { + display: none; + } + + .theme-doc-markdown, + .markdown { + max-width: 100%; + } +} \ No newline at end of file From 369a3a7041acbe00d03a619efe1eb20f79e7a940 Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Wed, 28 Jan 2026 17:34:39 +0300 Subject: [PATCH 09/10] pdate custom.css --- .../Forms/power-apps-forms/forms-tabs.mdx | 4 +++ src/css/custom.css | 30 +++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/datapress/Forms/power-apps-forms/forms-tabs.mdx b/datapress/Forms/power-apps-forms/forms-tabs.mdx index fa72256..9c98318 100644 --- a/datapress/Forms/power-apps-forms/forms-tabs.mdx +++ b/datapress/Forms/power-apps-forms/forms-tabs.mdx @@ -14,6 +14,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import { TabTOCBrowserOnly } from '@site/src/components/TabTOC' +
    +
    + +
    \ No newline at end of file diff --git a/src/css/custom.css b/src/css/custom.css index 011ac19..8c340ab 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -1,7 +1,7 @@ :root { --ifm-color-primary: #0077c2 !important; --ifm-color-primary-dark: #006bb0; - --ifm-color-primary-darker: #004080; /* заменено для контраста */ + --ifm-color-primary-darker: #004080; --ifm-color-primary-darkest: #004f8a; --ifm-color-primary-light: #48D0FF !important; --ifm-color-primary-lighter: #48D0FF; @@ -71,7 +71,7 @@ article a:not(.menu__link):not(.navbar__link):not(.breadcrumbs__link):not(.menu_ p a[target="_blank"], details summary, span[itemprop="name"] { - color: #004080; /* тёмный оттенок для контраста */ + color: #004080; font-weight: 700; } @@ -81,7 +81,7 @@ article a:hover { /* External links in paragraphs */ p a[target="_blank"] { - color: #004080 !important; /* исправлено */ + color: #004080 !important; font-weight: 700; text-decoration: underline; } @@ -159,7 +159,7 @@ details summary { position: relative; padding-left: 24px; margin-bottom: 0.5rem; - color: #004080; /* исправлено */ + color: #004080; } details summary:hover { @@ -389,13 +389,17 @@ span[itemprop="name"] { max-width: var(--doc-toc-width); } -@media (max-width: 997px) { - .theme-doc-toc-desktop { - display: none; - } - .theme-doc-markdown, - .markdown { - max-width: 100%; - } -} \ No newline at end of file +.tabs-container { + width: 100%; +} + +.tab-item, +.tabs__content { + width: 100%; +} + +.tabs__content > * { + max-width: var(--doc-content-max-width); +} + From 685d9275e8d49512581f250267af749c922f4687 Mon Sep 17 00:00:00 2001 From: Yuliya Pazniak Date: Mon, 9 Feb 2026 19:52:04 +0300 Subject: [PATCH 10/10] remove tabs --- .../power-apps-forms/forms-capabilities.md | 135 +++++ .../power-apps-forms/forms-configuration.md | 135 +++++ .../Forms/power-apps-forms/forms-examples.md | 165 ++++++ .../Forms/power-apps-forms/forms-overview.md | 49 ++ .../Forms/power-apps-forms/forms-tabs.mdx | 508 ------------------ datapress/Forms/power-apps-forms/forms.md | 251 --------- src/components/TabTOC/index.tsx | 93 ---- src/css/custom.css | 73 ++- 8 files changed, 551 insertions(+), 858 deletions(-) create mode 100644 datapress/Forms/power-apps-forms/forms-capabilities.md create mode 100644 datapress/Forms/power-apps-forms/forms-configuration.md create mode 100644 datapress/Forms/power-apps-forms/forms-examples.md create mode 100644 datapress/Forms/power-apps-forms/forms-overview.md delete mode 100644 datapress/Forms/power-apps-forms/forms-tabs.mdx delete mode 100644 datapress/Forms/power-apps-forms/forms.md delete mode 100644 src/components/TabTOC/index.tsx diff --git a/datapress/Forms/power-apps-forms/forms-capabilities.md b/datapress/Forms/power-apps-forms/forms-capabilities.md new file mode 100644 index 0000000..df04f48 --- /dev/null +++ b/datapress/Forms/power-apps-forms/forms-capabilities.md @@ -0,0 +1,135 @@ +--- +title: Notes (capabilities & limitations) +sidebar_position: 3 +premium: true +slug: /forms/forms-reference +tags: + - Form + - DataPress +keywords: [DataPress forms configuration] +--- + +## Supported controls + +DataPress renders forms close to their Dataverse definitions. + +Supported control types include: + +- Single‑line and multi‑line text +- Email and numeric fields +- Money and integer fields +- Radio buttons and checkboxes +- Date and time pickers +- Lookup fields + +--- + +## Limitations + +### Lookup selection +- Lookup dialogs do **not** support selecting multiple records +- Multi‑select picklists are **not supported** + +### Unsupported composite controls +The following controls are not currently supported: + +- Subgrids +- Maps +- Quick (nested) forms +- Notes, activities, posts, assistant panels + +### Web resources +Custom JavaScript web resources embedded in Dataverse forms are not supported. + +You may still use WordPress‑level CSS and JavaScript to customize appearance and behavior. + +--- + +## Composite columns + +### Full Name (`fullname`) + +`fullname` is a calculated field composed of name attributes. + +If present on the form, DataPress automatically decomposes it into individual controls (such as `firstname` and `lastname`) instead of using a popup editor. + +Microsoft reference: +https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013 + +### Address (`addressN_composite`) + +Address composite columns are handled similarly and decomposed into their underlying attributes. + +The plugin allows configuring which attributes are used for Full Name and Address fields. + +--- + +## Date and time behavior + +Dataverse supports multiple date behaviors: + +- **User Local**: Adjusts values based on the user’s time zone. +- **Time Zone Independent**: No time zone conversion is applied. +- **Date Only**: Displays only the date portion without time zone conversion. + +Documentation: +https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field + +### Time zone handling + +For **User Local** fields, displayed values depend on: + +- `ICDS_DATETIME_VALUE` setting (Legacy или Local) +- User time zone + +Example: + +| Stored Value | Timezone | Displayed Value | +|-------------|----------|----------------| +| 5/15/2028 03:00 AM | UTC+2 | 5/15/2028 05:00 AM | +| 5/15/2028 03:00 AM | UTC‑4 | 5/14/2028 11:00 PM | + +Anonymous visitors see values using the WordPress site time zone. + +--- + +## Lookup behavior and security + +### Display modes + +1. **Dialog** — searchable modal lookup +2. **Dropdown** — filtered list with optional search +3. **Select** — simple dropdown (≈ 50 options) + +--- + +### Security measures + +To prevent unauthorized data access: + +1. WordPress nonces are enforced + https://developer.wordpress.org/apis/security/nonces/ + +2. Access can be restricted using a filter hook: + +```php +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ + if ( !is_user_logged_in() ) { + return false; + } + return $isAllowed; +}, 10, 3 ); +``` + +3. FetchXML templates can filter lookup results. + +## Unsupported Whole Number Formats +These Dataverse formats are not supported: + +Language code +Duration +Time zone + +## Decimal & Float Fields +Handled according to Dataverse settings (min/max, decimals). +[Reference](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-configuration.md b/datapress/Forms/power-apps-forms/forms-configuration.md new file mode 100644 index 0000000..3fd32a8 --- /dev/null +++ b/datapress/Forms/power-apps-forms/forms-configuration.md @@ -0,0 +1,135 @@ +--- +title: Form Configuration +sidebar_position: 2 +premium: true +slug: /forms/forms-configuration +tags: + - Form + - DataPress +keywords: [DataPress forms configuration] +--- + +## Before you begin + +Make sure that: + +1. The premium extension is active and licensed +2. A Dataverse (model‑driven) form already exists +3. You know whether the form should create, update, or display records + +--- + +## Creating a form registration + +To start collecting data, you must create a form registration. + +1. Open the plugin dashboard +2. Go to **Forms** +3. Click **Create new** + +Fill in the following fields: + +- **Form Name** +- **CRM Form** — select a Dataverse form +- **Mode** — choose how data is processed + +Click **Create** to save the registration. + +--- + +## Form modes + +### Create a new record + +Each submission creates a **new Dataverse record**. + +### Update or create a record + +The form uses table binding to: + +- load an existing record into the form +- update it on submission + +If no record is found, a new one is created. + +### Read‑only + +Table binding is used to load a record, but the form cannot be edited or submitted. + +--- + +## Allow deleting records + +When using **Update** or **Read‑only** mode, you can enable record deletion: + +- Enable **Allow deleting the record** + +⚠️ To prevent unauthorized deletes, implement the filter: + +`integration-cds/forms/authorize-delete` + +Parameters passed to the filter: + +- `$isAuthorized` — whether deletion is allowed +- `$reg` — the active form registration +- `$target` — the record being deleted (or `NULL`) + +Return `false` if deletion should not be allowed. + +--- + +## Required and optional attributes + +Dataverse defines required fields at the form level. +DataPress allows additional customization **without modifying the Dataverse form**. + +To change requiredness: + +1. Select attributes in **Attributes** +2. Move them to: + - **Required →** + - **Optional →** +3. Remove items by double‑clicking or using **Remove selected** + +--- + +## Global settings overrides + +Each form registration can override global form behavior, including: + +- reCAPTCHA +- Front‑end dependencies +- Form messages and behavior +- Full Name / Address decomposition + +--- + +## Front‑end dependencies + +Power Apps forms require the following libraries: + +- **Bootstrap 4** — https://getbootstrap.com/ +- **Font Awesome 5** — https://fontawesome.com/ + +DataPress ships custom, isolated builds of these libraries. +You may disable them if your WordPress theme already includes compatible versions. + +--- + +## reCAPTCHA support + +Dataverse forms integrate with reCAPTCHA. + +[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) + +--- + +## Adding the form to a page + +Use the Twig tag and the form registration ID: + +```twig +{% form id=42 %} +``` + +This renders the form and starts accepting submissions. \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-examples.md b/datapress/Forms/power-apps-forms/forms-examples.md new file mode 100644 index 0000000..b85e62b --- /dev/null +++ b/datapress/Forms/power-apps-forms/forms-examples.md @@ -0,0 +1,165 @@ +--- +title: Forms Examples +sidebar_position: 4 +premium: true +slug: /forms/forms-examples +tags: + - Form + - DataPress + - Examples +keywords: [DataPress forms, Power Apps Forms examples, Dataverse forms examples] +--- +This page provides copy/paste examples for rendering **Power Apps / Dataverse forms** on WordPress using **DataPress** form registrations. + +> **Prerequisite:** You must create a **form registration** in the plugin admin area. +> You will need its registration ID (for example, `id=42`). + +--- + +## Render a basic form + +Render a form using its **form registration ID**: + +```twig +{% form id=42 %} +``` + +## Render a form with default field values +Use the defaults attribute to pre-populate fields: + +``` +{% form id=42 defaults={ + "leadsourcecode": 8, + "donotfax": true, + "address1_country": "United States" +} %} +``` + +**Notes:** + +- Defaults values must match Dataverse attribute logical names. +- Boolean fields accept true/false. +- For choice fields, pass the numeric option value (see next section). + +## Set a default value for a Choice (Option Set) field + +For choice fields, pass the integer value of the option. +**Example:** set gendercode to “Male” where “Male” has value 1: + +``` +{% form id=4 defaults={"gendercode": 1} %} +``` + +You can find label/value mapping in Dataverse column settings or metadata. + +## Set a default value for a Multi-Select Choice field + +Multi-select values are passed as a comma-separated string: + +``` + +{% form id=2 defaults={"multipleChoiceColumnName": "3,4"} %} +``` + +### Pre-select lead source + +``` +{% form id=42 defaults={"leadsourcecode": 8} %} +``` + +## Redirect after submit and capture the created record GUID + +When a record is successfully created, you can inject the record GUID into a redirect URL using %s. +Example: + +- Redirect setting: /?id=%s +- After create: /?id=00000000-0000-0000-0000-000000000000 + +Use this to forward users to a “Thank you” page, a confirmation screen, or a details page. + +## Set default values via Admin UI (no Twig changes) + +You can define default values inside the Dataverse Admin Area: + +1. Choose the form +2. Go to Fields Customization +3. Find Default Field Values +4. Add field name + default value + +This method supports defaults for: + +- text/number fields +- choice fields +- lookup fields (when configured) + +## Deletion security — authorize delete requests + +If your form registration enables **Allow deleting the record**, you should guard it with the `integration-cds/forms/authorize-delete filter`. + +Add to functions.php: + +``` +add_filter( 'integration-cds/forms/authorize-delete', function( $isAuthorized, $reg, $target ) { + // Reject if no record was resolved + if ( $target === null ) { + return false; + } + + // Example rule: only signed-in users can delete + if ( ! is_user_logged_in() ) { + return false; + } + + // You can add more rules here: + // - check user role/capability + // - check ownership against $target + // - check registration ID via $reg + + return $isAuthorized; +}, 10, 3 ); +``` + +## Lookup security — restrict lookup access to signed-in users + +Lookups use a REST API endpoint and should be protected to avoid accidental data exposure. +The snippet below restricts lookups to **authenticated users only**. + +Add it to the active theme’s functions.php: + +``` +add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ) { + if ( ! is_user_logged_in() ) { + return false; + } + + return $isAllowed; +}, 10, 3 ); +``` + +## Date & Time behavior — what users will see + +Dataverse fields can behave as: + +**User Local**: value converts to user timezone +**Time Zone Independent**: no conversion +**Date Only**: date without time conversion + +Example value stored: 5/15/2028 03:00:00 AM (User Local field) + +If timezone is UTC + 2, users see 5/15/2028 05:00:00 AM +If timezone is UTC - 4, users see 5/14/2028 11:00:00 PM + +Set timezone per WordPress user + +Users → Edit +Dataverse Extra Fields +Choose Timezone + +Anonymous visitors use the site timezone configured in: +Settings → General → + +## Troubleshooting tips (quick) + +- If the premium plugin is not licensed, forms may fail with syntax errors — verify licensing first. +- If your theme already includes Bootstrap/Font Awesome, consider disabling DataPress dependencies to avoid conflicts. +- If lookup results look too broad, use view filters and/or FetchXML templates in conditional access settings. \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-overview.md b/datapress/Forms/power-apps-forms/forms-overview.md new file mode 100644 index 0000000..353a3f2 --- /dev/null +++ b/datapress/Forms/power-apps-forms/forms-overview.md @@ -0,0 +1,49 @@ +--- +title: Power Apps Forms +sidebar_position: 1 +premium: true +slug: /forms/forms +tags: + - Form + - DataPress +keywords: [DataPress forms] +--- + +:::note +The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. +All references in the documentation and user interface will be gradually updated. +::: + +

    +Capture leads, feedback, and other data from your website using forms designed in Power Apps and Dynamics 365. +

    + +## What are Power Apps Forms in DataPress? + +**Power Apps Forms** allow you to display Dataverse (Dynamics 365) forms on your WordPress website and submit user input directly back to Dataverse. + +With DataPress, you can: + +- Render Dataverse forms on public or protected pages +- Create new records from form submissions +- Update existing records using table binding +- Display data in a read‑only mode + +## Key concept: Form Registration + +To use a Dataverse form on a WordPress page, DataPress introduces the concept of a **form registration**. + +A form registration acts as a proxy between WordPress and Dataverse. It defines: + +- Which Dataverse form to display +- How the form handles submissions +- Which attributes are required or optional +- Which form‑level settings override global defaults + +## How forms are rendered on the website + +Forms are embedded into pages using the Twig templating engine. + +```twig +{% form id=42 %} +``` \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms-tabs.mdx b/datapress/Forms/power-apps-forms/forms-tabs.mdx deleted file mode 100644 index 9c98318..0000000 --- a/datapress/Forms/power-apps-forms/forms-tabs.mdx +++ /dev/null @@ -1,508 +0,0 @@ ---- -title: Power Apps Forms - tabs -sidebar_position: 5 -premium: true -slug: /forms/forms-tabs -tags: - - Form - - DataPress -keywords: [DataPress forms] -hide_table_of_contents: true ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; -import { TabTOCBrowserOnly } from '@site/src/components/TabTOC' - -
    - -
    -
    - - - - - -# Overview - -:::note -The plugin previously known as **Dataverse Integration** has been renamed to **DataPress**. -All references in the documentation and user interface will be gradually updated. -::: - -

    -Capture leads, feedback, and other data from your website using forms designed in Power Apps and Dynamics 365. -

    - -## What are Power Apps Forms in DataPress? - -**Power Apps Forms** allow you to display Dataverse (Dynamics 365) forms on your WordPress website and submit user input directly back to Dataverse. - -With DataPress, you can: - -- Render Dataverse forms on public or protected pages -- Create new records from form submissions -- Update existing records using table binding -- Display data in a read‑only mode - -## Key concept: Form Registration - -To use a Dataverse form on a WordPress page, DataPress introduces the concept of a **form registration**. - -A form registration acts as a proxy between WordPress and Dataverse. It defines: - -- Which Dataverse form to display -- How the form handles submissions -- Which attributes are required or optional -- Which form‑level settings override global defaults - -## How forms are rendered on the website - -Forms are embedded into pages using the Twig templating engine. - -```twig -{% form id=42 %} -``` - - -
    - - - -# Configuration - -## Before you begin - -Make sure that: - -1. The premium extension is active and licensed -2. A Dataverse (model‑driven) form already exists -3. You know whether the form should create, update, or display records - ---- - -## Creating a form registration - -To start collecting data, you must create a form registration. - -1. Open the plugin dashboard -2. Go to **Forms** -3. Click **Create new** - -Fill in the following fields: - -- **Form Name** -- **CRM Form** — select a Dataverse form -- **Mode** — choose how data is processed - -Click **Create** to save the registration. - ---- - -## Form modes - -### Create a new record - -Each submission creates a **new Dataverse record**. - -### Update or create a record - -The form uses table binding to: - -- load an existing record into the form -- update it on submission - -If no record is found, a new one is created. - -### Read‑only - -Table binding is used to load a record, but the form cannot be edited or submitted. - ---- - -## Allow deleting records - -When using **Update** or **Read‑only** mode, you can enable record deletion: - -- Enable **Allow deleting the record** - -⚠️ To prevent unauthorized deletes, implement the filter: - -`integration-cds/forms/authorize-delete` - -Parameters passed to the filter: - -- `$isAuthorized` — whether deletion is allowed -- `$reg` — the active form registration -- `$target` — the record being deleted (or `NULL`) - -Return `false` if deletion should not be allowed. - ---- - -## Required and optional attributes - -Dataverse defines required fields at the form level. -DataPress allows additional customization **without modifying the Dataverse form**. - -To change requiredness: - -1. Select attributes in **Attributes** -2. Move them to: - - **Required →** - - **Optional →** -3. Remove items by double‑clicking or using **Remove selected** - ---- - -## Global settings overrides - -Each form registration can override global form behavior, including: - -- reCAPTCHA -- Front‑end dependencies -- Form messages and behavior -- Full Name / Address decomposition - ---- - -## Front‑end dependencies - -Power Apps forms require the following libraries: - -- **Bootstrap 4** — https://getbootstrap.com/ -- **Font Awesome 5** — https://fontawesome.com/ - -DataPress ships custom, isolated builds of these libraries. -You may disable them if your WordPress theme already includes compatible versions. - ---- - -## reCAPTCHA support - -Dataverse forms integrate with reCAPTCHA. - -[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) - ---- - -## Adding the form to a page - -Use the Twig tag and the form registration ID: - -```twig -{% form id=42 %} -``` - -This renders the form and starts accepting submissions. - - - - - -# Notes (capabilities & limitations) - -## Supported controls - -DataPress renders forms close to their Dataverse definitions. - -Supported control types include: - -- Single‑line and multi‑line text -- Email and numeric fields -- Money and integer fields -- Radio buttons and checkboxes -- Date and time pickers -- Lookup fields - ---- - -## Limitations - -### Lookup selection -- Lookup dialogs do **not** support selecting multiple records -- Multi‑select picklists are **not supported** - -### Unsupported composite controls -The following controls are not currently supported: - -- Subgrids -- Maps -- Quick (nested) forms -- Notes, activities, posts, assistant panels - -### Web resources -Custom JavaScript web resources embedded in Dataverse forms are not supported. - -You may still use WordPress‑level CSS and JavaScript to customize appearance and behavior. - ---- - -## Composite columns - -### Full Name (`fullname`) - -`fullname` is a calculated field composed of name attributes. - -If present on the form, DataPress automatically decomposes it into individual controls (such as `firstname` and `lastname`) instead of using a popup editor. - -Microsoft reference: -https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013 - -### Address (`addressN_composite`) - -Address composite columns are handled similarly and decomposed into their underlying attributes. - -The plugin allows configuring which attributes are used for Full Name and Address fields. - ---- - -## Date and time behavior - -Dataverse supports multiple date behaviors: - -- **User Local**: Adjusts values based on the user’s time zone. -- **Time Zone Independent**: No time zone conversion is applied. -- **Date Only**: Displays only the date portion without time zone conversion. - -Documentation: -https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field - -### Time zone handling - -For **User Local** fields, displayed values depend on: - -- `ICDS_DATETIME_VALUE` setting (Legacy или Local) -- User time zone - -Example: - -| Stored Value | Timezone | Displayed Value | -|-------------|----------|----------------| -| 5/15/2028 03:00 AM | UTC+2 | 5/15/2028 05:00 AM | -| 5/15/2028 03:00 AM | UTC‑4 | 5/14/2028 11:00 PM | - -Anonymous visitors see values using the WordPress site time zone. - ---- - -## Lookup behavior and security - -### Display modes - -1. **Dialog** — searchable modal lookup -2. **Dropdown** — filtered list with optional search -3. **Select** — simple dropdown (≈ 50 options) - ---- - -### Security measures - -To prevent unauthorized data access: - -1. WordPress nonces are enforced - https://developer.wordpress.org/apis/security/nonces/ - -2. Access can be restricted using a filter hook: - -```php -add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ - if ( !is_user_logged_in() ) { - return false; - } - return $isAllowed; -}, 10, 3 ); -``` - -3. FetchXML templates can filter lookup results. - -## Unsupported Whole Number Formats -These Dataverse formats are not supported: - -Language code -Duration -Time zone - -## Decimal & Float Fields -Handled according to Dataverse settings (min/max, decimals). -[Reference](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) - - - - - -# Examples - -This page provides copy/paste examples for rendering **Power Apps / Dataverse forms** on WordPress using **DataPress** form registrations. - -> **Prerequisite:** You must create a **form registration** in the plugin admin area. -> You will need its registration ID (for example, `id=42`). - ---- - -## Render a basic form - -Render a form using its **form registration ID**: - -```twig -{% form id=42 %} -``` - -## Render a form with default field values -Use the defaults attribute to pre-populate fields: - -``` -{% form id=42 defaults={ - "leadsourcecode": 8, - "donotfax": true, - "address1_country": "United States" -} %} -``` - -**Notes:** - -- Defaults values must match Dataverse attribute logical names. -- Boolean fields accept true/false. -- For choice fields, pass the numeric option value (see next section). - -## Set a default value for a Choice (Option Set) field - -For choice fields, pass the integer value of the option. -**Example:** set gendercode to “Male” where “Male” has value 1: - -``` -{% form id=4 defaults={"gendercode": 1} %} -``` - -You can find label/value mapping in Dataverse column settings or metadata. - -## Set a default value for a Multi-Select Choice field - -Multi-select values are passed as a comma-separated string: - -``` - -{% form id=2 defaults={"multipleChoiceColumnName": "3,4"} %} -``` - -### Pre-select lead source - -``` -{% form id=42 defaults={"leadsourcecode": 8} %} -``` - -## Redirect after submit and capture the created record GUID - -When a record is successfully created, you can inject the record GUID into a redirect URL using %s. -Example: - -- Redirect setting: /?id=%s -- After create: /?id=00000000-0000-0000-0000-000000000000 - -Use this to forward users to a “Thank you” page, a confirmation screen, or a details page. - -## Set default values via Admin UI (no Twig changes) - -You can define default values inside the Dataverse Admin Area: - -1. Choose the form -2. Go to Fields Customization -3. Find Default Field Values -4. Add field name + default value - -This method supports defaults for: - -- text/number fields -- choice fields -- lookup fields (when configured) - -## Deletion security — authorize delete requests - -If your form registration enables **Allow deleting the record**, you should guard it with the `integration-cds/forms/authorize-delete filter`. - -Add to functions.php: - -``` -add_filter( 'integration-cds/forms/authorize-delete', function( $isAuthorized, $reg, $target ) { - // Reject if no record was resolved - if ( $target === null ) { - return false; - } - - // Example rule: only signed-in users can delete - if ( ! is_user_logged_in() ) { - return false; - } - - // You can add more rules here: - // - check user role/capability - // - check ownership against $target - // - check registration ID via $reg - - return $isAuthorized; -}, 10, 3 ); -``` - -## Lookup security — restrict lookup access to signed-in users - -Lookups use a REST API endpoint and should be protected to avoid accidental data exposure. -The snippet below restricts lookups to **authenticated users only**. - -Add it to the active theme’s functions.php: - -``` -add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ) { - if ( ! is_user_logged_in() ) { - return false; - } - - return $isAllowed; -}, 10, 3 ); -``` - -## Date & Time behavior — what users will see - -Dataverse fields can behave as: - -**User Local**: value converts to user timezone -**Time Zone Independent**: no conversion -**Date Only**: date without time conversion - -Example value stored: 5/15/2028 03:00:00 AM (User Local field) - -If timezone is UTC + 2, users see 5/15/2028 05:00:00 AM -If timezone is UTC - 4, users see 5/14/2028 11:00:00 PM - -Set timezone per WordPress user - -Users → Edit -Dataverse Extra Fields -Choose Timezone - -Anonymous visitors use the site timezone configured in: -Settings → General → - -## Troubleshooting tips (quick) - -- If the premium plugin is not licensed, forms may fail with syntax errors — verify licensing first. -- If your theme already includes Bootstrap/Font Awesome, consider disabling DataPress dependencies to avoid conflicts. -- If lookup results look too broad, use view filters and/or FetchXML templates in conditional access settings. - - - -
    - - -
    - -
    - -
    -
    - -
    \ No newline at end of file diff --git a/datapress/Forms/power-apps-forms/forms.md b/datapress/Forms/power-apps-forms/forms.md deleted file mode 100644 index a52205a..0000000 --- a/datapress/Forms/power-apps-forms/forms.md +++ /dev/null @@ -1,251 +0,0 @@ ---- -title: Power Apps Forms - old -sidebar_position: 5 -premium: true -slug: /forms/forms -tags: - - Form - - DataPress -keywords: [DataPress forms] ---- -:::note -The plugin previously known as Dataverse Integration has been renamed to DataPress. This change reflects our commitment to enhancing user experience and aligning with our evolving product vision. -All references to Dataverse Integration in the documentation, user interface will be updated to DataPress. -::: - -

    Capture leads, feedback and other information from your website using forms designed in Power Apps and Dynamics 365.

    - -## Introduction - -:::info - -This feature is exclusive to the premium extension. - -Licensing Requirement - -If the premium plugin is not properly licensed, syntax errors may occur. Ensure the plugin is correctly licensed to maintain Power Apps Forms functionality. - -::: - -Forms are an essential component of Power Apps and Dynamics 365 which enables interaction with your data. DataPress (Dataverse Integration) brings the comparable experience to your WordPress website. It makes writing data back to Dataverse / Dynamics 365 a priority, and to achieve the goal it provides support for rendering Dataverse / Dynamics 365 forms and processing the input by converting it into new Dataverse rows (records) or updates to the existing rows. - -The plugin introduces a concept of *"form registrations"*, a proxy layer between WordPress and a Dataverse form. It specifies among other things which Dataverse form to show, how to handle submissions, which fields to make required or optional. - -Forms are fully integrated into the Twig templating engine, and Twig templates are the way to place forms on your website pages. - -## Features and limitations - -DataPress (Dataverse Integration) renders forms close to what they are defined in Dataverse, layout-wise. Most control types are supported too, including lookups, radio buttons and checkboxes, date & time pickers, as well as simple text (e.g. single-line and multi-line text, email) and number (e.g. integers, money) inputs. - -DataPress (Dataverse Integration) provides a lookup dialog very similar to one included in Power Apps and Dynamics 365. It allows picking rows as values for lookup and customer columns. The lookup dialog included in the plugin does not support selecting multiple rows for one column. Multi-select picklists are not supported yet. - -Several composite controls are not supported yet. Those include subgrids, maps, nested forms (quick forms), notes (Posts, Assistant, Activities, Notes). - -There are no plans for support of web resources, such as custom JavaScript libraries embedded into forms. You can still use CSS and JavaScript to change how your forms appear and behave using standard WordPress means. - -### Composite columns - -Default Dataverse tables, such as Contact and Lead, include several composite read-only columns. - -`fullname` is a calculated column which by default represents First Name and Last Name. DataPress (Dataverse Integration) and Dynamics 365 provide several options to generate the Full Name, [see the article](https://www.magnetismsolutions.com/blog/colinmaitland/2014/02/03/how-to-change-the-full-name-format-for-contacts-in-microsoft-dynamics-crm-2013). The plugin does not show a pop-up to specify each name component separately. It instead decomposes the `fullname` column, if one is present on the form, into separate controls on the form as if the form contained `firstname` and `lastname` instead. - -`addressN_composite` columns are likewise calculated based on other `addressN_*` columns. In terms of rendering composite address columns are treated the same as Full Name columns. - -DataPress (Dataverse Integration) allows customizing the list of underlying attributes for Full Name and Address columns. - -### reCAPTCHA support - -Dataverse forms are fully integrated with reCAPTCHA. -[Read more](/forms/recaptcha/#recaptcha-support-for-power-apps-forms) - -### Front-end dependencies - -Dataverse forms require [Bootstrap 4](https://getbootstrap.com/) and [Font Awesome 5](https://fontawesome.com/) to work properly. We provide custom builds of these libraries that do not interfere with the existing layout of pages. You can opt out of including these libraries onto your website if your WordPress theme provides these dependencies. - -## Create a form registration - -To insert a form onto your webpage and start collecting data, you need to create a "form registration", which defines how to treat the incoming data. - -In the plugin dashboard, go to the *Forms* tab and click **Create new** to start creating a new form registration. - -Enter the *Form Name*, select the *CRM Form* and choose the mode of operation. Three modes are available: - -- Create a new record -- submissions always create a new record (row). -- Update or create a record -- form uses [table binding](/datapress/binding/table-binding.md) to acquire a record and put its values into form, and submission updates the row with changed values. If table binding hasn't yielded an existing record, a new record will be created instead. -- Read-only -- table binding is used to acquire a record, its values are displayed, but nothing can be changed on the form. - -Finally, click **Create** to save the new form registration. - -### Allow deleting records - -When you choose the *update* or *read-only* mode, you can enable record deletion by checking *Allow deleting the record.* - -You are advised to implement the `integration-cds/forms/authorize-delete` filter hook to guard against unauthorized use. When deletion request is submitted, three parameters are passed into the hook: - -- `$isAuthorized` -- *(boolean)* whether to authorize deletion of the record. -- `$reg` -- *(FormRegistration)* form registration which initiated deletion. Contains form ID, target entity and other form registration settings. -- `$target` -- *([EntityReference](https://github.com/AlexaCRM/dynamics-webapi-toolkit/blob/master/src/Xrm/EntityReference.php)|null)* record that is being deleted. The hook should return `false` if `NULL` has been passed. - -### Required and optional columns - -Dataverse forms can require some columns (fields) to be filled before a form can be submitted. Sometimes you want to make more columns required, or, instead, make some columns optional, without actually customizing the Dataverse form. - -To do that, select the columns from the Attributes column and move them to the Required or Optional column by clicking **Required →** or **Optional →** respectively. Select columns and click **Remove selected**, or double-click the fields (columns), to remove them from the list. - -### Global settings overrides - -Form registration provides several options to override global form settings, such as inclusion of reCAPTCHA and front-end dependencies, form behavior, messages and Full Name / Address decomposition columns. - -## Add the form to a page - -DataPress (Dataverse Integration) provides a custom Twig tag, `{% form %}`, to add Dataverse forms to WordPress pages. When you add a Dataverse form to a page, you need to know its form registration ID -- it is specified in the list of form registrations. - -```twig -{% form id=42 %} -``` - -This code is sufficient to display a Dataverse form on a WordPress page and start accepting submissions. - -### Default values - -You can set default values for different fields in two ways: - -- In the DataPress Admin Area -- In the WordPress Admin Area - -1. **Setting default values in the DataPress Admin Area** - -- Go to **Forms → Forms Editor** and open the required form. -- Find the **Fields Customization** section. -- Under **Default Field Values**, select the column display name and set the default value. - -For a choice field, you can set the default value as 0 (choices value). - -
    -Choice value -
    - -2. **Setting default values in the WordPress Admin Area** - -You can provide default values to pre-populate specific form columns by using the ‘defaults’ attribute in the `{% form %}` tag. - -```twig -{% form id=42 defaults={ "leadsourcecode": 8, "donotfax": true, "address1_country": "United States" } %} -``` - -If you create a page using the Dataverse Form block, you can set values in the `defaults` field. - -```twig -{ "leadsourcecode": 8, "donotfax": true, "address1_country": "United States" } -``` - -To set a default value for a choice field, you need to analyze the possible values. For example, you can find the label and value mapping in the table settings. To set the ‘Male’ label for the gender column, you need to choose the value of 1. - -```twig -{% form id=4 defaults={"gendercode": 1} %} -``` - -Similar way to set default value for multiple choice field. - -```twig -{% form id=2 defaults={"multipleChoiceColumnName": '3,4'} %} -``` - -Additionally, you can provide default values in the Dataverse Admin Area. Choose the form, go to Fields Customization, and find the Default Field Values section. Here, you just need to choose the field name and set the default value for it. You can set default values even for lookup and choice fields. - -### Getting record GUID - -After the record has been successfully created, you can get the guid using the redirect setting with the %s parameter. - -For example, `/?id=%s` will be replaced by `/?id=00000000-0000-0000-0000-000000000000` - -## Date Time and Date Only fields in forms - -When working with date and time values in forms, you can customize how they are displayed to users and how they are adjusted for different time zones. Here are the behavior options available in Dataverse and model-driven apps: - -- **User Local**: Adjusts values based on the user’s time zone. -- **Time Zone Independent**: No time zone conversion is applied. -- **Date Only**: Displays only the date portion without time zone conversion. - -[Read more](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field) - -[Usage Scenarios](/date-and-time/#usage-scenarios) - -When using the User Local behavior, all columns will display date or date-time fields converted to the specified time zone in case of the **Legacy** or **Local** option in `ICDS_DATETIME_VALUE`. [More details](/datapress/administration/troubleshooting.md) - -For instance: - -If you have a value like **5/15/2028 03:00:00 AM** in a column with User Local behavior and set the time zone to **UTC + 2h**, the form will show **5/15/2028 05:00:00 AM**. -If you set the time zone to **UTC - 4h**, the form will display **5/14/2028 11:00:00 PM**. - -| | Legacy | UTC | Local | -|-----------------|--------------|----------------|-----------| -|premium forms | convert the date and time to the user's timezone | UTC | convert the date and time to the user's timezone | - -You can set time zones for **individual WordPress users**: - -1. Find the user and click **Edit**. -2. Go to the **Dataverse Extra Fields** section. -3. Choose a value from the **Timezone** dropdown. - -For example, if a user has the same **5/15/2028 03:00:00 AM** column value with User Local behavior: - -- Setting their time zone to **UTC + 2h** will display **5/15/2028 05:00:00 AM**. -- Setting their time zone to **UTC - 4h** will show **5/14/2028 11:00:00 PM**. - -Anonymous visitors will see the values in the timezone of the website. To set the time zone for the website, follow these steps: - -1. Sign in into WordPress administrative interface. -2. Click **Settings**. -3. Go to **General**. -4. Select the required time zone. - -## Lookup fields in forms - -In Power Apps Forms for Dataverse, lookups are crucial for creating relationships between tables and enhancing data entry. Here’s a detailed look at how lookups function in different contexts: - -1. **Dialog** - -Search dialog boxes provide an interactive way to search and select records. Key features include: - -**Advanced Search**: Users can view all records or get results as they type, making it easier to find the right record. -**Filters**: Filters set with the view help narrow down search results. You can set values to sort while searching in any view. - -2. **Dropdown** - -Dropdown controls are used to display records with selections, allowing users to choose from a predefined list of options. They can be customized as follows: - -**Filter Choices**: Use the view to filter the available choices based on the records available in it. The name of the view must be pre-defined by the administrator in the form settings. -**Search Options**: When there are a large number of records, it is convenient to use the search option to find the desired value. - -3. Select - -This is basically a standard dropdown list where users can select an entry from a dropdown list. By default, about 50 values are displayed. - -### Lookup security - -Lookups utilize a custom REST API that could potentially execute outside of the form context, thereby unintentionally exposing data. To mitigate the risk of accidental exposure, we have implemented additional security measures: - -1. We fully support Wordpress nonces for lookup queries, i.e. queries performed outside of the form context will fail. Learn more at [Nonces – Common APIs Handbook](https://developer.wordpress.org/apis/security/nonces/). - -2. We support custom filter restricting access to the lookups. For example, to restrict lookups to the signed-in users only, add the following code to the `functions.php` file of the current theme. - -```php -add_filter( 'integration-cds/lookup/authorize-access', function( $isAllowed, $entityName, $view ){ - if ( !is_user_logged_in() ) { - return false; - } - - return $isAllowed; -}, 10, 3 ); -``` - -3. Data returned by a lookup can be filtered using fetchXML templates, refer to the `FetchXML queries` page for sample templates. To add a template to a form in the Dataverse Admin Area, navigate to the Forms settings and scroll down to the `Conditional access` section located at the bottom of the page and add your desired template for the form lookups. - -:::note -The following formats of the **Whole Number** data type are currently unsupported: **Language code**, **Duration**, **Time zone**. -::: - -## How to work with decimal and float fields - -Decimal and float fields depend on your Power Apps website settings. Here, you can set minimum and maximum values, decimal places, and other settings. [Read more](https://learn.microsoft.com/power-apps/maker/data-platform/formula-column-data-types) \ No newline at end of file diff --git a/src/components/TabTOC/index.tsx b/src/components/TabTOC/index.tsx deleted file mode 100644 index 18c4190..0000000 --- a/src/components/TabTOC/index.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, {useEffect, useMemo, useState} from 'react'; -import BrowserOnly from '@docusaurus/BrowserOnly'; -import Link from '@docusaurus/Link'; - -type HeadingItem = { - id: string; - value: string; - level: number; // 2..4 -}; - -function extractHeadingsFrom(container: HTMLElement, minLevel = 2, maxLevel = 4): HeadingItem[] { - const headings = Array.from(container.querySelectorAll( - Array.from({length: maxLevel - minLevel + 1}, (_, i) => `h${i + minLevel}`).join(',') - )); - - return headings - .filter(h => !!h.id) // docusaurus/remark обычно ставит id - .map(h => ({ - id: h.id, - value: h.innerText.trim(), - level: Number(h.tagName.substring(1)), - })); -} - -export default function TabTOC() { - const [items, setItems] = useState([]); - - useEffect(() => { - // Находим активный tabpanel (Tabs из @theme/Tabs рендерит их как role="tabpanel") - const update = () => { - const panels = Array.from(document.querySelectorAll('[role="tabpanel"]')); - // Активная панель — та, которая не скрыта (обычно невидимые имеют hidden или aria-hidden) - const active = panels.find(p => !p.hasAttribute('hidden') && p.getAttribute('aria-hidden') !== 'true'); - if (!active) { - setItems([]); - return; - } - const headings = extractHeadingsFrom(active, 2, 4); - setItems(headings); - }; - - update(); - - // Перестраиваем TOC при клике по табам и при навигации по якорям - const clickHandler = (e: Event) => { - const target = e.target as HTMLElement | null; - if (!target) return; - if (target.closest('[role="tab"]')) { - // Немного отложим, чтобы вкладка успела смениться - setTimeout(update, 0); - } - }; - - document.addEventListener('click', clickHandler); - window.addEventListener('hashchange', update); - - // На всякий случай перестроим на ресайз (иногда меняются скрытые статусы) - window.addEventListener('resize', update); - - return () => { - document.removeEventListener('click', clickHandler); - window.removeEventListener('hashchange', update); - window.removeEventListener('resize', update); - }; - }, []); - - if (!items.length) { - return null; - } - - // Строим вложенные уровни (h2 → h3 → h4) простым списком с отступами - return ( - - ); -} - -// Обёртка для SSR -export function TabTOCBrowserOnly() { - return ( - - {() => } - - ); -} \ No newline at end of file diff --git a/src/css/custom.css b/src/css/custom.css index 8c340ab..383500a 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -7,7 +7,7 @@ --ifm-color-primary-lighter: #48D0FF; --ifm-color-primary-lightest: #7EDCFF !important; - --ifm-background-color: #ffffff !important; + --ifm-background-color: #ffffff; --ifm-font-color-base: #212121; --ifm-code-font-size: 95%; --docusaurus-highlighted-code-line-bg: rgba(0, 119, 194, 0.1); @@ -52,7 +52,7 @@ .navbar__link, .navbar__title { - color: #ffffff !important; + color: #ffffff; text-decoration: none !important; } @@ -63,7 +63,7 @@ /* Hero section */ .hero--primary { background-color: var(--ifm-color-primary) !important; - color: #ffffff !important; + color: #ffffff; } /* Content links only */ @@ -213,15 +213,15 @@ span[itemprop="name"], /* Buttons */ button { - color: #004080 !important; /* исправлено */ - background-color: #ffffff !important; + color: #004080; + background-color: #ffffff; font-weight: 700; border: 1px solid #004f8a; padding: 0.4em 0.8em; } button:hover { - background-color: #f0f8ff !important; + background-color: #f0f8ff; color: #003f70 !important; } @@ -403,3 +403,64 @@ span[itemprop="name"] { max-width: var(--doc-content-max-width); } +/* ===================================== + DARK MODE – contrast & readability fix + ===================================== */ + +[data-theme='dark'] { + + /* Base text */ + color: var(--ifm-font-color-base); +} + +/* Content */ +[data-theme='dark'] .theme-doc-markdown, +[data-theme='dark'] .markdown { + background-color: transparent; + color: var(--ifm-font-color-base); +} + +/* Links inside content */ +[data-theme='dark'] article a, +[data-theme='dark'] .markdown a { + color: var(--ifm-color-primary-light); +} + +[data-theme='dark'] article a:hover { + color: var(--ifm-color-primary-lighter); +} + +/* details / collapsible */ +[data-theme='dark'] details, +[data-theme='dark'] details summary { + color: var(--ifm-font-color-base); + border-color: var(--ifm-color-primary); +} + +/* Menu, breadcrumbs, TOC */ +[data-theme='dark'] .menu__link, +[data-theme='dark'] .menu__link--active, +[data-theme='dark'] .pagination-nav__label, +[data-theme='dark'] .breadcrumbs__link, +[data-theme='dark'] .DocSearch-Button-Placeholder, +[data-theme='dark'] .table-of-contents a { + color: var(--ifm-font-color-base) !important; +} + +/* Buttons */ +[data-theme='dark'] button { + background-color: #123548 !important; + color: var(--ifm-font-color-base) !important; + border-color: var(--ifm-color-primary); +} + +[data-theme='dark'] button:hover { + background-color: #1a4a63 !important; +} + +/* Panes */ +[data-theme='dark'] .left-pane, +[data-theme='dark'] .right-pane { + background-color: #102a3a; + color: var(--ifm-font-color-base); +}