Skip to content

documentation for originating and committing a command#1143

Open
nmpsilva wants to merge 1 commit intomainfrom
nuno/originate-and-commit-single-effect
Open

documentation for originating and committing a command#1143
nmpsilva wants to merge 1 commit intomainfrom
nuno/originate-and-commit-single-effect

Conversation

@nmpsilva
Copy link
Copy Markdown
Contributor

@nmpsilva nmpsilva commented Apr 15, 2026

Internal tracking: KOALA-4679

@nmpsilva nmpsilva requested a review from a team as a code owner April 15, 2026 14:12
@aws-amplify-us-west-2
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1143.d298pum72820gn.amplifyapp.com

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `commit` | `bool` | No | `False` | When `True`, the command is automatically committed after origination. This is a simpler alternative to returning separate `originate()` and `commit()` effects. **Note:** This only applies to command types that support the COMMIT action. Commands that do not support committing (Reason For Visit, Prescribe, Refill, Adjust Prescription, Refer, and Order commands) will ignore this parameter. See the [command type table](/sdk/effects/#commands) for which commands support COMMIT. |
| `line_number` | `int` | No | `-1` | The line number in the note where the command should be inserted. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `line_number` | `int` | No | `-1` | The line number in the note where the command should be inserted. |
| `line_number` | `int` | No | `-1` | The line number in the note where the command should be inserted. By default the command will insert at the bottom of the note. |

Comment on lines +474 to +476
### Chaining Methods with a User-set UUID

The solution is to set the UUID in the plugin -- using a valid Version 4 UUID -- and pass it through to both the originate and commit actions. This is accomplished by manually setting the `command_uuid` before calling the methods:
If you need more control over the process — for example, to edit a command between origination and commit — you can chain separate effects by setting the `command_uuid` manually. This is necessary because the `originate` method executes asynchronously, so there is no way to get the `command_uuid` back from the originate action and use it for subsequent actions in the same operation.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe link (to this) or mention that questionnaires based commands need to do this specific chaining because originate does not add the answers. All other commands you can originate with the fields filled out.

| Action | Description |
|---|---|
| ORIGINATE | Create and open a new command in a note. |
| ORIGINATE | Create and open a new command in a note. Supports an optional `commit` flag to also commit the command in the same operation. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| ORIGINATE | Create and open a new command in a note. Supports an optional `commit` flag to also commit the command in the same operation. |
| ORIGINATE | Create and open a new command in a note. Supports an optional `commit` flag to also commit the command in the same operation if the command is commit-able via SDK. |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants