Encryption 加载时修改Netsuite对象

Encryption 加载时修改Netsuite对象,encryption,netsuite,Encryption,Netsuite,我对Netsuite很陌生。我正在尝试在Netsuite中进行加密。当我在提交之前添加UserEvent脚本时,它会起作用。但是我想在beforeLoad函数中解密加密的文本。我能够读取加密文本并成功解密。但是在对象中设置它失败了,我在Netsuite UI中看到了解密的文本。感谢您的指导和帮助 谢谢 //此功能有效 提交前的函数(类型){ } //本文件打印“提交前修改”customercare@abc.com延长寿命。customercare@abc.com" //这个函数不起作用;即使日志

我对Netsuite很陌生。我正在尝试在Netsuite中进行加密。当我在提交之前添加UserEvent脚本时,它会起作用。但是我想在beforeLoad函数中解密加密的文本。我能够读取加密文本并成功解密。但是在对象中设置它失败了,我在Netsuite UI中看到了解密的文本。感谢您的指导和帮助

谢谢

//此功能有效

提交前的函数(类型){

}

//本文件打印“提交前修改”customercare@abc.com延长寿命。customercare@abc.com"

//这个函数不起作用;即使日志中正确打印了正确的值

加载前的函数(类型、表单、请求){

}


//本文件打印“在负载寿命前修改”。customercare@abc.com到customercare@abc.com“…但我仍然看到寿命。customercare@abc.com在用户界面中,我建议您在客户端脚本(PageInit和SaveRecord事件)中尝试此代码

对我来说很好

我的代码:

function PageInit(type) {
try {
    if (type == 'edit') {
        var email = nlapiGetFieldValue('email');
        if (email != null && email.indexOf('LifeSpan.') != -1) {
            var newEmail = email.substring(9);
            nlapiSetFieldValue('email', newEmail);
            nlapiLogExecution('DEBUG', 'Modified before load ' + email + ' to ' + newEmail);
        }
    }
}
catch (err) {
    nlapiLogExecution('ERROR', 'PageInit', err);
}}

function SaveRecord() {
try {
    var email = nlapiGetFieldValue('email');
    var newEmail = 'LifeSpan.' + email;
    nlapiSetFieldValue('email', newEmail);
    nlapiLogExecution('DEBUG', 'Modified before Submit ' + email + ' to ' + newEmail);
}
catch (err) {
    nlapiLogExecution('ERROR', 'SaveRecord', err);
}
return true;}

nlapiSetFieldValue可在加载脚本之前的用户事件中用于初始化新记录或非存储字段上的字段。

请在您的问题中添加一些代码。谢谢,这很有效。是否需要使用API将此客户端脚本推送到net suite环境?我知道我们可以用API上传文件。有没有一种方法可以将客户端脚本分配给特定对象(比如说……我想为customer、lead(查看、编辑和创建)添加这些脚本。是否有方法为创建、列表、快速查看等分配pageInit。我只在复制、创建和编辑时看到过这种情况。如何对其余的用户界面屏幕执行相同的操作?您可以将脚本分配给脚本部署页中的特定记录。我是否可以以自动方式执行所有操作,例如调用API或Web服务。我们希望尽可能减少自定义代码部署过程中的手动干预。我们能做到吗?不,我不这么认为。据我所知,只有两种方法可以将脚本设置到特定记录上。1.通过脚本部署页面完成记录级别2.通过将脚本附加到特定记录表单来实现表单级别脚本(仅适用于客户端脚本)
    var email = nlapiGetFieldValue('email');
    if(email.indexOf('SaaSSpan.') != -1) {
      var newEmail = email.substring(9);
      nlapiSetFieldValue('email', newEmail );
    nlapiLogExecution('DEBUG', 'Modified before load ' + email + ' to ' + newEmail);
    }
function PageInit(type) {
try {
    if (type == 'edit') {
        var email = nlapiGetFieldValue('email');
        if (email != null && email.indexOf('LifeSpan.') != -1) {
            var newEmail = email.substring(9);
            nlapiSetFieldValue('email', newEmail);
            nlapiLogExecution('DEBUG', 'Modified before load ' + email + ' to ' + newEmail);
        }
    }
}
catch (err) {
    nlapiLogExecution('ERROR', 'PageInit', err);
}}

function SaveRecord() {
try {
    var email = nlapiGetFieldValue('email');
    var newEmail = 'LifeSpan.' + email;
    nlapiSetFieldValue('email', newEmail);
    nlapiLogExecution('DEBUG', 'Modified before Submit ' + email + ' to ' + newEmail);
}
catch (err) {
    nlapiLogExecution('ERROR', 'SaveRecord', err);
}
return true;}