共用方式為


createTab (應用程式設定檔管理員)

在焦點工作階段中建立應用程式索引標籤,並傳回索引標籤的唯一識別碼。

語法

Microsoft.Apm.createTab(AppTabInput);

參數

名稱 Type Required 說明
應用程式索引標籤輸入 繩子 Yes 要建立之索引標籤的 JSON 輸入屬性。

JSON AppTabInput 參數的結構如下:

{
    //Unique Name of the Application Tab Template
    // type = string
    templateName: <unique name of the application tab template>;
    //additional context for tab creation and tab slugs
    // type  Map<string, string>
    appContext?:  Map<string, string>;
    //should this tab be focused after creation
    // type=boolean
    isFocused?: <true or false>;
}

返回值

索引標籤識別碼為字串。

範例

這些範例會使用該 createTab 方法來啟動新索引標籤。

建立基本索引標籤

在焦點工作階段中建立新索引標籤,並將實體名稱、recordId 和應用程式索引標籤範本名稱作為參數傳遞。

var tabInput = {templateName: "msdyn_entityrecord",  appContext: new Map().set("entityName", "account").set("entityId", " 22cc22cc-dd33-ee44-ff55-66aa66aa66aa"),  isFocused: true};
Microsoft.Apm.createTab(tabInput);

建立索引標籤,將值傳遞至實體表單

在焦點工作階段中建立新索引標籤,將實體名稱和應用程式索引標籤範本名稱作為參數傳遞。 它也會使用其他值填入目標實體表單。

var formParams = {};
formParams["subject"] = "Collaboration task";
formParams["actualdurationminutes"] = 60;
formParams["prioritycode"] = 2;
formParams["scheduledend"] = "12/12/2030 10:00"
formParams["regardingobjectid"] = "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb";
formParams["regardingobjectidname"] = "How do I measure my tamp pressure?";
formParams["regardingobjectidtype"] = "incident";

var tabInput = {
templateName: "msdyn_entityrecord",
appContext: new Map().set("entityName", "task").set("formId", "d5b4a1b2-de4f-4f86-8768-b0730001e7d1").set("data", JSON.stringify(formParams)),
isFocused: true
};
Microsoft.Apm.createTab(tabInput);

建立包含 Web 資源的索引標籤

在焦點工作階段中建立新索引標籤,將 Web 資源傳遞為應用程式索引標籤範本的參數。

var tabInput = {templateName: "msdyn_omnichannel_kbsearch", isFocused: true};
Microsoft.Apm.createTab(tabInput);

建立具有傳遞 Web 資源參數的 Web 資源索引標籤

在焦點工作階段中建立新索引標籤,將索引標籤範本和 Web 資源參數傳遞為應用程式索引標籤範本參數。

var tabInput = {
    templateName:"msdyn_omnichannel_kbsearch",
    appContext: new Map().set("data", "Contoso"),
    isFocused: true}; 
Microsoft.Apm.createTab(tabInput);

建立具有傳遞 Web 資源名稱和 Web 資源參數的 Web 資源索引標籤

在焦點工作階段中建立新索引標籤,將索引標籤範本、Web 資源名稱和 Web 資源參數傳遞為應用程式索引標籤範本參數。

var tabInput = {
    templateName:" new_tabtemplate_customwebresource",
     appContext: new Map().set("data", " Contoso ").set("webresourceName","msdyn_kbsearchpagehost.html"),
    isFocused: true}; 
Microsoft.Apm.createTab(tabInput);

使用 Power Apps 元件架構控制頁面建立索引標籤

在焦點工作階段中建立新的索引標籤,將架構控制項傳遞為應用程式索引標籤範本的參數。 控制項會從 API 呼叫傳遞。

var controlDataParams = {};
controlDataParams["<parameter>"] = "<Value>";

x = new Map();
x.set("<custom_session_context_params_key>", "<Value>");
x.set("parametersStr", '[["controlName", "<Control_Name>"], ["data",'+JSON.stringify(controlDataParams)+']]');

Microsoft.Apm.createSession(
    {
        templateName: "<template_name>",
        sessionContext: x
    });

您也可以傳遞下列參數:

var controlDataParams = {};
controlDataParams["<parameter>"] = "<Value>";

x = new Map();
x.set("<custom_session_context_params_key>", JSON.stringify(controlDataParams));
x.set("<additional_custom_session_params>", "<Value>");

Microsoft.Apm.createSession(
    {
        templateName: "<template_name>",
        sessionContext: x
    });