Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Tạo phiên dựa trên mẫu phiên và trả về mã định danh duy nhất của phiên.
Cú pháp
Microsoft.Apm.createSession(SessionInput);
Thông số
| Tên | Type | Bắt buộc | Mô tả |
|---|---|---|---|
| SessionInput | Xâu | Có | Thuộc tính đầu vào JSON của phiên sẽ được tạo. |
Cấu trúc của tham số JSON SessionInput như sau:
{
/**
* 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;
}
Giá trị trả về
Mã định danh phiên là String.
Ví dụ
Các ví dụ này sử dụng createSession phương thức này để tạo phiên mới, truyền mã định danh bản ghi thực thể và mẫu phiên làm tham số.
Tạo phiên cơ bản
Tạo một phiên mới chuyển sự cố dưới dạng tên thực thể, ID sự cố là entityId và tên duy nhất của mẫu phiên là templateName.
Lưu ý
Người dùng gọi các phương thức này phải được gán cho một hồ sơ ứng dụng có chứa mẫu phiên.
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});
Tạo một phiên không được tập trung
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});