Get Work Type Groups

After authentication, you need to show the work type groups for the user to select. A work type group represents a general appointment category or topic, such as a home loan or investment.

Create a page in your app where you can show the work type groups from your org. Use the Query() method on the WorkTypeGroup object to retrieve a list of work type groups.

Sample Request

This sample REST API call uses the Query() request to retrieve work type groups. For more information, see Execute a SOQL Query.

1https://yourInstance.salesforce.com/services/data/vXX.X/query/?q=SELECT+Id,+Name+From+WorkTypeGroup
2+Where+isActive+=+true+ORDER+BY+NAME

You can use the toLabel method to translate the SOQL query results in the language of the user. For more information, see Translate SOQL Query Results.

Sample Response

The request returns the available work type groups from your org.

1{
2  "totalSize": 6,
3  "done": true,
4  "records": [
5    {
6      "attributes": {
7        "type": "WorkTypeGroup",
8        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000L6XeOAK"
9      },
10      "Id": "0VSB0000000L6XeOAK",
11      "Name": "General Banking Group"
12    },
13    {
14      "attributes": {
15        "type": "WorkTypeGroup",
16        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000L6XyOAK"
17      },
18      "Id": "0VSB0000000L6XyOAK",
19      "Name": "Insurance Management"
20    },
21    {
22      "attributes": {
23        "type": "WorkTypeGroup",
24        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000L71HOAS"
25      },
26      "Id": "0VSB0000000L71HOAS",
27      "Name": "Investments"
28    },
29    {
30      "attributes": {
31        "type": "WorkTypeGroup",
32        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000L6Y3OAK"
33      },
34      "Id": "0VSB0000000L6Y3OAK",
35      "Name": "Loan Planning"
36    },
37    {
38      "attributes": {
39        "type": "WorkTypeGroup",
40        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000TbhWOAS"
41      },
42      "Id": "0VSB0000000TbhWOAS",
43      "Name": "LSConcurrent Work Type Group"
44    },
45    {
46      "attributes": {
47        "type": "WorkTypeGroup",
48        "url": "/services/data/vXX.X/sobjects/WorkTypeGroup/0VSB0000000L6Y4OAK"
49      },
50      "Id": "0VSB0000000L6Y4OAK",
51      "Name": "Wealth Planning"
52    }
53  ]
54}

Parse the JSON response, and display the work type groups on a page in your app so that users can select a work type group for the appointment. Here’s how that page can look.

A representation of the Select Work Type Group screen.

On the next page in your app, you can provide users an option to search for service territories.