Query

Get a list of Procore objects of the same type, with a set of specified fields for each object.

This action can be used to execute most Procore API calls that use an HTTP GET request and return an array of objects (rather than a single object). Please refer to the Procore API Reference to find such APIs; most of them begin with the word "List". Here are just a handful of Procore APIs that you can invoke with this action:

Inputs

KeyValue
apiPathRequiredThe Procore API endpoint that you wish to invoke, without the "vapid" prefix. Please refer to the Procore Actions overview for more on the apiPath input, which is required for all Procore Actions.
selectFieldsOptionalA comma-separated list of fields to be retrieved from the Procore object.

To get a list of all possible field names that you can retrieve, look at the Responses section of the corresponding Procore API documentation — any key from the JSON response can be used. For instance, for the List Accident Logs API, field names include comments, created_at, date, etc.
fieldType_<fieldname>OptionalThe data type of the field called fieldname that was retrieved from the Procore object. This should correspond to one of the fields specified in the selectFields input. Only date and datetime data types need to be specified in this way. This is necessary to determine which fields should be converted to the specified timeZone.

Refer to the Responses section of your Procore API's documentation to determine which fields are of type date or datetime.
timeZoneOptionalThe time zone in which any date or datetime fields should be returned. These fields will be converted from the time zone used in the Procore Project to the time zone you specify. If time zone is not specified, all dates/times will be returned in UTC time. See the Zone ID column here for a list of accepted values for the timeZone input.

This input is unnecessary if no date or datetime fields are retrieved.

Outputs

KeyValue
dataSetUrlThe URL of the DataSet JSON file containing the objects retrieved by the query. Each row represents a Procore object, and each column represents a field specified by the selectFields input.
storageFileNameThe name of the DataSet JSON file containing the objects retrieved by the query.
rowCountThe number of records returned (i.e. the number of rows in the returned DataSet file).

Usage Example

Suppose you are using a Procore Webhook to dispatch a GoFormz form when a new Incident is created in Procore, and you want to pre-fill this form with some information. One of the fields you want to pre-fill is the name of the Safety Manager on the project. Here is how you might go about retrieving the name of the safety manager.

Your workflow would start with the Procore Event trigger, which listens for the Procore Webhook to initiate the workflow. Then you might use this Query action configured as follows:

KeyValue
apiPath/project_roles?project_id=#{trigger.project_id}&role=Safety Manager
selectFieldsname, role, contact_id

In this example, we use Procore's List Project Roles API. We construct the apiPath as described in the API documentation, using the "project_id" field from the Webhook trigger to fill in the required project ID query parameter, and filtering on the role of "Safety Manager". Then we select all the fields available in the Responses section as our return values — name, role and contact_id.

Next in your workflow, you might use the Filter DataSet and Select DataSet Row actions to extract the contact_id from the dataSetUrl returned by this Query action. And you may pass the contact_id to a Lookup Object step, to retrieve the name of the project's Safety Manager from Procore. Then finally you can create a new form with Create Form and pre-fill the Safety Manager's name in the appropriate form fields.