NetSuite: ClientScript Problem! 🤖 Oopsie-doodle!

huangapple go评论56阅读模式
英文:

NetSuite: ClientScript Issue

问题

我想在SO中添加一个新的自定义选择项。
因此,我已经开发了一个UserEvent脚本和ClientScript。
在沙盒中一切正常工作。
但在生产环境中不起作用。
UserEvent脚本在生产环境中工作正常,只有ClientScript不起作用。

EntryPoint.beforeLoad = (context) => {
        const LOGTITLE = "beforeload " + context.newRecord.id;
        
        try {
            if(context.form && context.type == context.UserEventType.EDIT) {
                var currentForm = context.form;
                
               currentForm.addField({
                    id: 'custpage_paymentoption',
                    type: 'SELECT',
                    label: 'Custom Payment Option',
               });
            }
        } catch (e) {
            log.error(LOGTITLE, JSON.stringify(e));
        }

        return true;
    }
EntryPoint.fieldChanged = (scriptContext) => {
        const LOGTITLE = "fieldChanged " + scriptContext.currentRecord.id;
        
        try {
            var record = scriptContext.currentRecord;
        
            if (scriptContext.fieldId == 'custpage_paymentoption') {
                var currentOption = record.getValue({
                    fieldId: 'custpage_paymentoption',
                })
                log.debug('currentOption', currentOption);

                record.setValue({
                    fieldId: 'paymentoption',
                    value: currentOption,
                    ignoreFieldChange: true,
                    forceSyncSourcing: true
                });
            }
        } catch (e) {
            log.error(LOGTITLE, JSON.stringify(e));
        }
    };

如果有人知道解决方案,请告诉我。

英文:

I want to add a new custom selection in SO.
So I've developed a UserEvent Script and ClientScript.
All work well in sandbox.
But it's not working in production.
UserEvent Script works well in production, only ClientScript is not working.

EntryPoint.beforeLoad = (context) => {
        const LOGTITLE = "beforeload " + context.newRecord.id;
        
        try {
            if(context.form && context.type == context.UserEventType.EDIT) {
                var currentForm = context.form;
                
               currentForm.addField({
                    id: 'custpage_paymentoption',
                    type: 'SELECT',
                    label: 'Custom Payment Option',
               });
            }
        } catch (e) {
            log.error(LOGTITLE, JSON.stringify(e));
        }

        return true;
    }
EntryPoint.fieldChanged = (scriptContext) => {
        const LOGTITLE = "fieldChanged " + scriptContext.currentRecord.id;
        
        try {
            var record = scriptContext.currentRecord;
        
            if (scriptContext.fieldId == 'custpage_paymentoption') {
                var currentOption = record.getValue({
                    fieldId: 'custpage_paymentoption',
                })
                log.debug('currentOption', currentOption);

                record.setValue({
                    fieldId: 'paymentoption',
                    value: currentOption,
                    ignoreFieldChange: true,
                    forceSyncSourcing: true
                });
            }
        } catch (e) {
            log.error(LOGTITLE, JSON.stringify(e));
        }
    };

Please let me know if someone knows the solution.

答案1

得分: 0

日志中是否有错误?
你是否看到脚本在运行?
脚本是否已部署?
脚本是否部署在正确的记录上?
用户体验中一条记录最多只能有10个客户端脚本的可能性。
请检查是否超过了10个。
超过10个后,脚本将被忽略。
要解决这个问题,你可以将你的函数添加到现有的函数中,以避免拥有太多脚本。
你还可以移除不必要的脚本。

英文:

Is there an error in the log?
Do you see the script running?
Is the script deployed?
Is the script deployed on the right record?
There is only the possibility to have a maximum 10 Client scripts on a record for the user experience.
Please check if you don't have more than 10.
After 10, the scripts will be ignored.
To solve this issue, you can add your function to an existing one to avoid having too many scripts.
You can also remove the unnecessary scripts.

huangapple
  • 本文由 发表于 2023年7月17日 14:14:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76701890.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定