适用于 Dynamics 365 渠道集成框架 2.0 的 createTab(JavaScript API 参考)

注释

仅当焦点会话属于提供程序,或者它是主会话或默认会话时,才使用此 API。

在焦点会话中创建选项卡,并返回所创建选项卡的唯一标识符。

Syntax

Microsoft.CIFramework.createTab(input, correlationId).then(successCallback, errorCallback);

参数

名称 类型 Required 说明
输入 String 是的 JSON 输入
success回调 功能 创建记录时要调用的函数。 响应中返回已创建选项卡的唯一标识符(选项卡 ID)。
errorCallback 功能 作失败时要调用的函数。 将传递具有以下属性的对象:
errorCode:数字。 错误代码。
message:字符串。 描述问题的错误消息。

参数 JSON 的 input 结构如下:

{
    //Unique name of the tab 
    // type = string
    templateName: <unique name of the tab template>;

    //additional context for tab creation and tab slugs
    // type = JSON Object
    templateParameters?:<>
    
    //should this tab be focused after the creation
    // type=boolean
    isFocused?: <true or false>;
}

返回值

Promise,选项卡 ID 的值为 String

Example

var tabInput = {
    //Unique Name of the Application Tab Template
    // type = string
    templateName: "msdyn_test_entity",
    templateParameters: {
    entityName: "incident",
    data: "{}",
    },
    isFocused: true
};
Microsoft.CIFramework.createTab(tabInput).then((tabId)=>{
    console.log("created tab with id" + tabId);
}, (error)=>{
    console.log(error);
});