Auto refreshing SO header form from subform?

Does anyone know a solution to this? I added a new SalesHeader.Status of “Credit Hold”. If, in the Sales Order form, when entering a sales order line, the system warns that a customer is over their credit limit, I’ve done a mod to set the SalesHeader table Status to “Credit Hold”, but this is not reflected on the Sales Order form until the user clicks on the header area of the form. I’m setting and modifying SalesHeader.Status to “Credit Hold” in codeunit 312 (Cust-Check Cr. Limit) that is called from Table 37 (Sales Line). I’m using Navision Solutions version 3.00 US beta 1. Anyone know how to reflect the status change in the Sales Order header form programmatically; ie., without having to click on it?

The only way is to use a timer on the main form since the subform can’t update it. I wouldn’t say its such a good solution though. The problem is that the main form knows that it has a subform but the subform doesn’t know it have a main form. //Lars

I tried the timer out a while back and found it also comes with an additional problem. Because the sub-form is still part of the main form, when it updates, it erases the value of the field you are editing! Bill Benefiel Manager of Information Systems Overhead Door Company (317) 842-7444 ext 117

I also had problems with erasing fields when the timer ticks, the answer is to hold a variable with the old value of (whatever) and to update the main form only if the value of (whatever) has changed. Another problem with having a timer on a form is that it makes debugging nearly impossible!

Add A Boolean CreditMessageShown to the Sales Line Form Globals and a function then if the Order becomes Credit hold. IF NOT CreditMessageShown THEN BEGIN IF SalesHeader.“Credit Hold” THEN BEGIN Message(‘Order %1 exceeds credit limit’,“No.”); CreditMessageShown:=NOT CreditMessageShown; END; END ELSE IF NOT SalesHeader.“Credit Hold” THEN CreditMessageShown:= NOT CreditMessageShown; This Will warn the operator giving them a change to reduce the order value or tell the customer. You would need to decide where to call the code from Quantity, Amount and “Unit Price” OnAfterValidate spring to mind! David Cox MindSource (UK) Limited Navision Solutions Partner Email: Web: Edited by - David Cox on 2001 Aug 23 11:57:39

David: standard Navision already displays a message when a customer exceeds their credit limit – that’s not the problem. I need a way to update the SalesHeader.Status field on the Sales Order card to “Credit Hold” from the Cust-Check Cr. Limit codeunit. Thanks Lars, Willam, and Dan for the timer ideas. Very creative, but I agree its not such a good solution. Any better ideas?

A solution could be to enlarge the subform and put a textbox (or whatever you need to display the credit status) on the subform, instead of putting it on the header part. Bit fiddling with the layout and it could look as if it is part of the main form. As source expression you would use SalesHeader.Status and you have to make sure the SalesHeader record is updated during the validation process. Not a big deal, 'cause SalesHeader is called a couple of times already. John

Yes John, I considered this solution too; but after some thought concluded that it also wasn’t such a good solution as it would create more problems than it would solve. There is existing standard functionality that updates the SalesHeader.Status field displayed on the Sales Order Card that I do not want to interfere with by moving the field from one form into another. Thanks anyway, I appreciate your effort. Any others?

You don’t need to change the validation or processing routines, just make the field invisible on the main form and show the value in an additional textbox on the subform. John

I am not sure if this would help, normally to refresh the value you would click manually on the main form to refresh values rite? wat you could do is to write something like “MainForm.Control1.Activate”, this will acticate the control on the main form. Which will update the values.