Generate the Request Object

The requestObject is used by the publish or subscribe API.

The request object has information about the name of the interested event or operation and the data required for event subscription or publish operation. For example, say you want to update the title field. For that, you create a request object as shown in the following example and publish it with the publish API: publish ( requestObject ).

requestObject = frameworkProvider.requestHelper.createPublishRequest('cxEventBusSetFieldValueOperation')
requestObject.field().setField('ServiceRequest.Title').setValue('SR1') // setting a value

Now, say you wanted to get notified of changes in the title and problem description field. In this case, you must create the request object with details of the event name, field name title, and problem description as shown in the following example:

requestObject = 
frameworkProvider.requestHelper.createSubscriptionRequest('cxEventBusFieldValueChangeEvent') 
requestObject.setFields(['ServiceRequest.Title','ServiceRequest.ProblemDescription']) 
//  interested fields to be subscribed
The usage of the requestObject's exposed methods varies with events and operations. The following sample shows some scenarios of requestObject:
const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
const tabContext: ITabContext = await  frameworkProvider.getTabContext(browserTabId);
const availableRecords: IRecordContext[] = await frameworkProvider.getAvailableRecords();