IGetAgentInfoResponse

The response object while retrieving logged-in agent's information.

Functions

getFirstName

Use this function to get the first name of logged in agent.

Here's the syntax:
getFirstName(): string;
The following code sample shows an example in Typescript for getting agent's first name using getFirstName method.
/// <reference path="uiEventsFramework.d.ts"/>   
  const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');      
  const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
  const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest; 
  globalContext.publish(requestObject).then((message: IOperationResponse) => { 
       const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
      console.log(response.getFirstName()); // usage of getFirstName
  });
  

The following code sample shows an example in JavaScript for getting agent's first name using getFirstName method.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
  const globalContext = await frameworkProvider.getGlobalContext();
  const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo');
  globalContext.publish(requestObject).then((response) => {
      console.log(response.getFirstName());
  });

getLastName

Use this function to get the last name of logged in agent.

Here's the syntax:
getLastName(): string;
The following code sample shows an example in Typescript for getting agent's last name using getLastName method.
/// <reference path="uiEventsFramework.d.ts"/>
       
  const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');      
  const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
  const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest; 
  globalContext.publish(requestObject).then((message: IOperationResponse) => { 
       const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
      console.log(response.getLastName()); // usage of getLastName
  });
  

The following code sample shows an example in JavaScript for getting agent's last name using getLastName method.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
  const globalContext = await frameworkProvider.getGlobalContext();
  const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo');
  globalContext.publish(requestObject).then((response) => {
      console.log(response.getLastName());
  });

getEmailAddress

Use this function to get the email address of signed in agent.

Here's the syntax:
getEmailAddress(): string;
The following code sample shows an example in Typescript for getting agent's email address using getEmailAddress method.
/// <reference path="uiEventsFramework.d.ts"/>
       
  const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');      
  const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
  const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest; 
  globalContext.publish(requestObject).then((message: IOperationResponse) => { 
       const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
      console.log(response.getEmailAddress()); // usage of getEmailAddress
  });

The following code sample shows an example in JavaScript for getting agent's email address using getEmailAddress method.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
  const globalContext = await frameworkProvider.getGlobalContext();
  const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo');
  globalContext.publish(requestObject).then((response) => {
      console.log(response.getEmailAddress());
  });
  

getUserName

Use this function to get the user name of the signed in agent.

Here's the syntax:
getUserName(): string;
The following code sample shows an example in Typescript for getting the agent's user name using getUserName method.
/// <reference path="uiEventsFramework.d.ts"/>
       
  const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');      
  const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
  const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest; 
  globalContext.publish(requestObject).then((message: IOperationResponse) => { 
       const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
      console.log(response.getUserName()); // usage of getUserName
  });

The following code sample shows an example in JavaScript for getting the agent's user name using getUserName method.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
  const globalContext = await frameworkProvider.getGlobalContext();
  const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo');
  globalContext.publish(requestObject).then((response) => {
      console.log(response.getUserName());
  });
  

getPartyId

Use this function to get the party ID of the signed in agent.

Here's the syntax:
getUserName(): string;
The following code sample shows an example in Typescript for getting agent's party ID using getPartyId method.
/// <reference path="uiEventsFramework.d.ts"/>
       
  const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');      
  const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();
  const requestObject: IOperationRequest = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo') as CX_SVC_UI_EVENTS_FRAMEWORK.IOperationRequest; 
  globalContext.publish(requestObject).then((message: IOperationResponse) => { 
       const response: IGetAgentInfoResponse = message as IGetAgentInfoResponse;
      console.log(response.getPartyId()); // usage of getPartyId
  });

The following code sample shows an example in JavaScript for getting agent's party ID using getPartyId method.

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
  const globalContext = await frameworkProvider.getGlobalContext();
  const requestObject = frameworkProvider.requestHelper.createPublishRequest('GetAgentInfo');
  globalContext.publish(requestObject).then((response) => {
      console.log(response.getPartyId());
  });