Hi guys,
In a standard table, usually there is a ValidateWrite() method. Can we create CoC on this method and overwrite it ? or in other words is "overidden" some condition in the existing method.
Thanks
It doesn't throw an error. Calling checkFailed("x") does exactly the same thing as warning("x"). The difference is elsewhere - in the return statement. return checkFailed("x") is an equivalent of this:
warning("x"); return false;
Therefore you would like to keep the warning (no need to call it again) and return true instead of false. But... you should change the return value only if it failed on these particular conditions and no other.
Hi, You can try doing it like this code so it bypass standard code and then you can throw warning instead of error.
public boolean validateWrite() { Amount RemainingAmountLocal, RecognizeAmountLocal; RemainingAmountLocal = this.RemainingAmount; RecognizeAmountLocal = this.RecognizeAmount; this.RemainingAmount = 0; this.RecognizeAmount = 0; boolean ret = next validateWrite(); this.RemainingAmount = RemainingAmountLocal; this.RecognizeAmount = RecognizeAmountLocal; if (this.RecognizeAmount >= 0 && (this.RemainingAmount > this.RecognizeAmount)) { //Revenue to release is greater than remaining revenue to recognize warning("@RevenueRecognition:RevenueToReleaseGreaterThanRemainingRevenueToRecognize"); } if (this.RecognizeAmount < 0 && (this.RecognizeNowAmount < this.RecognizeAmount)) { //Revenue to release is less than remaining revenue to recognize warning("@RevenueRecognition:RevenueToReleaseLessThanRemainingRevenueToRecognize"); } return ret; }
Hi both,
Thanks, yes I have a requirement to suppress the validateWrite for throwing error, replace by Warning only on this part in table RevRecDeferredLine
public boolean validateWrite() { boolean ret; if (this.RecognizeAmount >= 0 && (this.RemainingAmount > this.RecognizeAmount)) { //Revenue to release is greater than remaining revenue to recognize return checkFailed("@RevenueRecognition:RevenueToReleaseGreaterThanRemainingRevenueToRecognize"); } if (this.RecognizeAmount < 0 && (this.RecognizeNowAmount < this.RecognizeAmount)) { //Revenue to release is less than remaining revenue to recognize return checkfailed("@RevenueRecognition:RevenueToReleaseLessThanRemainingRevenueToRecognize"); } }
It has other condition, but I only need to change this to warning only instead checkfailed. Is it possible in CoC ?
Thanks
Hi, You can bypass standard logic by manipulating some code but its not always possible. By override, if you mean to suprress call to standard method then its not possible. If you have a requirement, please share so we can try to help.
Hello,
You can not override a standard method but you can extend it. What you actually do with the CoC is either, you let Microsoft code run first then, yours run after, or you run yours first then, the standard's.
Which ever way, the standard code must run.
André Arnaud de Cal...
291,996
Super User 2025 Season 1
Martin Dráb
230,853
Most Valuable Professional
nmaenpaa
101,156