getServiceRequest(serviceRequestId)

Retrieve a persisted service request aggregate, including the anchor, custom attributes, and product attributes, by its catalog request ID or anchor record ID. Map values are returned as raw collections.

API Version

63.0

Requires Chatter

No

Signature

public static ConnectApi.ServiceRequestGetOutput getServiceRequest(String serviceRequestId)

1ConnectApi.ServiceAutomationFamily, getServiceRequest, [String], ConnectApi.ServiceRequestGetOutputRepresentation

Parameters

serviceRequestId
Type: String
ID of the service request to fetch.

Return Value

Type: ConnectApi.ServiceRequestGetOutputRepresentation

Returns the current details of the specified service request.

Usage

To use the ServiceAutomationFamily methods, enable Unified Catalog in your org.

Example

Here's an example that demonstrates how to retrieve a service catalog request using Apex.

1// ID of the service catalog request to retrieve
2String serviceRequestId = '946SB0000009QTAYA2';
3
4ConnectApi.ServiceRequestGetOutput result =
5    ConnectApi.ServiceAutomationFamily.getServiceRequest(serviceRequestId);
6
7// anchor and custom attributes defined for the catalog item
8Map<String, Object> customAttributes = result.customAttributes;
9System.debug('Custom Attributes: ' + customAttributes);
10
11// context record tree
12Map<String, Object> anchor = result.anchor;
13System.debug('Anchor: ' + anchor);
14
15// Product attributes
16Map<String, String> productAttributes = result.productAttributes;
17System.debug('Product Attributes: ' + productAttributes);