Update multiple form value from dialog

Hello,
I have a custom form named TOC_IdnTaxTransactionJourPostOpen and a button named Generate FP Sederhana. This button will display a dialog form.

when I select multiple rows in the form TOC_IdnTaxTransactionJourPostOpen, and then I click the button Generate FP Sederhana. it will show a dialog form, inside the dialog form I have to input the value. After that, I just want to update 1 field on the form TOC_IdnTaxTransactionJourPostOpen

my question is how to update multiple rows that I’ve selected on form TOC_IdnTaxTransactionJourPostOpen after I input the value from the dialog form?

public void run()
    {
        int                         cnt = 0;
        TOC_IdnTaxTransactionJour            idnTaxJour, updIdnTaxJour;
        Args                                                args;
        MultiSelectionHelper                        selection = MultiSelectionHelper::construct();
        FormDataSource                              fds = Args.record().dataSource(); 
        selection.parmDatasource(fds);

        if(fds.anyMarked())
        {
            idnTaxJour = selection.getFirst();
            while(idnTaxJour)
            {
                update_recordset updIdnTaxJour 
                    setting FakturPajak = CustGroupId
                    where updIdnTaxJour.RecId == idnTaxJour.RecId;
                //cnt++;

                idnTaxJour  = selection.getNext();

            Info(strFmt("Faktur pajak: %1", CustGroupId));
            }

        }
    }

its my code, and got an error message “object reference not set to an instance”.

You should use the debugger to find out where the error is thrown. You’ll see it’s when calling args.record() because args contains null. And indeed, you forgot to put a value to this variable.

1 Like