Netsuite - Unable to get sublist line count












1















I'm using a scheduled script to get the line count of a sublist on a customer record so I can loop through the list. The list items are a custom record type (SOW_rec) and are children of the customer. I am able to load the record but lineCount only returns a -1 no matter which sublist ID I try. How do I find the sublist ID where the sublist is in a parent-child relationship? I have tried looking in &XML=T but there is no sublist data in there.



 var companyRecord = record.load({
type: record.Type.CUSTOMER,
id: company,
isDynamic: true,
});
log.debug({
title: 'companyrecord',
details: companyRecord
});
var lineCount = companyRecord.getLineCount('SOW_Rec');

log.debug({
title: 'linecount',
details: lineCount
});









share|improve this question





























    1















    I'm using a scheduled script to get the line count of a sublist on a customer record so I can loop through the list. The list items are a custom record type (SOW_rec) and are children of the customer. I am able to load the record but lineCount only returns a -1 no matter which sublist ID I try. How do I find the sublist ID where the sublist is in a parent-child relationship? I have tried looking in &XML=T but there is no sublist data in there.



     var companyRecord = record.load({
    type: record.Type.CUSTOMER,
    id: company,
    isDynamic: true,
    });
    log.debug({
    title: 'companyrecord',
    details: companyRecord
    });
    var lineCount = companyRecord.getLineCount('SOW_Rec');

    log.debug({
    title: 'linecount',
    details: lineCount
    });









    share|improve this question



























      1












      1








      1








      I'm using a scheduled script to get the line count of a sublist on a customer record so I can loop through the list. The list items are a custom record type (SOW_rec) and are children of the customer. I am able to load the record but lineCount only returns a -1 no matter which sublist ID I try. How do I find the sublist ID where the sublist is in a parent-child relationship? I have tried looking in &XML=T but there is no sublist data in there.



       var companyRecord = record.load({
      type: record.Type.CUSTOMER,
      id: company,
      isDynamic: true,
      });
      log.debug({
      title: 'companyrecord',
      details: companyRecord
      });
      var lineCount = companyRecord.getLineCount('SOW_Rec');

      log.debug({
      title: 'linecount',
      details: lineCount
      });









      share|improve this question
















      I'm using a scheduled script to get the line count of a sublist on a customer record so I can loop through the list. The list items are a custom record type (SOW_rec) and are children of the customer. I am able to load the record but lineCount only returns a -1 no matter which sublist ID I try. How do I find the sublist ID where the sublist is in a parent-child relationship? I have tried looking in &XML=T but there is no sublist data in there.



       var companyRecord = record.load({
      type: record.Type.CUSTOMER,
      id: company,
      isDynamic: true,
      });
      log.debug({
      title: 'companyrecord',
      details: companyRecord
      });
      var lineCount = companyRecord.getLineCount('SOW_Rec');

      log.debug({
      title: 'linecount',
      details: lineCount
      });






      netsuite suitescript suitescript2.0






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 4 '18 at 19:16







      EJLaylan

















      asked Sep 4 '18 at 18:44









      EJLaylanEJLaylan

      636




      636
























          4 Answers
          4






          active

          oldest

          votes


















          0














          Check the "Allow Child Record Editing" checkbox on the child record that you are trying to access with the .getLineCount command.



          Also, as dcrs mentioned, the linecount command should be var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});






          share|improve this answer































            1














            Your code for line count is incorrect. You're missing the parameter needed for the sublist. If this is a child record it will be linked by the field listed with the "record is parent" checked.



            var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});





            share|improve this answer
























            • After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

              – EJLaylan
              Sep 5 '18 at 17:57



















            0














            When I look at the XML structure of a Customer record (using &xml=T appended to the URL), I can see the sublist data there. However, in a thoroughly effective effort to confuse, NetSuite has called the relevant XML element <machine> rather than <sublist> or something you might naturally think of. So try searching for "machine" on the customer record after loading it with &xml=T - you should see several references to it (open and close tags for each sublist) each with <line> sub-elements.



            Once you've located the <machine> elements, you will see each has a name attribute which is the sublist ID you're looking for.






            share|improve this answer
























            • I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

              – EJLaylan
              Sep 4 '18 at 22:14



















            0














            NetSuite Help Article 65795 details the naming convention for Custom Child Record Sublist IDs




            The internal ID for a custom child record sublist is recmach + > field_id_for_the_parent_field (for example: recmachcustrecord111).




            NetSuite expects all lower case for the Id.






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52172297%2fnetsuite-unable-to-get-sublist-line-count%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Check the "Allow Child Record Editing" checkbox on the child record that you are trying to access with the .getLineCount command.



              Also, as dcrs mentioned, the linecount command should be var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});






              share|improve this answer




























                0














                Check the "Allow Child Record Editing" checkbox on the child record that you are trying to access with the .getLineCount command.



                Also, as dcrs mentioned, the linecount command should be var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});






                share|improve this answer


























                  0












                  0








                  0







                  Check the "Allow Child Record Editing" checkbox on the child record that you are trying to access with the .getLineCount command.



                  Also, as dcrs mentioned, the linecount command should be var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});






                  share|improve this answer













                  Check the "Allow Child Record Editing" checkbox on the child record that you are trying to access with the .getLineCount command.



                  Also, as dcrs mentioned, the linecount command should be var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 5 '18 at 20:59









                  The WindhoverThe Windhover

                  1659




                  1659

























                      1














                      Your code for line count is incorrect. You're missing the parameter needed for the sublist. If this is a child record it will be linked by the field listed with the "record is parent" checked.



                      var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});





                      share|improve this answer
























                      • After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                        – EJLaylan
                        Sep 5 '18 at 17:57
















                      1














                      Your code for line count is incorrect. You're missing the parameter needed for the sublist. If this is a child record it will be linked by the field listed with the "record is parent" checked.



                      var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});





                      share|improve this answer
























                      • After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                        – EJLaylan
                        Sep 5 '18 at 17:57














                      1












                      1








                      1







                      Your code for line count is incorrect. You're missing the parameter needed for the sublist. If this is a child record it will be linked by the field listed with the "record is parent" checked.



                      var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});





                      share|improve this answer













                      Your code for line count is incorrect. You're missing the parameter needed for the sublist. If this is a child record it will be linked by the field listed with the "record is parent" checked.



                      var lineCount = companyRecord.getLineCount({sublistId:"RECMACHCUSTRECORD...."});






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 5 '18 at 3:17









                      dcrsdcrs

                      22414




                      22414













                      • After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                        – EJLaylan
                        Sep 5 '18 at 17:57



















                      • After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                        – EJLaylan
                        Sep 5 '18 at 17:57

















                      After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                      – EJLaylan
                      Sep 5 '18 at 17:57





                      After getting on with netsuite support we figured out you need the "Allow Child Record Editing" setting to be checked on the custom record type.

                      – EJLaylan
                      Sep 5 '18 at 17:57











                      0














                      When I look at the XML structure of a Customer record (using &xml=T appended to the URL), I can see the sublist data there. However, in a thoroughly effective effort to confuse, NetSuite has called the relevant XML element <machine> rather than <sublist> or something you might naturally think of. So try searching for "machine" on the customer record after loading it with &xml=T - you should see several references to it (open and close tags for each sublist) each with <line> sub-elements.



                      Once you've located the <machine> elements, you will see each has a name attribute which is the sublist ID you're looking for.






                      share|improve this answer
























                      • I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                        – EJLaylan
                        Sep 4 '18 at 22:14
















                      0














                      When I look at the XML structure of a Customer record (using &xml=T appended to the URL), I can see the sublist data there. However, in a thoroughly effective effort to confuse, NetSuite has called the relevant XML element <machine> rather than <sublist> or something you might naturally think of. So try searching for "machine" on the customer record after loading it with &xml=T - you should see several references to it (open and close tags for each sublist) each with <line> sub-elements.



                      Once you've located the <machine> elements, you will see each has a name attribute which is the sublist ID you're looking for.






                      share|improve this answer
























                      • I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                        – EJLaylan
                        Sep 4 '18 at 22:14














                      0












                      0








                      0







                      When I look at the XML structure of a Customer record (using &xml=T appended to the URL), I can see the sublist data there. However, in a thoroughly effective effort to confuse, NetSuite has called the relevant XML element <machine> rather than <sublist> or something you might naturally think of. So try searching for "machine" on the customer record after loading it with &xml=T - you should see several references to it (open and close tags for each sublist) each with <line> sub-elements.



                      Once you've located the <machine> elements, you will see each has a name attribute which is the sublist ID you're looking for.






                      share|improve this answer













                      When I look at the XML structure of a Customer record (using &xml=T appended to the URL), I can see the sublist data there. However, in a thoroughly effective effort to confuse, NetSuite has called the relevant XML element <machine> rather than <sublist> or something you might naturally think of. So try searching for "machine" on the customer record after loading it with &xml=T - you should see several references to it (open and close tags for each sublist) each with <line> sub-elements.



                      Once you've located the <machine> elements, you will see each has a name attribute which is the sublist ID you're looking for.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 4 '18 at 21:31









                      KryptonKrypton

                      2,0052311




                      2,0052311













                      • I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                        – EJLaylan
                        Sep 4 '18 at 22:14



















                      • I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                        – EJLaylan
                        Sep 4 '18 at 22:14

















                      I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                      – EJLaylan
                      Sep 4 '18 at 22:14





                      I finally found the sublist ID in the customer record customize form XML structure. For some reason the sublist ID <machine> element was not in the regular customer record XML. I think that may be because the sublist is populated by child records. However the sublist ID still won't work, I get 0 for the line count when there are 6. Before I got -1 so a little better I guess.

                      – EJLaylan
                      Sep 4 '18 at 22:14











                      0














                      NetSuite Help Article 65795 details the naming convention for Custom Child Record Sublist IDs




                      The internal ID for a custom child record sublist is recmach + > field_id_for_the_parent_field (for example: recmachcustrecord111).




                      NetSuite expects all lower case for the Id.






                      share|improve this answer






























                        0














                        NetSuite Help Article 65795 details the naming convention for Custom Child Record Sublist IDs




                        The internal ID for a custom child record sublist is recmach + > field_id_for_the_parent_field (for example: recmachcustrecord111).




                        NetSuite expects all lower case for the Id.






                        share|improve this answer




























                          0












                          0








                          0







                          NetSuite Help Article 65795 details the naming convention for Custom Child Record Sublist IDs




                          The internal ID for a custom child record sublist is recmach + > field_id_for_the_parent_field (for example: recmachcustrecord111).




                          NetSuite expects all lower case for the Id.






                          share|improve this answer















                          NetSuite Help Article 65795 details the naming convention for Custom Child Record Sublist IDs




                          The internal ID for a custom child record sublist is recmach + > field_id_for_the_parent_field (for example: recmachcustrecord111).




                          NetSuite expects all lower case for the Id.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 19 '18 at 22:59

























                          answered Nov 19 '18 at 22:51









                          Grant LingardGrant Lingard

                          112




                          112






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52172297%2fnetsuite-unable-to-get-sublist-line-count%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Guess what letter conforming each word

                              Port of Spain

                              Run scheduled task as local user group (not BUILTIN)