Request Case Data for User

Scenario: Service + Commerce

For this example to work as it’s described, C360 Data Manager must have these configurations.

  • Data Sources: You must have connected the org you are developing in and the data source you want to query to Customer 360 Data Manager.
  • Mapping Version: You must have created a mapping version.
  • Mappings: You must have accepted the default mappings for two orgs or mapped the equivalent fields used in the example.

For this example to work as it’s described, the org you’re developing in must have these configurations.

  • Named Credential The DFS Named credential must be configured.
Resource
base url/dfs/v3.0/mds%2Fstmfp%2FMDS05pBm3yQNwbz/v19/Case?$select=CaseNumber,ClosedDateTime,CreatedDate,Description,ExternalRecordId,Id,LastModifiedDate,Subject,SystemModstamp&$expand=CasePriorityId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseStatusId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseTypeId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp)&$filter=ExternalRecordId eq 'GPID-002'&$orderby=CaseNumber
HTTP method
GET
Request parameters
dfs_api_version
DFS version 3.0
metadata_repository_key
Unique identifier for a data source mapping version.
metadata_version
Mapping version name. Replace this with your own mapping version in the example.
Code example
This returns the cases associated with an Individual across all mapped data sources.
1public class CaseStatusId {
2    public String LastModifiedDate;
3    public String Id;
4    public String SystemModstamp;
5    public String CreatedDate;
6    public String Name;
7}
8
9public class CimCase {
10    public String CaseNumber;
11    public String ClosedDateTime;
12    public String CreatedDate;
13    public String Description;
14    public String ExternalRecordId;
15    public String Id;
16    public String LastModifiedDate;
17    public String Subject;
18    public String SystemModstamp;
19    public CaseStatusId CaseStatusId;
20    public CaseStatusId CaseTypeId;
21    public CaseStatusId CasePriorityId;
22}
23
24Http http = new Http();
25HttpRequest request = new HttpRequest();
26String queryTest = 'Case?$select=CaseNumber,ClosedDateTime,CreatedDate,Description,ExternalRecordId,Id,LastModifiedDate,Subject,SystemModstamp&$expand=CasePriorityId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseStatusId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseTypeId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp)&$filter=ExternalRecordId%20eq%20%27GPID-002%27&$orderby=CaseNumber';
27//String queryTest = 'Case?$select=CaseNumber,ClosedDateTime,CreatedDate,Description,ExternalRecordId,Id,LastModifiedDate,Subject,SystemModstamp&$expand=CasePriorityId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseStatusId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp),CaseTypeId($select=CreatedDate,Id,LastModifiedDate,Name,SystemModstamp)&$orderby=CaseNumber';
28request.setEndpoint('callout:DFS/'+queryTest);
29request.setMethod('GET');
30HttpResponse response = http.send(request);
31System.debug(response.getBody());
32
33JSONParser parser = JSON.createParser(response.getBody());
34while (parser.nextToken() != null) {
35    // Start at the array of cases
36    if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
37        while (parser.nextToken() != null) {
38            // Advance to the start object marker to find next case object.
39            if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
40                // Read entire invoice object, including its array of line items.
41                CimCase cc = (CimCase)parser.readValueAs(CimCase.class);
42                //System.debug(cc);
43
44                // For debugging purposes, serialize again to verify what was parsed.
45                //String s = JSON.serializePretty(cc);
46                //system.debug('Serialized case: ' + s);                
47                
48                 System.debug('CASE RECORD:' +
49                    '\nGlobal Party Id: ' + cc.ExternalRecordId +
50                    '\nCase Id: ' + cc.Id +
51                    '\nCase Number: ' + cc.CaseNumber +
52                    '\nSubject: ' + cc.Subject +
53                    '\nCase Status: ' + cc.CaseStatusId.Name +
54                    '\nCase Type: ' + cc.CaseTypeId.Name +
55                    '\nCase Priority: ' + cc.CasePriorityId.Name +
56                    '\nDescription: ' + cc.Description +
57                    '\nCreated Date: ' + cc.CreatedDate +
58                    '\nClosed Date Time: ' + cc.ClosedDateTime +
59                    '\nLast Modified Date: ' + cc.LastModifiedDate +
60                    '\nSystem Modified Stamp: ' + cc.SystemModstamp + '\n');
61                
62                // Skip the child start array and start object markers.
63                parser.skipChildren();
64            }
65        }
66    }
67}
Returns
Returns the following data.
1{
2  "@odata.context": "<base url>/dfs/v3.0/mds%2Fstmpa%2FMDS05pBm3yQNwbz/v21/$metadata#Case (http://dfs-lbdv.retail-dfs.prd-sam.prd.slb.sfdc.net:7024/dfs/v3.0/mds%2Fstmfa%2FMDS05pBm3yQNwbz/v21/$metadata#Case)",
3  "value": [
4    {
5      "CaseNumber": "00001003",
6      "CaseStatusId": {
7        "LastModifiedDate": "2019-12-12T07:08:39.000Z",
8        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000001xChXYAU",
9        "SystemModstamp": "2019-12-12T07:08:39.000Z",
10        "CreatedDate": "2019-10-18T23:06:47.000Z",
11        "Name": "New"
12      },
13      "LastModifiedDate": "2019-12-12T07:08:39.000Z",
14      "Description": "[NA Service Org] This is Ian's problem.",
15      "CaseTypeId": {
16        "LastModifiedDate": "2019-12-12T07:08:39.000Z",
17        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000001xChXYAU",
18        "SystemModstamp": "2019-12-12T07:08:39.000Z",
19        "CreatedDate": "2019-10-18T23:06:47.000Z",
20        "Name": "Problem"
21      },
22      "ExternalRecordId": "GPID-002",
23      "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000001xChXYAU",
24      "CasePriorityId": {
25        "LastModifiedDate": "2019-12-12T07:08:39.000Z",
26        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000001xChXYAU",
27        "SystemModstamp": "2019-12-12T07:08:39.000Z",
28        "CreatedDate": "2019-10-18T23:06:47.000Z",
29        "Name": "Medium"
30      },
31      "Subject": "[NA Service Org] Ian's got a problem!",
32      "SystemModstamp": "2019-12-12T07:08:39.000Z",
33      "CreatedDate": "2019-10-18T23:06:47.000Z"
34    },
35    {
36      "CaseNumber": "00001004",
37      "CaseStatusId": {
38        "LastModifiedDate": "2019-12-12T06:41:56.000Z",
39        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000001xE8fYAE",
40        "SystemModstamp": "2019-12-12T06:41:57.000Z",
41        "CreatedDate": "2019-11-13T06:08:09.000Z",
42        "Name": "On Hold"
43      },
44      "LastModifiedDate": "2019-12-12T06:41:56.000Z",
45      "Description": "[EMEA Service Org] This is a very detailed description of the feature Ian wants because of his problem.",
46      "CaseTypeId": {
47        "LastModifiedDate": "2019-12-12T06:41:56.000Z",
48        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000001xE8fYAE",
49        "SystemModstamp": "2019-12-12T06:41:57.000Z",
50        "CreatedDate": "2019-11-13T06:08:09.000Z",
51        "Name": "Feature Request"
52      },
53      "ExternalRecordId": "GPID-002",
54      "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000001xE8fYAE",
55      "CasePriorityId": {
56        "LastModifiedDate": "2019-12-12T06:41:56.000Z",
57        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000001xE8fYAE",
58        "SystemModstamp": "2019-12-12T06:41:57.000Z",
59        "CreatedDate": "2019-11-13T06:08:09.000Z",
60        "Name": "High"
61      },
62      "Subject": "[EMEA Service Org] Ian wants a new feature",
63      "SystemModstamp": "2019-12-12T06:41:57.000Z",
64      "CreatedDate": "2019-11-13T06:08:09.000Z"
65    },
66    {
67      "CaseNumber": "00001004",
68      "CaseStatusId": {
69        "LastModifiedDate": "2020-04-14T22:02:51.000Z",
70        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000002i1lNYAQ",
71        "SystemModstamp": "2020-04-14T22:02:51.000Z",
72        "CreatedDate": "2020-04-14T22:02:51.000Z",
73        "Name": "New"
74      },
75      "LastModifiedDate": "2020-04-14T22:02:51.000Z",
76      "CaseTypeId": {
77        "LastModifiedDate": "2020-04-14T22:02:51.000Z",
78        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000002i1lNYAQ",
79        "SystemModstamp": "2020-04-14T22:02:51.000Z",
80        "CreatedDate": "2020-04-14T22:02:51.000Z",
81        "Name": "Question"
82      },
83      "ExternalRecordId": "GPID-002",
84      "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000002i1lNYAQ",
85      "CasePriorityId": {
86        "LastModifiedDate": "2020-04-14T22:02:51.000Z",
87        "Id": "core__stmfana44ice1__00DRM000000FCN22AO___500RM000002i1lNYAQ",
88        "SystemModstamp": "2020-04-14T22:02:51.000Z",
89        "CreatedDate": "2020-04-14T22:02:51.000Z",
90        "Name": "Medium"
91      },
92      "Subject": "[NA Service Org] Ian wants to know how to call Data Federation Service",
93      "SystemModstamp": "2020-04-14T22:02:51.000Z",
94      "CreatedDate": "2020-04-14T22:02:51.000Z"
95    },
96    {
97      "CaseNumber": "00001005",
98      "CaseStatusId": {
99        "LastModifiedDate": "2020-04-14T22:12:25.000Z",
100        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000002i1lSYAQ",
101        "SystemModstamp": "2020-04-14T22:12:25.000Z",
102        "CreatedDate": "2020-04-14T22:12:25.000Z",
103        "Name": "On Hold"
104      },
105      "LastModifiedDate": "2020-04-14T22:12:25.000Z",
106      "CaseTypeId": {
107        "LastModifiedDate": "2020-04-14T22:12:25.000Z",
108        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000002i1lSYAQ",
109        "SystemModstamp": "2020-04-14T22:12:25.000Z",
110        "CreatedDate": "2020-04-14T22:12:25.000Z",
111        "Name": "Question"
112      },
113      "ExternalRecordId": "GPID-002",
114      "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000002i1lSYAQ",
115      "CasePriorityId": {
116        "LastModifiedDate": "2020-04-14T22:12:25.000Z",
117        "Id": "core__stmfana44ice1__00DRM000000FCNU2A4___500RM000002i1lSYAQ",
118        "SystemModstamp": "2020-04-14T22:12:25.000Z",
119        "CreatedDate": "2020-04-14T22:12:25.000Z",
120        "Name": "Low"
121      },
122      "Subject": "[EMEA Service Org] Ian wants to know how to change his language preference",
123      "SystemModstamp": "2020-04-14T22:12:25.000Z",
124      "CreatedDate": "2020-04-14T22:12:25.000Z"
125    },
126    {
127      "CaseNumber": "00001005",
128      "CaseStatusId": {
129        "LastModifiedDate": "2019-12-12T07:18:11.000Z",
130        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002g8uuYAA",
131        "SystemModstamp": "2019-12-12T07:18:12.000Z",
132        "CreatedDate": "2019-11-13T06:13:38.000Z",
133        "Name": "Escalated"
134      },
135      "LastModifiedDate": "2019-12-12T07:18:11.000Z",
136      "Description": "[APAC Service Org] Ian called asking when his feature to fix his problem will be implemented.",
137      "CaseTypeId": {
138        "LastModifiedDate": "2019-12-12T07:18:11.000Z",
139        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002g8uuYAA",
140        "SystemModstamp": "2019-12-12T07:18:12.000Z",
141        "CreatedDate": "2019-11-13T06:13:38.000Z",
142        "Name": "Question"
143      },
144      "ExternalRecordId": "GPID-002",
145      "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002g8uuYAA",
146      "CasePriorityId": {
147        "LastModifiedDate": "2019-12-12T07:18:11.000Z",
148        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002g8uuYAA",
149        "SystemModstamp": "2019-12-12T07:18:12.000Z",
150        "CreatedDate": "2019-11-13T06:13:38.000Z",
151        "Name": "Low"
152      },
153      "Subject": "[APAC Service Org] Ian wants to know when his feature will be implemented",
154      "SystemModstamp": "2019-12-12T07:18:12.000Z",
155      "CreatedDate": "2019-11-13T06:13:38.000Z"
156    },
157    {
158      "CaseNumber": "00001006",
159      "CaseStatusId": {
160        "LastModifiedDate": "2020-04-14T22:15:56.000Z",
161        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002mRLfYAM",
162        "SystemModstamp": "2020-04-14T22:15:56.000Z",
163        "CreatedDate": "2020-04-14T22:15:56.000Z",
164        "Name": "Escalated"
165      },
166      "LastModifiedDate": "2020-04-14T22:15:56.000Z",
167      "CaseTypeId": {
168        "LastModifiedDate": "2020-04-14T22:15:56.000Z",
169        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002mRLfYAM",
170        "SystemModstamp": "2020-04-14T22:15:56.000Z",
171        "CreatedDate": "2020-04-14T22:15:56.000Z",
172        "Name": "Problem"
173      },
174      "ExternalRecordId": "GPID-002",
175      "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002mRLfYAM",
176      "CasePriorityId": {
177        "LastModifiedDate": "2020-04-14T22:15:56.000Z",
178        "Id": "core__stmfana44ice1__00DRM000000FOWV2A4___500RM000002mRLfYAM",
179        "SystemModstamp": "2020-04-14T22:15:56.000Z",
180        "CreatedDate": "2020-04-14T22:15:56.000Z",
181        "Name": "High"
182      },
183      "Subject": "[APAC Service Org] Ian is experiencing slow UI responses",
184      "SystemModstamp": "2020-04-14T22:15:56.000Z",
185      "CreatedDate": "2020-04-14T22:15:56.000Z"
186    }
187  ]
188}