Error: Object reference not set to an instance of an object

Hello, I am receiving multiple errors of Object reference not set to an instance of an object when I try to access the lookup for Customer account field as shown in the image below


I have been looking for the solutions but I still don’t get the answer for this. Please help me

Please give us more information.

What were you doing when you got this error? Does it happen in all cases or just some (e.g. it depends on data)? Does it happen to all users? Are you able to reproduce the problem in a non-production environment? Did it work before? If so, what has changed? If not, does it mean that it’s a new development, or a new environment, or what?

Sorry for not giving you more details.
I created a new project for Customer report in development environment. These are the parameters for the report
`FromDate fromDate;
ToDate toDate;
CustAccount custAccount;
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}
public ToDate parmToDate(ToDate _toDate = toDate)
{
toDate = _toDate;
return toDate;
}
public CustAccount parmCustAccount(CustAccount _custAccount = custAccount)
{
custAccount = _custAccount;
return custAccount;
}

}`
But when I deploy the report, the parameter for the customer account gives an Object Reference error. But, this only happens for Customer account and even previous projects when I used CustAccount were affected. And when I try to access the menu with a customer account (Sales Order for example) the error occurs.
I’m not really sure what changed since the previous project was running smoothly. But when my senior release the project to sandbox, the error didn’t occur in sandbox.

Sorry, what exactly did you do?

You showed us some parm methods, but it’s not clear in which class you have them, e.g. whether you’re trying to extend something existing or create something new.

You also said that these are report parameters, but they aren’t decorated with DataMember attributes.

Also note that usage data might conflict with your changes.

I’m so sorry this is the first time I asked in the forum and I thought you all will know what I mean.
This is my contract class:
[DataContractAttribute]
public class IMP_SCM_LaporanPenjualanPerCustomerContract
{
FromDate fromDate;
ToDate toDate;
CustAccount custAccount;

[
    DataMemberAttribute('From Date'),
    SysOperationLabelAttribute(literalStr("@SYS5209")),
    SysOperationDisplayOrderAttribute("1"),
    SysOperationControlVisibilityAttribute(false)
]
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
    fromDate = _fromDate;
    return fromDate;
}

[
    DataMemberAttribute('To Date'),
    SysOperationLabelAttribute(literalStr("@SYS14656")),
    SysOperationDisplayOrderAttribute("2"),
    SysOperationControlVisibilityAttribute(false)
]
public ToDate parmToDate(ToDate _toDate = toDate)
{
    toDate = _toDate;
    return toDate;
}

[
    DataMemberAttribute('CustAccount'),
    SysOperationLabelAttribute(literalStr("@SYS7149")),
    SysOperationControlVisibilityAttribute(false)
]
public CustAccount parmCustAccount(CustAccount _custAccount = custAccount)
{
    custAccount = _custAccount;
    return custAccount;
}

}

This is my data provider class:
[SrsReportParameterAttribute(classStr(IMP_SCM_LaporanPenjualanPerCustomerContract))]
class IMP_SCM_LaporanPenjualanPerCustomerDP extends SRSReportDataProviderBase
{
IMP_SCM_LaporanPenjualanPerCustomerTmp tmpTable;
FromDate fromDate;
ToDate toDate;
CustAccount custAccount;

[SrsReportDataSetAttribute(tableStr(IMP_SCM_LaporanPenjualanPerCustomerTmp))]
public IMP_SCM_LaporanPenjualanPerCustomerTmp getTmpTable()
{
    select tmpTable;
    return tmpTable;
}

/// <summary>
/// processes report data
/// </summary>
public void processReport()
{
    CustInvoiceJour                                 custInvoiceJour;
    CustInvoiceTrans                                custInvoiceTrans;
    IDTaxInvoiceVATTable                            taxInvoice;
    TaxRegistration                                 taxRegistration;
    MarkupTrans                                     markupTrans;
    Bitmap                                          companyLogo;

    IMP_SCM_LaporanPenjualanPerCustomerContract contract = this.parmDataContract() as IMP_SCM_LaporanPenjualanPerCustomerContract;

     fromDate = contract.parmFromDate();
     toDate = contract.parmToDate();
     custAccount = contract.parmCustAccount();

    companyLogo = FormLetter::companyLogo();

    while select custInvoiceJour where custInvoiceJour.InvoiceDate >= fromDate && custInvoiceJour.InvoiceDate <= toDate && (custAccount == '' || custInvoiceJour.InvoiceAccount == custAccount)
    {
        tmpTable.clear();
        tmpTable.CompanyLogo = companyLogo;
        tmpTable.InvoiceDate = custInvoiceJour.InvoiceDate;
        tmpTable.InvoiceId = custInvoiceJour.InvoiceId;
        tmpTable.ExchangeRate = custInvoiceJour.ExchRate / 100;
        select taxInvoice where taxInvoice.SourceId == custInvoiceJour.InvoiceId && taxInvoice.TaxModule == 2;
        tmpTable.TaxNum = taxInvoice.TaxInvoiceNum;
        tmpTable.CustInvoiceAccount = custInvoiceJour.salesTable().CustAccount;
        tmpTable.CustInvoiceAccountName = custInvoiceJour.salesTable().SalesName;
        tmpTable.CurrencyCode = custInvoiceJour.CurrencyCode;
        select custInvoiceTrans where custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId && custInvoiceTrans.SalesId == custInvoiceJour.SalesId;
        tmpTable.Bruto = custInvoiceJour.SalesBalance;
        tmpTable.DiscPct = custInvoiceTrans.SumLineDiscMST;
        tmpTable.DiscAmount = custInvoiceJour.EndDisc;
        if(tmpTable.CurrencyCode != 'IDR')
        {
            tmpTable.PPNPercent = 0.00;
        } 
        else 
        {
            tmpTable.PPNPercent = 11.00;
        }
        tmpTable.PPNAmount = custInvoiceJour.SumTax;
        select markupTrans where markupTrans.TransRecId == custInvoiceJour.RecId;
        tmpTable.BiayaLainLain = markupTrans.Value;
        tmpTable.Netto = custInvoiceJour.InvoiceAmount;
        tmpTable.ValutaNetto = tmpTable.ExchangeRate * tmpTable.Netto;
        tmpTable.insert();
    }
}

}

I am trying to print the report but when I choose the parameter for customer account I get the error shown in the my previous screenshoot. And when I try to access the sales order menu the same error occured as shown in the image below.

Oh but when I try to manually write the customer account in the parameter field, the report working fine according to the DP. So I think the problem is from the CustAccount but I’m not really sure why. Please help me because there are some report that I can’t access because they have a customer account. Thank you for your response

So when exactly do you get the error? When you select a value from a lookup and then switch to another field? Maybe there is a wrong customization related to the lookup or something.

I suggest you recompile the model and then use the debugger to find out where the errors come from.

I try to do a full build and the error is gone. Thanks for your help