IFieldValueCollection

This field will contain the collection of fields that we get in GetFieldValue operation response.It uses the getField method.

The getField method will fetch a particular field's data in the GetFieldValue operation response.

The following code sample shows the syntax for getField method.
getField: (fieldName: string) => IFieldData;

Parameters

Here's the parameter for this method:
Parameter Required? Description
fieldName Yes Name of a particular field of which data we need to retrieve from the GetFieldValue Operation Response
The following code sample shows an example in Typescript for publishing GetFieldValue Operation where getField method is used.
/// <reference path="uiEventsFramework.d.ts"/> 
      const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1'); 
      const tabContext: ITabContext = await frameworkProvider.getTabContext();
      const recordContext: IRecordContext = await tabContext.getActiveRecord();     
       
      const requestObject: IGetFieldValueOperationRequest = (frameworkProvider.requestHelper.createPublishRequest('cxEventBusGetFieldValueOperation') as IGetFieldValueOperationRequest);
      requestObject.setFields(['ServiceRequest.Title','ServiceRequest.ProblemDescription']);
      
      recordContext.publish(requestObject).then((message) => {
          const response = message as IGetFieldValueResponse;
          console.log(response.getResponseData().getField('ServiceRequest.Title')) // usage of getField method
      })
      .catch((error: IErrorData) => {
          // error
      }); 
The following code sample shows an example in JavaScript for publishing GetFieldValue Operation where getFieldName method is used.
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1'); 
      const tabContext = await frameworkProvider.getTabContext();
      const recordContext = await tabContext.getActiveRecord();       
      const requestObject = frameworkProvider.requestHelper.createPublishRequest('cxEventBusGetFieldValueOperation');
      requestObject.setFields(['ServiceRequest.Title','ServiceRequest.ProblemDescription']);
      recordContext.publish(requestObject).then((message) => { 
          console.log(response.getResponseData().getField('ServiceRequest.Title')) // usage of getField method
      })
      .catch((error) => {
          // error
      });