Update the Blocked field of the Customer card

RoiRoi Member Posts: 33
Hi,

I need to update the Blocked field of the customer card according the customer cards Balance LCY value.If Balnce LCY > Credit Limit(LCY) of the customer card then Blocked field need to be update with 'Ship'.

I tried this by writing codes on the Balance LCY and Blocked fields onValidate triggers and then On Insert trigger of Customer. but its not updating properly in the Blocked fields.I think this is due to Balnce LCY is updating from Detail Cus Ledger Entry table.

Any idea?

Roi

Comments

  • JPHSCJPHSC Member Posts: 67
    Balance LCY is a flowfield, so if you wrote code on the onvalidate of this field, it will have no effect. (if you want the value, you need to do a calcfield)

    Just a suggestion : why not do this check in the posting routines? These codes adjust the balance so you have you trigger ?? ?
  • matttraxmatttrax Member Posts: 2,309
    Or in the OnInsert of Detailed Customer Ledger Entries...of course you'd have to check that they are all INSERT(TRUE).
  • RoiRoi Member Posts: 33
    Hi,

    I tried it by writing codes on the On Insert trigger of the Detail cust. Ledger entry,but its not updating the customer table.I entered Cash Receipt Journal and checked.

    The code which I wrote as follows.

    OnInsert()
    IF INSERT = TRUE THEN
    BEGIN
    CustNo := "Customer No.";
    Cust.SETFILTER(Cust."No.",CustNo);
    IF Cust.FIND('-') THEN
    BEGIN
    Cust.New := TRUE;
    Cust.MODIFY
    END;
    END;

    Anyidea??

    Roi
Sign In or Register to comment.