createSession (správca profilov aplikácie)

Vytvorí reláciu na základe šablóny relácie a vráti jedinečný identifikátor relácie.

Syntax

Microsoft.Apm.createSession(SessionInput);

Parametre

Názov Typ Požaduje sa Popis
Vstup relácie Povrázok Áno Vstupné vlastnosti JSON relácie, ktorá sa má vytvoriť.

Štruktúra parametra JSON SessionInput je nasledovná:

{
        /**
         * Returns the name of the template used in the session
         */
        templateName: string;
        /**
         * additional information for session creation
         */
        sessionContext: Map<string, string>;
        /**
         * will focus after session is created
         */
        isFocused?: boolean;
        /**
         * Indicates whether the session should be restored after creation.
         * If set to true, the session is restored in the agent workspace. Else, the session is created without being restored.
         */
        shouldRestore?: boolean;
    }

Vrátená hodnota

Identifikátor relácie ako reťazec.

Príklady

V týchto príkladoch sa metóda createSession používa na vytvorenie novej relácie, ktorá ako parametre odovzdá identifikátor záznamu entity a šablónu relácie.

Vytvorenie základnej relácie

Vytvorí novú reláciu, ktorá odovzdáva incident ako názov entity, ID incidentu ako entityId a jedinečný názov šablóny relácie ako templateName.

Poznámka

Používateľ, ktorý vyvolá tieto metódy, musí byť priradený k profilu aplikácie, ktorý obsahuje šablónu relácie.

x=new Map();
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "11bb11bb-cc22-dd33-ee44-55ff55ff55ff"]]');
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x});

Vytvorenie relácie, ktorá nie je zameraná

x=new Map(); 
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "22cc22cc-dd33-ee44-ff55-66aa66aa66aa"]]'); 
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x, isFocused: false});