# Table of Contents - [Welcome to Rewst | Rewst Documentation](#welcome-to-rewst-rewst-documentation) - [[PROD - TASK] Immybot: Get User Count | Rewst Documentation](#-prod-task-immybot-get-user-count-rewst-documentation) - [[Rewst Master v2] PSA-Datto: List Ticket Types | Rewst Documentation](#-rewst-master-v2-psa-datto-list-ticket-types-rewst-documentation) - [[Rewst Master v2] PSA-Datto: List Ticket Subtypes | Rewst Documentation](#-rewst-master-v2-psa-datto-list-ticket-subtypes-rewst-documentation) - [[REWST - TASK] Document Password in External Systems | Rewst Documentation](#-rewst-task-document-password-in-external-systems-rewst-documentation) - [[Rewst Master v2] PSA-Kaseya: Get Boards | Rewst Documentation](#-rewst-master-v2-psa-kaseya-get-boards-rewst-documentation) - [[REWST - TASK] Nodeware: Decommission Asset | Rewst Documentation](#-rewst-task-nodeware-decommission-asset-rewst-documentation) - [[REWST - PROC] User: Change Password | Rewst Documentation](#-rewst-proc-user-change-password-rewst-documentation) - [Page[REWST - TASK] PSA-Halo: Upsert Contact | Rewst Documentation](#page-rewst-task-psa-halo-upsert-contact-rewst-documentation) - [Email Protection | Cloudflare](#email-protection-cloudflare) --- # Welcome to Rewst | Rewst Documentation [](https://docs.rewst.help/support-and-community/roc-support) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252FqEBESY951Bx5XZgSDAkF%252F1.png%3Falt%3Dmedia%26token%3D65632c99-b2bd-4901-ac1f-8a9a993d2aaf&width=245&dpr=4&quality=100&sign=ae618dd4&sv=2) **Rewst Support** Contact and resources for help with using Rewst [](https://docs.rewst.help/updates/roc-open-mics) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252FpgyieQ28HceHjOdPe4bd%252F2.png%3Falt%3Dmedia%26token%3D6e8d36e9-ceb3-44bf-a6a8-da6107dbf167&width=245&dpr=4&quality=100&sign=b91f54a9&sv=2) **Rewst Open Mic** Recordings and invites to our live community hang-outs [](https://learn.rewst.io/) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252F33j5XErC5QzOKm7iKa3E%252Fcluck%2520u.avif%3Falt%3Dmedia%26token%3D81a80fd3-5365-4521-9d42-49eb470c70d0&width=245&dpr=4&quality=100&sign=f6c3ce23&sv=2) **Cluck University** Sign up for training in CluckU to learn how to use Rewst [](https://docs.rewst.help/#get-started-with-rewst) Get started with Rewst ------------------------------------------------------------------------------- Not sure where to begin? We recommend these resources. Click on Cluck University links to launch that course in a new tab. Click on documentation links to take you directly to that page in this documentation site. ### [](https://docs.rewst.help/#cluck-university-intro-courses) Cluck University intro courses [](https://learn.rewst.io/path/onboarding-learning-path) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252F1iUFNLkxovpkc6SRHFLr%252FScreenshot%25202025-07-21%2520at%252010.36.23%25E2%2580%25AFAM.png%3Falt%3Dmedia%26token%3D1bcb31e5-47c0-44f5-aac1-3abb496b986a&width=245&dpr=4&quality=100&sign=ece67f77&sv=2) **Rewst onboarding: Learn how to set up your Rewst environment and integrate your tech stack** [](https://learn.rewst.io/process-engineering-designed-for-automation) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252FXKRcq5KPHwlA2gvHsCdM%252FScreenshot%25202025-07-21%2520at%252010.38.57%25E2%2580%25AFAM.png%3Falt%3Dmedia%26token%3Def008887-dff7-4e0b-b4de-88b23963df00&width=245&dpr=4&quality=100&sign=57125a5f&sv=2) **Process engineering: Learn to recognize automation opportunities, and map out processes with clarity** [](https://learn.rewst.io/path/automation-basics) ![Cover](https://docs.rewst.help/~gitbook/image?url=https%3A%2F%2F1835401289-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FAQQ1EHVcEsGKBPVHmiav%252Fuploads%252FWAMpdIj21oajTeFo8CoI%252FScreenshot%25202025-07-21%2520at%252010.40.08%25E2%2580%25AFAM.png%3Falt%3Dmedia%26token%3D1c17bc42-cdaa-4375-8d6d-407cc5db18de&width=245&dpr=4&quality=100&sign=46bac844&sv=2) **Automation basics: Learn key concepts for building smarter, more efficient workflows in Rewst** ### [](https://docs.rewst.help/#documentation-on-rewst-platform-basics) Documentation on Rewst platform basics [](https://docs.rewst.help/documentation/configuration/integrations) **What is an integration?** [](https://docs.rewst.help/documentation/automations/workflows) **What is a workflow?** [](https://docs.rewst.help/documentation/automations/actions-in-rewst) **What is an action?** [](https://docs.rewst.help/documentation/configuration/organization-variables) **What is an organization?** [](https://docs.rewst.help/documentation/crates) **What is a Crate?** [](https://docs.rewst.help/documentation/automations/forms) **What is a form?** [](https://docs.rewst.help/documentation/automations/templates-and-scripts) **What is a template?** [](https://docs.rewst.help/documentation/jinja) **What is Jinja?** [](https://docs.rewst.help/documentation/settings/user-management) **What are users in Rewst?** Last updated 27 days ago Was this helpful? --- # [PROD - TASK] Immybot: Get User Count | Rewst Documentation This workflow retrieves the total count of devices managed in ImmyBot, serving as a critical data-gathering building block that can feed into larger workflows for billing, license management, or resource planning automations. It's particularly valuable for MSPs needing to automate client billing based on device count, reconcile asset inventory across platforms, or trigger conditional processes based on current managed device thresholds. Technically, the workflow executes an API call to ImmyBot using the "list\_computers" action, processes the returned device data, and makes the count available for downstream automation consumption - creating a simple yet powerful integration point between ImmyBot and your broader automation ecosystem. This workflow contains 6 tasks. ### [](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-immybot-get-user-count#inputs) Inputs This sub workflow has no inputs. ### [](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-immybot-get-user-count#outputs) Outputs * **automation\_log**: Standardized Rewst automation log * **immy\_counts**: List of ImmyBot companies and their counts. ### [](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-immybot-get-user-count#key-tasks) Key tasks * **BEGIN**: Core integration: noop * **get\_device\_count**: Data retrieval * **immy\_bot\_list\_computers**: Calculation * **build automation log**: Logging * **action\_error**: Core integration: noop ### [](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-immybot-get-user-count#jinja-examples) Jinja examples #### [](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-immybot-get-user-count#example-1) Example 1 Copy {{ [ { "company": item, "company_id": [device.company_id for device in CTX.listed_immy_devices if device.company_name == item] | first |d, "count": [device for device in CTX.listed_immy_devices if device.company_name == item] | length } for item in company_list ] }} This expression creates a structured report of device counts by company, iterating through a list of companies and counting matching Immybot devices for each. It's accessing company names from `company_list` and device data from `CTX.listed_immy_devices`, using list comprehensions and filters to match devices to their respective companies. [Previous\[PROD - TASK\] Huntress: Get License Counts](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-huntress-get-license-counts) [Next\[PROD - TASK\] MyGlue: Get License Counts](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-myglue-get-license-counts) Last updated 2 months ago Was this helpful? --- # [Rewst Master v2] PSA-Datto: List Ticket Types | Rewst Documentation This workflow retrieves all available ticket types and their definitions from Datto Autotask PSA, serving as a fundamental building block for more complex automation workflows that need to reference or manipulate ticket categories. MSPs would find this valuable when creating ticket automation that requires type validation, implementing conditional workflows based on ticket classifications, or standardizing ticket categorization across client organizations. Technically, the workflow executes a single API call to Datto PSA using the "tickets\_query\_field\_definitions" action, which fetches field definitions including the picklist values containing available ticket types and their configurations. This data becomes essential for downstream automations that need to programmatically create, update, or route tickets with the correct type designation, ensuring data consistency and proper ticket handling in your PSA system. This workflow contains 1 task. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-types#inputs) Inputs * **choose\_variable** - string ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-types#outputs) Outputs * **options**: Array of ticket type objects. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-types#key-tasks) Key tasks * **list\_ticket\_types**: Datto Autotask PSA integration: List Ticket Fields with Picklists ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-types#jinja-example) Jinja example Copy {%- set all_issues = [] -%} {%- for item in TASKS.list_ticket_types.result.result.fields -%} {% if item.isPickList == true and item.name == "issueType" %} {%- set tmp = item.picklistValues | list -%} {% for issues in tmp %} {%- set is_default = issues.value in ORG.VARIABLES[CTX.choose_variable]|d -%} {%- set tmp2 = all_issues.append({"label": issues.label, "id": issues.value, "default": is_default}) -%} {% endfor %} {% else %} {% endif %} {% endfor %} {{- all_issues | list -}} This is used in publishing 'ticket\_types'. [Previous\[Rewst Master v2\] PSA-Datto: List Members](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-members) [Next\[Rewst Master v2\] PSA-Halo: Get Company Status](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-halo-get-company-status) Last updated 1 month ago Was this helpful? --- # [Rewst Master v2] PSA-Datto: List Ticket Subtypes | Rewst Documentation This workflow retrieves all available ticket subtypes from Datto Autotask PSA, serving as a critical reference component for any automation that needs to create, route, or categorize tickets programmatically. MSPs will find this building block invaluable when developing automated ticket creation from RMM alerts, implementing intelligent ticket routing based on issue type, or synchronizing ticket classifications between different platforms. Technically, it executes a simple query to the Datto PSA API that returns all defined ticket subtypes and their associated picklist values, making these values available as variables for other workflows. This standardized method for accessing ticket classification data ensures that downstream automations always use valid subtype values, preventing errors when integrating with the PSA. This workflow contains 1 task. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-subtypes#inputs) Inputs * **ticket\_type** - string * **choose\_variable** - string ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-subtypes#outputs) Outputs * **options**: Array of ticket subtype objects. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-subtypes#key-tasks) Key tasks * **list\_ticket\_subtypes**: Datto Autotask PSA integration: List Ticket Fields with Picklists ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-datto-list-ticket-subtypes#jinja-example) Jinja example Copy {%- set all_subissues = [] -%} {%- for item in CTX.list_all_types -%} {%- if CTX.ticket_type|d == item.type_id|d -%} {%- set is_default = item.value|d == ORG.VARIABLES[CTX.choose_variable]|d -%} {%- set _ = all_subissues.append({"label":item.subType_name, "id":item.subType_id, "default":is_default}) -%} {% endif %} {%- endfor -%} {{- all_subissues -}} This is used in publishing the ticket\_subtypes data alias. [Previous\[PROD - TASK\] SentinelOne: Get License Counts](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-sentinelone-get-license-counts) [Next\[Rewst Master v2\] PSA-Halo: Get Agents](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-halo-get-agents) Last updated 1 month ago Was this helpful? --- # [REWST - TASK] Document Password in External Systems | Rewst Documentation This workflow automates password documentation across multiple MSP tools like documentation platforms and password managers, while updating the related PSA ticket with what was done. It plays a key role in automations for onboarding, password resets, and account management by checking each system’s requirements, only documenting where it’s allowed, and keeping everything compliant through consistent credential handling. Save time and reduce security risks by using this in situations where you would otherwise need to document passwords manually across different systems. The modular setup also lets you pick which platforms to use, while still keeping credential management standardized across clients. This workflow contains 16 tasks. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#inputs) Inputs * **use\_psa** - boolean * Set to `true` to document password change in PSA * Default: `{{ false }}` * **password** - string * Password * **use\_hudu** - boolean * Set to `true` to store password in Hudu * Default: `{{ false }}` * **username** - string * Username * **ticket\_id** - string * PSA Ticket ID * **supervisor** - string * Supervisor UPN or ID * **use\_itglue** - boolean * Set to `true` to store password in IT Glue * Default: `{{ false }}` * **use\_pwpush** - boolean * Set to `true` to send password via PWPush * Default: `{{ false }}` * **user\_email** - string * User Email Address * **phone\_number** - string * Phone number to SMS * **user\_last\_name** - string * User Last Name * **store\_in\_ticket** - boolean * Set to `true` to store password in PSA Ticket * Default: `{{ true }}` * **user\_first\_name** - string * User FIrst Name * **send\_sms\_to\_user** - boolean * Set to `true` to send SMS to User * Default: `{{ false }}` * **send\_supervisor\_user\_password** - boolean * Set to `true` to send Supervisor User's password * Default: `{{ false }}` ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#outputs) Outputs * **automation\_log**: Standardized Rewst automation log. * **success**: Boolean; States if workflow was successful. * **itglue\_password\_link**: The link to the new password in ITGlue. * **itglue\_password\_record**: The entire new password record in ITGlue. * **pwpush\_url**: The url generated by PWPush. * **hudu\_password\_link**: The link to the new password in Hudu * **hudu\_password\_record**: The entire new password record in Hudu. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#key-tasks) Key tasks * **check\_itglue**: Validation/verification * **check\_psa**: Validation/verification * **validate\_inputs**: Validation/verification * **update\_ticket**: Data modification * **end\_of\_tasks**: Core integration: noop ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#jinja-examples) Jinja examples #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#example-1) Example 1 Copy {{ CTX.use_itglue|d(false, true) }} Used in transition condition #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-document-password-in-external-systems#example-2) Example 2 Copy {{ CTX.username|d("", true) and CTX.password|d("", true) }} Used in condition to check that the username and password were provided. [Previous\[REWST - TASK\] Delay Automation](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-delay-automation) [Next\[REWST - TASK\] EXO Set Permissions](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-exo-set-permissions) Last updated 2 months ago Was this helpful? --- # [Rewst Master v2] PSA-Kaseya: Get Boards | Rewst Documentation This workflow pulls all service boards from Kaseya BMS using a direct API call, making it a key building block for automations that need to select or assign boards. MSPs can use it for ticket creation, routing, portal integrations, or syncing across platforms. It runs a single API task to fetch the full list of boards, so other workflows can easily reference them for logic, reporting, or categorization—without having to repeat the lookup each time. This workflow contains 1 task. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-boards#inputs) Inputs * **choose\_variable** - string ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-boards#outputs) Outputs * **options**: Array of queues. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-boards#key-tasks) Key tasks * **kaseya\_bms\_list\_queues**: Kaseya BMS integration: List Queues ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-boards#jinja-example) Jinja Example Copy {{ [\ {\ "id": queue.id,\ "name": queue.name,\ "default": true if queue.id == ORG.VARIABLES[CTX.choose_variable]|d|int else false\ }\ for queue in TASKS.kaseya_bms_list_queues.result.result\ if queue.isActive == true\ ] | sort(attribute="name") | unique(attribute="id") }} This is used to define the data alias queues. [Previous\[Rewst Master v2\] PSA-Kaseya: Get Account Type](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-account-type) [Next\[Rewst Master v2\] PSA-Kaseya: Get Business Type](https://docs.rewst.help/documentation/automations/subworkflows/rewst-master-v2-psa-kaseya-get-business-type) Last updated 2 months ago Was this helpful? --- # [REWST - TASK] Nodeware: Decommission Asset | Rewst Documentation This workflow automates the removal of assets from Nodeware vulnerability management by retrieving the asset information and executing the decommission process, serving as a critical component in device lifecycle management and client offboarding automations. MSPs will find this function valuable during hardware refresh cycles, client terminations, or when removing compromised devices from security monitoring to maintain an accurate, billable asset inventory. Technically, the workflow validates the asset UUID, retrieves current asset details from Nodeware to confirm its existence, and then executes the formal decommissioning process with optional justification documentation for compliance purposes. This automation eliminates the manual effort of logging into Nodeware to decommission devices individually, preventing ongoing vulnerability scans against retired assets that could trigger false alerts or create unnecessary security noise. This workflow contains 6 tasks. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#inputs) Inputs * **justification** - string * Reason for removal of the asset. * **nodeware\_asset\_uuid** - string * UUID of the Nodeware asset to decommission. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#outputs) Outputs * **automation\_log**: Standardized Rewst automation log * **success**: Boolean; States if workflow was successful. * **decommissioned\_data**: data about the decommissioned device. * **asset name**: name of asset ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#key-tasks) Key tasks * **get\_asset**: Data retrieval * **failure\_catch**: Core integration: noop * **decommission\_asset**: Nodeware integration: Decommission An Asset * **check\_uuid**: Validation/verification ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#jinja-examples) Jinja examples #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#example-1) Example 1 Copy {{ CTX.nodeware_asset_uuid|d }} Unknown context #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-nodeware-decommission-asset#example-2) Example 2 Copy {{ CTX.get_asset_result.alias|d or CTX.get_asset_result.report.host.hostname|d }} Used in publishing 'asset\_name' [Previous\[REWST - TASK\] M365: Remove Licenses](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-m365-remove-licenses) [Next\[REWST - TASK\] Offboard Exchange Actions](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-offboard-exchange-actions) Last updated 2 months ago Was this helpful? --- # [REWST - PROC] User: Change Password | Rewst Documentation This workflow functions as a critical building block that automates user password changes across both on-premises Active Directory and Azure/Entra ID environments, creating or updating PSA tickets while providing email fallback options for comprehensive error handling. MSPs will find this particularly valuable for reducing password reset tickets (one of the highest volume ticket types), supporting hybrid identity environments, and maintaining consistent security practices across multiple clients. Technically, the workflow first validates required inputs, determines the identity provider location (on-prem AD or Entra ID), executes the appropriate password change method, triggers AD sync when necessary, and integrates with PSA systems to document the action through ticket creation or updates. This workflow contains 21 tasks. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#inputs) Inputs * **password** - string * Change user's password to this * **ticket\_id** - string * Update ticket with the details of this workflow run * **user\_name** - string * Username * **idp\_config** - string * Accepted values are: on\_prem, hybrid\_no\_sync, azure\_ad, on\_prem\_only. If no value is provided value will be determined via org var logic. * **skip\_ticket** - boolean * Set to true if you do not want any ticketing done * Default: `{{ false }}` * **unlock\_account** - boolean * Unlocks account for locked out accounts * Default: `{{ false }}` * **no\_sync\_override** - string * User ID if no User name provided * **force\_password\_reset** - boolean * Force the user to change their password when logging in, defaults to true. * Default: `{{ true }}` ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#outputs) Outputs * **automation\_log**: Standardized Rewst automation log * **success**: Boolean; States if workflow was successful. ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#key-tasks) Key tasks * **update\_ticket**: Data modification * **email\_fallback**: Core integration: noop * **failure\_catch**: Core integration: noop * **process\_inputs**: Data processing * **ticketing**: Core integration: noop ### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#jinja-examples) Jinja examples #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#example-1) Example 1 Copy {{ ORG.VARIABLES.default_psa }} Used in input parameter 'psa' #### [](https://docs.rewst.help/documentation/automations/subworkflows/rewst-proc-user-change-password#example-2) Example 2 Copy {{ CTX.ticket_id }} Used in input parameter 'ticket\_id' [Previous\[REWST - PROCESS\] PSA: Update Ticket](https://docs.rewst.help/documentation/automations/subworkflows/rewst-process-psa-update-ticket) [Next\[REWST - TASK\] Add M365 Groups And Shared Mailboxes](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-add-m365-groups-and-shared-mailboxes) Last updated 2 months ago Was this helpful? --- # Page[REWST - TASK] PSA-Halo: Upsert Contact | Rewst Documentation This workflow provides a standardized method for creating or updating contacts in HaloPSA, serving as a critical building block for client management automations by ensuring contact data consistency across your MSP's systems. The workflow functions by searching for an existing contact by email, then either updating the existing record or creating a new contact when one doesn't exist, eliminating duplicate records and reducing manual data entry errors. This automation is particularly valuable for MSPs during client onboarding processes, employee changes at client sites, synchronizing contact data between systems (like CRM to PSA), and any ticket-related workflow where accurate contact information is essential. Technicians can leverage this reusable component within larger automation sequences whenever a new contact needs to be added or updated in HaloPSA, ensuring data integrity across the PSA platform. This workflow contains 9 tasks. ### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#inputs) Inputs * **psa\_contact\_id** - string * Specify the Contact to update, if known * **existing\_ticket** - string * Specify the existing ticket id in order to update an existing ticket. If none specified, we will create a new ticket. * **user\_attributes** - object * Specify the user object that includes the user properties * Default: `{{ { } }}` * **psa\_disable\_contact** - boolean * Specify whether to disable the contact if found. Defaults to false. * Default: `{{ false }}` * **psa\_contact\_location** - string * Specify the location for the contact to be created under ### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#outputs) Outputs * **automation\_log**: Standardized Rewst automation log ### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#key-tasks) Key Tasks * **check\_contact\_found**: Validation/verification * **determine\_upsert**: Core integration: noop * **halo\_get\_contact\_id**: Data retrieval * **halo\_update\_contact**: Data modification * **halo\_create\_contact**: Creation/initialisation ### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#jinja-examples) Jinja examples #### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#example-1) Example 1 Copy {{ CTX.matching_contact.users | length == 1 or CTX.matching_contact.record_count == 1 }} This condition evaluates whether exactly one contact was found in your system, checking either if there's exactly one user in the matching\_contact.users array OR if the record\_count equals 1. The expression accesses the contact data retrieved from a previous lookup task, typically used to determine whether a workflow should proceed or take an alternative path based on contact identification success. MSPs could modify this expression to implement more specific matching criteria, such as checking additional properties or implementing different threshold values for matches. For example, you might change it to `CTX.matching_contact.users | length >= 1` if you want the workflow to proceed when one or more contacts are found rather than requiring exactly one match. ### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#expression-2-extracting-a-contact-id-with-fallback-logic) Expression 2: Extracting a contact ID with fallback logic #### [](https://docs.rewst.help/documentation/automations/subworkflows/page-rewst-task-psa-halo-upsert-contact#example-2) Example 2 Copy {{ CTX.matching_contact.users[0].id or CTX.matching_contact.id|d }} This expression retrieves a contact ID using fallback logic - it first attempts to get the ID from the first user in the users array, but if that fails, it falls back to the direct contact ID property, with a final default of an empty string if both are unavailable. The expression is accessing identity data from a contact record and is typically used to extract a unique identifier that will be used in subsequent workflow tasks. MSPs can modify this to handle different data structures or to implement additional fallback options based on their specific integrations or data sources. For instance, you might modify it to `CTX.matching_contact.users[0].email` or `CTX.matching_contact.email|d('[[email protected]](https://docs.rewst.help/cdn-cgi/l/email-protection) ')` to extract an email address instead of an ID, with a custom default value. [Previous\[REWST- TASK\] Halo PSA: Update Ticket](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-halo-psa-update-ticket) [Next\[REWST - TASK\] Hide From Gal](https://docs.rewst.help/documentation/automations/subworkflows/rewst-task-hide-from-gal) Last updated 2 months ago Was this helpful? --- # Email Protection | Cloudflare Please enable cookies. Email Protection ================ You are unable to access this email address docs.rewst.help ----------------------------------------------------------- The website from which you got to this page is protected by Cloudflare. Email addresses on that page have been hidden in order to keep them from being accessed by malicious bots. **You must enable Javascript in your browser in order to decode the e-mail address**. If you have a website and are interested in protecting it in a similar way, you can [sign up for Cloudflare](https://www.cloudflare.com/sign-up?utm_source=email_protection) . * [How does Cloudflare protect email addresses on website from spammers?](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/) * [Can I sign up for Cloudflare?](https://developers.cloudflare.com/fundamentals/setup/account/create-account/) Cloudflare Ray ID: **970f0ecb3e05343f** • Your IP: Click to reveal 54.237.218.47 • Performance & security by [Cloudflare](https://www.cloudflare.com/5xx-error-landing) ---