createSession (pengelola profil aplikasi)

Membuat sesi berdasarkan templat sesi dan mengembalikan pengidentifikasi unik sesi.

Syntax

Microsoft.Apm.createSession(SessionInput);

Parameter-parameternya

Nama Tipe Diperlukan Description
Masukan Sesi String Yes Properti input JSON dari sesi yang akan dibuat.

Struktur parameter JSON SessionInput adalah sebagai berikut:

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

Mengembalikan nilai

Pengidentifikasi sesi sebagai String.

Examples

Contoh-contoh ini menggunakan createSession metode untuk membuat sesi baru yang meneruskan pengidentifikasi rekaman entitas dan templat sesi sebagai parameter.

Membuat sesi dasar

Membuat sesi baru yang meneruskan insiden sebagai nama entitas, Id insiden sebagai entityId, dan nama unik templat sesi sebagai templateName.

Nota

Pengguna yang memanggil metode ini harus ditetapkan ke profil aplikasi yang berisi templat sesi.

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

Membuat sesi yang tidak 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});