I am writing code to stop the purchase order from going into hold status (from released) every time some one adds a line to a previously released order. It works by checking the approval limit of that person against the entire purchase order and I want it to check only the incremental amount against that person’s approval limit. If it is within the limit, I want it to remain in the released status.
I modified the code I found in the write method of the purchline data source to work in this way. It works fine when you are on the purchase order screen. But, when you go out of the module and get back into it, the purchase order goes back to hold. I am not able to find the code which checks the limit while the form loads. It is not in the init methods anywhere.
I will appreciate any help to locate the code that is executed while form loads.
Can you please specify the exact field name in PurchTable which is getting reverted.
Also a list of steps you are performing to see the repro. This will be very useful in pin pointing the issue.
This is not a field in standard purchtable, but added by a VAR for our company. It is an enum field approvalstatus with possible values of onhold or released.
Everytime a change is made to purchline data, this goes back to onhold. The change I did was in the write method of purchline datasource where I tried to set it to released if the lineamount didn’t change to more than the limit. But it did not work. Then I added those additional fields to purchtable itself to save the total order amount everytime the data changed. The idea was, button-press of the release button on purchtable header section will check the current amount against the amount in this new field and if within the limit, allow to change to release status. Thus, I left the original behaviour of the form intact where the status changed to hold whenever any change is made to purchline. My new solution caused enormous problems in the live system which I am posting as a new discussion.
Thanks for your help.
For your requirement Whenever any changes are made to the existing PurchLine data or when any new PurchLine record is created and saved you’ll have to update the PurchTable field “ApprovalStatus” making its value to “OnHold” if the approval limit against the entire purchase order exceeds. Also you might have to refresh the form to show the correct updated value in the PurchTable. Are you facing the problem after doing this?
Also I want to know that What is the default value of the enum field “ApprovalStatus”, “OnHold” or “Released”?
You should use the debugger to trace this problem.