Notifications
Announcements
No record found.
Hi,
I want to prevent user from switching to other record in grid, similar to 'ProdRoute' Form. If you create a new record via new button on that forms action pane, a new column is created in the grid. however if you dont fill all mandatory fields and try to select another record, a warning is shown and the selection doesn't change until you give all information. can you give me an idea on how to do that? i tried with overwritign leaverecord, validatewrite and active method with no success.
best regards
Hi erpdell,
Do you need this for the production route form or for another one?
Do you have any other information that can be shared?
Best regards,
Ludwig
If the field is always mandatory, simply set its Mandatory property to Yes.
If it's conditional, write the logic in validateWrite() (on table if it should be used across forms, on the form if it's specific a the single form) and return false if the validation failed.
Thanks for your reply. I've already set the mandatory property for all fields to yes. However, it does not prevent the user from selecting another row. Same thing applies, if I overwrite the validateWrite() method. So I suppose this isn't the desired behaviour, right?
If the validation fails, the selection is not expected to move to another grid line. Are you sure that you compiled your code?
Can you share some screenshots with us to illustrate what you did and how the system behaves? Thanks!
I've made a standalone form, which is similar to the prodroute form: In our productions, quality controls take place between almost every step of the production process. If defects are found during quality control, reworking should be done before production continues. Rework steps are normal production steps, which are only identified by an additional NoYes field in the ProdRoute table.The form I am implementing is designed to allow users to insert these rework steps (for security and ease of use, we do not want to provide users with the full ProdRoute form, therefore I am creating this new form). If a user now creates a new rework operation (inserts a new ProdRoute record), he should not be able to change the line until he has entered all the information required.
Thanks for the explanation. Could you share the requested screenshots? For troubleshooting these kinds of issues it's required to look into the details. Thanks!
These things are used on almost every table in AX, therefore it's unlikely that it's all broken. More likely, your implementation is incorrect.
Regarding Mandatory property, make sure you set it on the table field, not in the form.
Regarding your code in validateWrite(), please show it to us. We can't find bugs in code that you've never shown to us. Also, please tell us what you found when you debugged your code.
Yes I see that it's working for other Forms (e.g. the ProdRoute form). I've set the mandatory property in the form. I don't want to set it on the ProdTable itself, as that may break any logic for other forms? The code I tried for validateWrite() method is very basic:
private boolean isValid() { if(!prodRoute.OprId) return false; if(!prodRoute.ProcessTime) return false; if(!prodRoute.ProcessPerQty) return false; if(!prodRoute.WrkCtrIdCost) return false; if(!prodRoute.RouteGroupId) return false; return true; }
public boolean validateWrite() { return this.isValid(); }
Did you debug it? Does your validateWrite() method return false, but the user can still select another record in the grid?
validateWrite() is not getting called
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 592 Most Valuable Professional
André Arnaud de Cal... 478 Super User 2025 Season 2
BillurSamdancioglu 305 Most Valuable Professional