on 06-14-2016 4:46 AM
Hi all,
Exist one way to get or check in the event OnSave the field was changed ?
Hi
I did not understand the question but trying to give you an answer
CheckIn on the validation OnSave only unlock the file so other user can check it out and can edit it.
or Could you elaborate your question?
Regards
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anderson,
I really ought to make a blog post explaining how to detect whether a specific field has changed since the latest check since this seems to be a common requirement I also had a few times.
First: there is no support to detect the specific change just that something changed.
So you need to implement this yourself:
if (field != previousValue) {
previousValue = field;
// add your custom code here:
// custom code
}
Since you cannot modify the var "previousValue" in OnSave you need to do this in BeforeSave and store whether a change occured in a (possibly transient) field.
Hope to help,
Ludger
Hello Anderson,
There are in principle two different ways to handle this requirement:
HTH,
Horst
Hi Horst,
I extended the object "BussinessPartner" and for this objeto the event "AfterLoadiing" not exist.
I can put the Transient field, and compare in the BeforeSave, but when this field is validated in OnSave the value is not real, because the event "BeforeSave" is called many times. In the second call of event "BeforeSave" the field was changed to "not modified" because in the first execute of event the field was set to "modified".
How can I execute BeforeSave only one time or call the code only one time ?
Hello Anderson,
Ahh, very import information: You are in a Business Object Extension.
That's a different game. As Pradeep mentions, there is no Transient annotation in XBO.
As it is the Business Partner you can also not use the Node Extension.
The exit BeforeSave is executed if the Save proces is started as often as soem data of the node has been changed. This can be influenced form the programming side.
You logic must become more stable in this situation.
Bye,
Horst
Hi Anderson,
The guys here have basically suggested you two approaches:
- Create another field for each field you want to control the changes, and manage it manually. These additional fields are not shown on UI, they are used just to manage the changes.
- Do a query from DB and compare the value coming on the instances from DB with "this". Just be careful with performance issues.
Thanks.
Fernando
Hi,
I don't think there is any straight forward way to find it.
You could try the following
call Retrieve (gets data from buffer) and then
call Query(gets data from the database) on the same node
and compare the result between Retrieve and Query for the same instance if there is any difference, if yes, which means it was modified and buffer contains the modification, so you can find the particular field that got changed.
Thanks, Pradeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.