createSession (upravitelj profilov aplikacije)

Ustvari sejo na podlagi predloge seje in vrne enolični identifikator seje.

Skladnja

Microsoft.Apm.createSession(SessionInput);

Parametrov

Imenu Type Zahtevano Description
Vnos seje Niz Da Vhodne lastnosti JSON seje, ki jo želite ustvariti.

Struktura parametra JSON SessionInput je naslednja:

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

Vrnjena vrednost

Identifikator seje kot niz.

Primeri

V teh primerih je metoda createSession uporabljena za ustvarjanje nove seje, ki kot parametre posreduje identifikator zapisa entitete in predlogo seje.

Ustvarjanje osnovne seje

Ustvari novo sejo, ki posreduje dogodek kot ime entitete, ID dogodka kot entityId in enolično ime predloge seje kot templateName.

opomba,

Uporabnik, ki sklicuje te metode, mora biti dodeljen profilu aplikacije, ki vsebuje predlogo seje.

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

Ustvarjanje seje, ki ni v fokusu

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