Skip to main content

Assign a Team Based On When a Work Order is Created

availability
Platform:WebMobile
Plan Type:BasicEssentialPremiumEnterprise
User Type:RequesterFull UserAdministrator

This example shows you how to trigger a Zap after a work order is created in MaintainX and assign a specific team to the work order if it was created after 10:00 PM.

Diagram showing a Zapier workflow for automatically assigning MaintainX work orders created after 10 PM to the night shift team
Zapier workflow for assigning MaintainX work orders to night shift team

Trigger​

In Zapier:

  1. In the Zap, configure the trigger like this:
FieldValue
AppMaintainX
Trigger EventNew Work Order

In MaintainX:

  1. Create a new work order to test the Zap trigger and see if the night shift team is automatically assigned.

Action 1​

In Zapier:

  1. In the Zap, add an action, and select Formatter as the App.

  2. In the Setup options, set the Action event to Date / Time.

  3. In the Configure options, set the following:

    FieldValue
    TransformFormat
    Input{{createdAt}} (from the Trigger)
    To FormatHH
    Screenshot showing how to configure the Date/Time formatter in Zapier to extract the hour from the work order creation timestamp
    Date/Time formatter configuration in Zapier

Action 2​

In Zapier:

  1. In the Zap, add an action, and select Filter as the App.

  2. In the Configure & test options, set the Only continue if to Hour > 21.

    Screenshot showing how to set up a filter in Zapier that only continues the workflow if the hour is after 10 PM
    Filter condition to only continue after 10 PM

Action 3​

In Zapier:

  1. In the Zap, add an action, and select Webhook as the App.

  2. In the Setup options, set the Action event to Custom Request.

  3. In the Configure options, set the following:

    FieldValue
    MethodPATCH
    URLhttps://api.getmaintainx.com/v1/workorders/{{workOrderId}}
    Body
    {
    "assignees": [
    {
    "type": "TEAM",
    "id": {{ID of the Night Shift Team}}
    }
    ]
    }
    Screenshot showing the configuration of the PATCH request that assigns the work order to the night shift team using the MaintainX API
    PATCH request configuration to assign the work order to night shift team
  4. In the Headers section, add the following headers:

    HeaderValue
    AuthorizationBearer <your API key>
    Content-Typeapplication/json
  5. Test your Zap. You can adjust the Filter condition while testing to adjust it for your current time.