简体   繁体   中英

How do we get the record type in UserEvent SuiteScript 2.0

How do we get the record type in UserEvent SuiteScript 2.0 ?

I want to deploy my SuiteScript for more than 1 record type (Customer Payment, Credit Memo, Deposit, Invoice)

Now in my SuiteScript I need to identify the record type and do actions based on it.

My code:

define(['N/record', 'N/https'],
function(record,https)
{
    function afterSubmit(context)
    {
        var myUrl = 'My url here';

        var rType = context.newRecord.Type;
        log.debug({title: 'rType1 ', details: rType });
        //This returns nothing

        rType = record.Type;
        log.debug({title: 'rType2 ', details: rType });
        //This gives all the available record types in Netsuite

        var JsonPayload = 'need to know whether its an invoice or a payment here';
        log.debug({title: 'payload ', details: JsonPayload });

        var response = https.post({ url: myUrl, body: JsonPayload});
        log.debug({title: 'response ', details: response });
    }
}
return {
    afterSubmit: afterSubmit
};

});

should be ctx.newRecord.type . javascript is case sensitive.

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