简体   繁体   中英

NetSuite SuiteScript 2.0 Get Value of Choose Team field

On the standard Customer form there's a field named Choose Team. It's a list of the defined sales teams - you choose the team and it populates the Sales Team list with all the people in the team, and then empties itself. So to the user, you choose the sales team in the Choose Team field and then, a second later, it empties itself.

What I'm trying to do is get the value that the user selects in that field. I'm using a client script, running of the fieldChanged entry point, and successfully detecting a change to that field. But by the time I use getValue, the field has emptied itself and I get an empty return.

Here's my code:

    function fieldChanged(context){
        var currentRecord = context.currentRecord;

        if(context.fieldId == 'salesgroup'){
            var salesTeam = currentRecord.getValue({
                    fieldId: 'salesgroup'
                });

            log.debug({
                    title: 'Sales Team', 
                    details: salesTeam
                });
            
            dialog.alert({
                    title: 'Sales Team',
                    message: 'Sales Team is ' + salesTeam
                });
        }
    }

You can try getting the value during validateField instead of fieldChanged. Don't forget to return true at the end of validateField to let the change proceed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM