How Can I Get My Sequence Numbers to Default Properly on My List Grid?

If you are working with a List Grid that uses some type of sequence field (e.g. SEQNO, LINE_​SEQ, SORT_​SEQ), there is a handy bit of technology that you can use that will cause the UI to do this job for you.

Just follow the steps below and you'll have the problem solved in no time. The sequence field will be populated in your "empty line" and any elements that are added from then on will have an appropriate value in the sequence field. If the user edits the sequence field at any point, the next element added to the list will incorporate the change without any problems.

Note: The default Sequence Number functionality will default the next nearest tens value from the highest sequence. The defaulting will do nothing after the sequence reaches the highest number it can hold.

function initializeNewElement_LIST_NAME(newElement) {
      var myListName = "LIST_NAME";
      var myListSeqName = "FIELD_NAME";
      var myListMaxSeq = 999;
      defaultSequenceNumber(myListName,myListSeqName,myListMaxSeq,newElement)
}      

</SCRIPT>
<SCRIPT src="/zz/defaultSequenceNumber/defaultSequenceNumber.js"></SCRIPT>
<SCRIPT>