Smart Action Context

You can call Smart Actions on a Smart Action-enabled page using the Smart Action Context, which is accessible through the tabContext or recordContext.

To execute a Smart Action using UEF, the Smart Action ID is the minimum required input. For example, to start the "Log A Call" UI, you must specify its Smart Action ID, which is SDA-LogACall-serviceRequest, in the request object, which is shown in the examples that follow. Once the request object is published using UEF, the corresponding UI element for logging a call will be rendered. You can find specific Smart Action IDs on the Smart Action homepage. The syntax for Smart Action is also shown in the following example. The Smart Action Context should be retrieved from either the tab context or the record context, depending on the usage scenario.

Syntax

// To get smart action from tabContext 
tabContext.getSmartActionContext(): Promise<ISmartActionContext>; 

// To get smart action from recordContext 
recordContext.getSmartActionContext(): Promise<ISmartActionContext>;

Examples

Here's a Typescript example:

// <reference path="uiEventsFramework.d.ts"/>
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');  

// smart action context from record context
const recordContext: IRecordContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveRecord();  
const smartActionContext: ISmartActionContext = await recordContext.getSmartActionContext();

// smart action context from tab context
const tabContext: ITabContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveTab();  
const smartActionContext: ISmartActionContext = await tabContext.getSmartActionContext();

Here's a JavaScript example:

const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID');  
const recordContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveRecord();           

// smart action context from record context
const recordContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveRecord();  
const smartActionContext = await recordContext.getSmartActionContext();

// smart action context from tab context
const tabContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveTab();  
const smartActionContext = await tabContext.getSmartActionContext();

Supported Operations

Operation Name Description Example
ExecuteSmartAction Used to executeSmartAction. Publish

Supported Methods

Operation Name Description Example
Publish Publish an operation Smart Action context. Publish