共用方式為


getGlobalContext.userSettings (用戶端 API 參考)

傳回目前使用者設定的相關資訊。

var userSettings = Xrm.Utility.getGlobalContext().userSettings

屬性

userSettings 物件具有下列屬性:

名稱 類型 Description
dateFormattingInfo 物件 傳回目前使用者的日期格式資訊。 請參閱 dateFormattingInfo
defaultDashboardId 字串 傳回目前使用者預設儀表板的識別碼。
isGuidedHelpEnabled 布爾 (bool) 是否為目前使用者啟用引導式說明。
isHighContrastEnabled 布爾 (bool) 是否為目前使用者啟用高對比。
isRTL 布爾 (bool) 目前使用者的語言是否為從右至左 (RTL) 語言。
languageId 數字 目前使用者的 LCID 語言代碼
roles 收藏 查閱物件的集合,包含指派給使用者之每個資訊安全角色的 GUID 和顯示名稱,以及指派給使用者相關聯之小組的任何資訊安全角色。 查看 角色
securityRolePrivileges 字串[] 字串陣列,代表使用者與之相關聯之每個資訊安全角色許可權或與使用者相關聯之任何小組的 GUID 值。
securityRoles 字串[] Deprecated. 使用屬性 roles
transactionCurrency 物件 包含idnameentityType目前使用者交易貨幣的物件。 參見 transactionCurrency
transactionCurrencyId 字串 Deprecated. 使用屬性transactionCurrency
userId 字串 目前使用者的 systemuser.systemuserid 值。
userName 字串 目前使用者的名稱。

dateFormattingInfo

具有日期格式相關字串屬性的物件,例如 FirstDayOfWeek、 、 LongDatePatternMonthDayPatternTimeSeparator、 等。

角色

集合包含物件,idname其中包含使用者相關聯之每個資訊安全角色或小組的屬性。

此屬性僅在統一介面上受支援。

交易貨幣

此方法僅在統一介面上受支援。

數據可能如下所示:

{id: "e7dd9bc6-d239-ea11-a813-000d3a35b14a", entityType: "transactioncurrency", name: "US Dollar"}

Methods

物件 userSettings 具有下列方法:

getSecurityRolePrivilegesInfo 方法

傳回 promise,該承諾會以索引鍵是資訊安全角色許可權 GUID 的物件解析,而值是包含businessUnitIddepthprivilegeName資訊安全角色許可權的物件。

語法

userSettings.getSecurityRolePrivilegesInfo().then(successCallback, errorCallback);

參數

名稱 類型 為必填項目 Description
successCallback 功能 擷取資訊安全角色權限資訊時要呼叫的函式。 字典會傳遞至成功回呼,其中資訊穩定角色許可權 GUID 會是索引鍵,而值會是包含下列屬性的物件:
id:繩子。 資訊安全角色許可權 GUID。
businessUnitId:繩子。 資訊安全角色權限之業務單位的 GUID。
privilegeName:繩子。 資訊安全角色權限名稱。
depth:繩子。 資訊穩定角色權限深度。
errorCallback 功能 作業失敗時要呼叫的函式。 將傳遞具有以下屬性的物件:
errorCode:數。 錯誤碼。
message:繩子。 描述問題的錯誤訊息。

傳回值

類型Promise<{[key: string]: {id: string, businessUnitId: string, privilegeName: string, depth: number}}>

成功時,傳回一個 promise 物件,其中包含上述 successCallback 參數描述中指定的值。

描述:GUID 和其他詳細資料,例如每個資訊安全角色許可權的業務單位和許可權名稱。

getSecurityRolePrivilegesInfo 範例

userSettings
  .getSecurityRolePrivilegesInfo()
  .then(function success(rolePrivileges) {
    var privilegeGuids = Object.keys(rolePrivileges);
    console.log("Privileges Count: " + privilegeGuids.length);

    // Print information about the first role privilege in the dictionary
    var guid = privilegeGuids[0];
    console.log("Privilege Id: " + rolePrivileges[guid].id);
    console.log("Privilege Name: " + rolePrivileges[guid].privilegeName);
    console.log("Privilege Business Unit Id: " + rolePrivileges[guid].businessUnitId);
    console.log("Privilege depth: " + rolePrivileges[guid].depth);
  });

getTimeZoneOffsetMinutes 方法

傳回當地時間與協調世界時間 (UTC) 之間的差異 (以分鐘為單位)。

語法

userSettings.getTimeZoneOffsetMinutes()

傳回值

類型:數字

描述:時區偏移量(以分鐘為單位)。

用戶端內容
組織設定
Xrm.Utility.getGlobalContext
使用者設定 (UserSettings) 表格