on 04-15-2016 6:04 PM
My need is that the ABSL code shouldn’t be executed at the moment the system raises an error. Only when the document - by standard - will be save because doesn’t have any error.
Hello,
All BeforeSave events are exected. The system collects the error messages and shows them after all events have been run. The data will NOT be written to the database as long as one ValidationOnSave script (standard or custom) will return false.
It's not possible to detect a fully error free document and then run some code. Because this code could again throw an error - and what should happen then?
The framework runs all events and then either saves, or not - based on the return values of the valididation on save events.
Best Regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You main issue is you dont want to save duplicate records in other BO. Is it?
If yes, then you should adjust your beforesave logic so it should not create repeated records,
As pradeep said you should read status in before save
If(status == release){
OtherBO.Create(boElements);
}
I have doubt about sequence of execution if first release action exectuted and then beforeSave it should serve the purpose.
Regads
Sunil
Hi
You should check some other condition to stop exectuing update other BO's records in case of first object does not save succesfully.
Did you tried using Action validation, check the which nodes is responsible for such error and write a validation logic in Action Validation(available for XBO only).
Regards
Sunil
Hi,
BeforeSave event will be executed always.
May be for your usecase, you could read Release status attribute on the BO to see if the it's released in the BeforeSave event.
Thanks, Pradeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sebastian,
Even if your code in before save is being executed it won't reflect in the BO until the save is executed. As there is a standard error message and save is failing you need not bother about it, as user will never be able to save your changes until the error is resolved.
Hope it helps.
Thanks & Regards,
Meghna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Meghna,
Yes you're right the user can't save until solve the error, but the code is executed and did some creation in other BO and when finally the user solve the error the system execute de code again and saved repeated record because if I do a query the first record isn't in the DataBase in this moment.
Thanks
Hi Sebastian,
Have you tried moving the error message to the Validation On Save and see is this changes the issue?
Or you could encapsulate the error message making it only raise if the status have changed to "released"?
You could try these options.
Regards,
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.