Anonymous Window Call Class and IP

Calling a meth

// Replace with your actual OrderItem Id if needed
Id orderItemId = '802Dk000002cZopIAE';

Map<String, Object> inputMap = new Map<String, Object>{
    'OrderItemId' => orderItemId
};
Map<String, Object> outMap = new Map<String, Object>();
Map<String, Object> options = new Map<String, Object>();

HeplperClass helper = new HeplperClass();
Map<String, Object> result = helper.helperMethod(inputMap, outMap, options);

// Debug the result
System.debug('### Final Result: ' + JSON.serializePretty(result));
System.debug('### Output Map: ' + JSON.serializePretty(outMap));

Call IP

// Replace with your actual Integration Procedure API Name
String ipName = 'Your_Integration_Procedure_API_Name';

// Prepare input parameters
Map<String, Object> inputMap = new Map<String, Object>{
    'key1' => 'value1',
    'key2' => 'value2'
};

// Prepare the full input wrapper
Map<String, Object> inputWrapper = new Map<String, Object>{
    'input' => inputMap
};

// Encode the input as JSON
String inputJson = JSON.serialize(inputWrapper);

// Set up the request to call the Integration Procedure
HttpRequest req = new HttpRequest();
req.setEndpoint(URL.getOrgDomainUrl().toExternalForm() + '/services/apexrest/vlocity_cmt/v1/integrationprocedure/' + ipName);
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setBody(inputJson);

// Send the request
Http http = new Http();
HTTPResponse res = http.send(req);

// Log the response
System.debug('Response Status: ' + res.getStatus());
System.debug('Response Body: ' + res.getBody());

Last updated