# Handling Priorities

[Priorities](/product-suite/admin/entities/priorities.md) within Keyfax can be set via a service, task or script level override. When Keyfax completes and results are returned via a call to the Keyfax [REST API](/integrations/apis/rest-api.md) 2 important properties are returned..

* `Priority` - An alphanumeric priority code as defined within Keyfax Administrator Tools. This value is set via the “Priority Code” field within Keyfax when editing a priority. This priority code would typically correspond to a priority Identifier within your host system.
* `PriorityId` - The internal priority ID for the priority within the Keyfax database. This can often be ignored for integrations and is provided as more of a convenience.

### Keyfax Services (Staff)

[Services](/product-suite/admin/entities/services.md) returned within Keyfax repair diagnostic results will look like so...

```
{
    "KeyfaxData": {
        "Fault": {         
            "Repair": {
                "@name": "Repair1",
                "CompleteBy": "06/09/2022 10:15:18",
                "ResponseDays": "28",
                "Priority": "R",
                "PriorityId": "2105",
                "RepairCode": "INSP",
                "RepairCodeEx": "INSP",
                "RepairCodeDesc": "Inspection by Technical Officer",
                "UnitOfMeasure": "No",
                "UnitOfMeasureQuantity": "1",
                "Contractor": "T01",
                "IsDeleted": "False",
                "IsDirty": "False",
                "IsNew": "True"
            },           
        },
        "GUID": "e728783b-fe9f-40bf-9f39-5329d77161b7",
        "Status": "1"
    }
}
```

Notice the returned `Priority` and `PriorityId` properties. These are the important values you'll need to obtain to set or determine a priority within your host system. This will often be just the `Priority` property. This `Priority` property should correspond to an identifier for the priority you wish to set within your host system.

### Script Level

Within a Keyfax script if a service has already been added the priority for that service can be overriden as shown below\...

<figure><img src="/files/i9ScAiPQv1RFduFnTEbQ" alt=""><figcaption></figcaption></figure>

If a PRI action is set after the service is added this priority will override any priority set via the added service. The overridden priority will still be returned within the `RepairCode` property as shown above.

If a PRI action is set before the service is added or a PRI action is NOT set after the service is added within the Keyfax script then the priority associated with the service will be returned within the Keyfax results.

### Export XML

If Keyfax doesn't return services optional top level `Priority` and `PriorityId` properties can be returned within the Keyfax results to still allow script authors to set priorities for paticular scripts. These fields would need to be enabled within your Keyfax results. Please [Contact Us](/links/support.md) for assistance. &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keyfax.biz/integrations/project-considerations/handling-priorities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
