Iterate inside an array to take values when the loop gets executed

Viewed 40
function createDefaultTaxInfo() {
  for (let i = 0; i <= 5; i++) {

    FormManager.setValue('taxCd', '01');
    FormManager.setValue('taxSeparationIndc', '07');
    FormManager.setValue('billingPrintIndc', '');
    FormManager.setValue('contractPrintIndc', '');
    FormManager.setValue('cntryUse', '');

    FormManager.doHiddenAction('frmCMR_taxInfoModal', 'ADD_TAXINFO',
      cmr.CONTEXT_ROOT + '/request/taxinfo/process.json?reqId=' +
      FormManager.getActualValue('reqId'), true, null, true);
  }
  CmrGrid.refresh('TAXINFO_GRID');
}

The code above creates a single entry. I am having trouble trying to figure out on how to create a multiple entries but with different values on each entities.

The idea is to put these values into an object or array, then, when the loop is executed, it would iterate inside the array to set each value.

taxCd = 11, 02, 07, 12
taxSeparationIndc = N, N, N, N
contractPrintIndc = N, N, N, N
cntryUse = 0000, 0000, 0000, 0000

For example, when ('taxCd', '01'); is done, 11 would be next, and 02, and so on. This would happen in each after every loop.

0 Answers
Related