Get Work Type

Default to the work type that is associated with the service territory and work type group.

A work type group represents a general appointment category or topic, such as a home loan or investment.

  1. Use the Query() request on the WorkTypeGroupMember object to retrieve the work types associated with the work type group selected on the Select Work Type Group screen.

    Sample Request

    This sample REST API call uses the Query() request to retrieve the work types.

    1https://YOUR_INSTANCE.salesforce.com/services/data/vXX.X/query/?q=
    2SELECT+WorkTypeId,WorkType.Name+FROM+WorkTypeGroupMember+WHERE+WorkTypeGroupId+=+'0VSx000000014DmGAI'

    Where YOUR_INSTANCE is a variable.

    Sample Response

    The request returns the work type records.

    1{
    2  "totalSize": 2,
    3  "done": true,
    4  "records": [
    5    {
    6      "attributes": {
    7        "type": "WorkTypeGroupMember",
    8        "url": "/services/data/v55.0/sobjects/WorkTypeGroupMember/0Wzx000000013tICAQ"
    9      },
    10      "WorkTypeId": "08qx000000014fnAAA",
    11      "WorkType": {
    12        "attributes": {
    13          "type": "WorkType",
    14          "url": "/services/data/v55.0/sobjects/WorkType/08qx000000014fnAAA"
    15        },
    16        "Name": "WT 3"
    17      }
    18    },
    19    {
    20      "attributes": {
    21        "type": "WorkTypeGroupMember",
    22        "url": "/services/data/v55.0/sobjects/WorkTypeGroupMember/0Wzx000000013tJCAQ"
    23      },
    24      "WorkTypeId": "08qx000000014fwAAA",
    25      "WorkType": {
    26        "attributes": {
    27          "type": "WorkType",
    28          "url": "/services/data/v55.0/sobjects/WorkType/08qx000000014fwAAA"
    29        },
    30        "Name": "WT 4"
    31      }
    32    }
    33  ]
    34}
  2. Use the Query() request on the ServiceTerritoryWorkType object by specifying the work type records retrieved in the previous step to default the work type based on the selected service territory and work type group.

    Sample Request

    This sample REST API call uses the Query() request to default the work type.

    1https://YOUR_INSTANCE.salesforce.com/services/data/vXX.X/query/?q=
    2SELECT+WorkTypeId,WorkType.Name+FROM+ServiceTerritoryWorkType+WHERE+ServiceTerritoryId+=+'0Hhx000000012oSCAQ'+AND+WorkTypeId+IN+('08qx000000014fnAAA','08qx000000014fwAAA')

    Where YOUR_INSTANCE is a variable.

    Sample Response

    The request returns the work type records.

    1{
    2  "totalSize": 1,
    3  "done": true,
    4  "records": [
    5    {
    6      "attributes": {
    7        "type": "ServiceTerritoryWorkType",
    8        "url": "/services/data/v55.0/sobjects/ServiceTerritoryWorkType/0VEx00000001Ag4GAE"
    9      },
    10      "WorkTypeId": "08qx000000014fnAAA",
    11      "WorkType": {
    12        "attributes": {
    13          "type": "WorkType",
    14          "url": "/services/data/v55.0/sobjects/WorkType/08qx000000014fnAAA"
    15        },
    16        "Name": "WT 3"
    17      }
    18    }
    19  ]
    20}

On the next page in your app, you can show the service resources and their availability.