Trouble in fetching schedule no. line level field from journal entry record.

I have created amortization schedule journal entry. need to fetch schedule no. field at line level. I have created user event beforesubmit script. I am able to fetch department, description, schedule no. field values in edit mode. department and description in create mode. but getting blank value in schdule no. field log even there is value at craete mode. whow to access this value? Please help!


 * @NApiVersion 2.x
 * @NScriptType UserEventScript
define([‘N/record’, ‘N/ui/serverWidget’, ‘N/search’, ‘N/ui/message’, ‘N/runtime’],
    function (record, serverWidget, search, message, runtime) {
        function beforeSubmit(context) {
            // try {
                var schArray1=[];
                var schArray2=[];
                    var selectionArray=[];
                    var selectionArray2=[];
                    var rec = context.newRecord;
                    var recType = rec.type;
                   //Journal Entry
                    if (recType === ‘journalentry’) {
                          if (context.type === ‘create’) {
                        var objRecord = record.load({
                            id: 157,
                        var numLines = rec.getLineCount({
                            sublistId: ‘line’
                        log.debug(“numLines”, numLines);
                        for(var s=0;s<numLines;s++)
                             var scheduleNo = rec.getSublistValue({
                                sublistId: ‘line’,
                                fieldId: ‘schedulenum’,
                                line: s
                            log.debug(“scheduleNo”, scheduleNo);
                            var department = rec.getSublistValue({
                                sublistId: ‘line’,
                                fieldId: ‘department’,
                                line: s
                            log.debug(“department”, department);
                            var decs = rec.getSublistValue({
                                sublistId: ‘line’,
                                fieldId: ‘memo’,
                                line: s
                            log.debug(“decs”, decs);
        return {
            beforeSubmit: beforeSubmit
Beginner Asked on January 4, 2024 in SuiteScript.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor