當用戶在我們的SCA Mont Blanc網站註冊時,我們需要在創建用戶之前檢查其電子郵件是否唯一。因此,我們編輯[email protected]/SuiteScript/Account.Model.js
文件,以便在註冊新用戶之前檢查具有特定電子郵件地址的任何用戶的Customer
表。從SCA SuiteScript內部訪問客戶表
的問題是:該腳本的作用Customer Center
下執行,它並沒有權限查看/查詢Customer
表。所以我們的檢查崩潰了腳本。
如何在用戶註冊時訪問Customer
表(特別是文件[email protected]/SuiteScript/Account.Model.js
)?是否有任何解決方案/建議可以提供,因爲我很堅持:(
我已經試過的東西:
- 更改角色/服務文件
services/Account.Register.Service.ss
的權限下,我創建了一個新的角色執行所謂Webstore User
不幸導致登錄頁面顯示錯誤;You do not have permission to view this page
也許我沒有改變正確的文件或設置創建過的Customer Centre
加view
權限的所有權限Customers
一個新的角色,新角色正確 - ? 。但是同樣的錯誤如上
[email protected]/SuiteScript/Account.Model.js
...
return SCModel.extend({
name: 'Account'
, register: function (user_data)
{
// Check if there is already a user/customer with this email address
// The below function will crash the script because
// the script cannot access the 'customer' table
var emailDulicates = nlapiSearchRecord('customer', null,
new nlobjSearchFilter('email', null, 'is', ''+user_data.email));
if (emailDulicates && emailDulicates.length > 0) {
Application.sendError({"Email already taken."});
return false;
}
... continue on to register user
}
});
非常感謝您的建議:)我會給它一個去。當你說調用'nlapiRequestURL()'我假設你的意思是我叫這個服務器端(在我的'SuiteScript/Account.Model.js')?或者我把這種客戶端稱爲常規服務(即,在我的骨幹視圖或模型中)? –
在你的SCA體驗中,你遇到過我描述的會話錯誤[這裏](http://stackoverflow.com/questions/43600707/sca-webstore-session-bugs)?這是SCA的東西嗎?如果沒有,我的新/重寫模塊中有一些錯誤。 –