createSession (appprofilhanterare)

Skapar en session baserat på en sessionsmall och returnerar den unika identifieraren för sessionen.

Syntax

Microsoft.Apm.createSession(SessionInput);

Parameterar

Namn Typ Krävs Description
SessionInput (SessionIngång) String Yes JSON-indataegenskaper för den session som ska skapas.

Strukturen för JSON-parametern SessionInput är följande:

{
        /**
         * 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;
    }

Returvärde

Sessionsidentifierare som String.

Examples

I de här exemplen används metoden createSession för att skapa en ny session och skicka en entitetspostidentifierare och en sessionsmall som parametrar.

Skapa en grundläggande session

Skapar en ny session som skickar incidenten som entitetsnamn, incident-ID som entityId och unikt namn på sessionsmallen som templateName.

Anmärkning

Användaren som anropar dessa metoder måste tilldelas en appprofil som innehåller sessionsmallen.

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});

Skapa en session som inte är i fokus

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});