When the Document No. is inserted in the Payment Journals i need it to error if the Document No. already exists in any of the other batch within the Payment Journals, i'm not entirely sure but could I use the FIELDEXIST function here?
Do you mean RecordRef.FIELDEXIST? No, that's to check if a field with a certain number exists in a table.
You need a second record variable of the payment journal and filter it for Journal Template Name and Document No.
YourGenJnlLine.SETRANGE("Journal Template Name","Journal Template Name");
YourGenJnlLine.SETRANGE("Document No.","Document No.");
IF NOT YourGenJnlLine.ISEMPTY THEN
ERROR('%1 is already in use',"Document No.");
What about posted payment journals?
"Money is likewise the greatest chance and the greatest scourge of mankind."
Comments
You need a second record variable of the payment journal and filter it for Journal Template Name and Document No. What about posted payment journals?
For posted Journals could i not check against the Last No. Used?