14.7Examples
Last updated
Example 1: create a user and continue once it exists
This workflow creates a user from a form or ticket, and continues with the new account whether or not the creation had to wait.
- Add a trigger that supplies the person's details.
- Add a SYNERGY Management Gateway node set to User > Create. Fill in User Name, User Path, User SAM Account Name and the attributes from the trigger. Under Options, set On Approval Required to Continue and Output Operation ID.
- Add an IF node that tests
{{ $json.approvalRequired }}is true. - On the true branch, add a SYNERGY Management Gateway node set to Operation > Wait for Approval. Leave Operation ID at its default, set Timeout (Seconds) to 0, and keep Fail on Rejection on.
- Continue both branches into the next step. On the waited branch, the new user's GUID is
{{ $json.result.entityId }}; on the direct branch it is{{ $json.objectGuid }}.
The output of the waiting step looks like this:
{
"id": "6a1f0c2e-8d1b-4b7a-9f62-3c0e2d7a91b4",
"displayName": "Create User",
"status": "Success",
"approved": true,
"decided": true,
"expired": false,
"result": {
"entityId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301",
"distinguishedName": "CN=Jane Doe,OU=Staff,DC=example,DC=com",
"objectClass": "user",
"action": 1
}
}Example 2: disable inactive accounts every night
- Add a Schedule Trigger that runs once a night.
- Add a SYNERGY Management Gateway node set to User > Search by State. Set State to Inactive, Inactive Days to 90, Base DN to the organizational unit that holds staff accounts, and turn on Return All.
- Add a SYNERGY Management Gateway node set to User > Disable, with User ID set to
{{ $json.objectGuid }}. - Under Options of the Disable node, choose what should happen if a disable has to wait. For an unattended job, Continue and Output Operation ID followed by a notification to the approvers is usually more useful than failing the run.
Note: Disabling is not a delete, so a Guarded key carries it out directly — unless the account is protected, sits in a protected container, or the key has tripped the volume brake. A leavers job that deletes more than twenty accounts an hour will trip the brake; approve the queued requests, or ask an administrator to raise the threshold.
Example 3: report what is waiting for approval
- Add a Schedule Trigger that runs every morning.
- Add a SYNERGY Management Gateway node set to Operation > Get Waiting, with Return All on.
- Send the list to a chat channel or by email with an n8n messaging node, using
{{ $json.displayName }}and{{ $json.expiresAt }}.
Good practice and limits
- One key per workflow family. It makes the operations log readable — every row names the API key that acted — and lets you revoke one integration without stopping the others.
- Least privilege. Give the key's role only the permissions the workflow uses. The gateway never lets a key do more than its owner can do at that moment.
- Expect 202. Any write can be queued, depending on the key's supervision level and what it touches. Decide in every workflow what should happen then.
- Partial results are not failures, and not successes. The organizational-unit account operations can partly succeed; branch on
partialFailure. - The node has no bulk shortcut. n8n's own item loop is the batch: each item is one request, each request is checked and logged on its own. The REST API's batch endpoints (Chapter 15) are not used by the node.
- Everything is audited. Each change appears in the operations log under the key's owner, with the API key's name. See Chapter 9.
- Search rate limit. Directory searches are limited per client address; see Chapter 15.
Last updated
Thank you for your feedback.