code to assign certain amount to credit limit base on certain condition

Dear all,

Could some one help me with these code, i wrote these code to update the credit limit on customer card base on certain condition but seems not to be working(The credit limit was not update at all) . i Set the report to processonly to yes.

“Cust. Ledger Entry”.CALCFIELDS(“Cust. Ledger Entry”.Amount);

“Cust. Ledger Entry”.Amount:= Customer.“Balance (LCY)”;

Customer.SETRANGE(Customer.“No.”,Customer.“No.”);

IF (Customer.“Balance (LCY)”= 0) AND (Customer.“Credit Limit (LCY)” = 0) THEN BEGIN

Customer.“Credit Limit (LCY)” :=100000;

END;

I think this line is missing:

IF (Customer.“Balance (LCY)”= 0) AND (Customer.“Credit Limit (LCY)” = 0) THEN BEGIN

Customer.“Credit Limit (LCY)” :=100000;

Customer.MODIFY(TRUE);

END;

Moved to developer forum

Hi,

The amount inserted inrespective of the condition. The condition are not being taking into consideration. Any help

Thanks for the missing line

Gbenga

Try the following:

Create a processing only report with Customer as data item and onAfterGetRecord write the following code:

Customer.CALCFIELDS(.“Balance (LCY)”);

IF (“Balance (LCY)”= 0) AND (“Credit Limit (LCY)” = 0) THEN BEGIN

“Credit Limit (LCY)” :=100000;

MODIFY(TRUE);

END;

And on OnPostReport section you may write a message, informing completion of report.

Hi,

Thanks, i finally got it working as expected. Really i don’t know what went wrong but it surelly working now. Use the same code you gave me.

Gbenga

Gbenga,

Which code worked for you? You had another post also for this issue, I suggest you to identify the post which helped you and “Verify Solution” , which will be helpful to someone else in future if he/she encounters same situation.

Hi,

Thanks for reminding me the code above works just as i wanted.

Gbenga