Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Lock box Import -Issue with reading the file

Posted on by 106

Dear AX Experts,

We have a requirement to update Lockbox import process to read invoice data from "check detail record"( Record Type6 )

Before it was mapped to "Invoice Detail Record"(Record type 4) .

Please advise if this is a possible option ? More details are below

We have Lockbox processing class that reads data from .txt file, the record position,type and lenght defined in  "DATADICTIONARYDETAILS" table.

Per the above table invoice number should be populated in 4 record 13th position but the new requirement is to read Invoice number from 6 record 80th position.

So in Dev  I have updated "DATADICTIONARYDETAILS" table data ,so that 6th record 80th position data will be Invoice number and the "process File" method reading the data correct, later int the below step(highlighted in BOLD) it's throwing an error  saying "Argument to method setFieldValue out of range."

if(values != conNull() && lineType == "4")
{
//Get the tmp-Buffer instance from Base Class (FileBuffers) Method Name: GetTmp<table name from dictonary>
//recBuff = objDict.callObject("GetTmp"+currTable,this);
recBuff = objDict.callObject("GetLockboxInvoiceRecord",this);

//getting total num of records in container
_lenght = conLen(values);

//Loop through contain and load table fields container has field name, field value pair records
for (counter =1; counter <=_lenght; counter++)
{
cntRow = conNull();
cntRow=conPeek(values,counter);

typeVal = conPeek(cntRow,3);
data = conPeek(cntRow,2);
field = conPeek(cntRow,1);
if (field != "Blank")
{
if (match("amount>", strLwr(field)) == 1)
{
//when using Common as the table buffer we have generic method setFieldValue which will take (field name, Field Value) to set records
recBuff.setFieldValue(conPeek(cntRow,1),0.01*this.DynamicTypeConversion(conPeek(cntRow,2),typeVal));
}else
{
//when using Common as the table buffer we have generic method setFieldValue which will take (field name, Field Value) to set records
recBuff.setFieldValue(conPeek(cntRow,1),this.DynamicTypeConversion(conPeek(cntRow,2),typeVal));
}
}

}

Requesting your advise on the above and let me know if more details are needed.

Thanks

Mohan 

  • Mohan_AX Profile Picture
    Mohan_AX 106 on at
    RE: Lock box Import -Issue with reading the file

    Hi Martin,

    Thank you very much for the reply.

    I have fixed this issue by adding another if()  to read the Invoice number to a container and assign it at the required position.

    Thanks

    Mohan

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 225,672 Super User on at
    RE: Lock box Import -Issue with reading the file

    I would start by looking at what values you're passing to setFieldValue(). It's not visible in code above, because it depends on the content of cntRow() and logic inside DynamicTypeConversion().

    When you which value is wrong, you can start analyzing why.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans