Discussion:
Datasource field modified method is called twice
(too old to reply)
Adam
2007-09-13 00:52:01 UTC
Permalink
If you override the modified method on a string field in a data source, it
seems that the modified method is called twice. Once when the field is
modified and somehow the "leave" method is triggering a second call to the
method. Has anyone had to deal with this? I came up with a really dirty way
of getting around it by checking the call stack and only executing my code in
certain situations, but there has to be a better way of handling this.

I also noticed that it's only called once if you manually type in a value,
but if I select a value from the lookup, that is when the method is called
twice. Any suggestions?

Thanks,
Adam
Adam
2007-09-13 01:10:00 UTC
Permalink
It looks like I'm introducing the problem by trying to refresh the child data
source after the field is modified, so the question is how I can refresh a
data source without the modified method being called a second time. It might
not be possible, considering the way AX works with these types of things is
to wait until the record is written before updating the child data source.
Post by Adam
If you override the modified method on a string field in a data source, it
seems that the modified method is called twice. Once when the field is
modified and somehow the "leave" method is triggering a second call to the
method. Has anyone had to deal with this? I came up with a really dirty way
of getting around it by checking the call stack and only executing my code in
certain situations, but there has to be a better way of handling this.
I also noticed that it's only called once if you manually type in a value,
but if I select a value from the lookup, that is when the method is called
twice. Any suggestions?
Thanks,
Adam
metin emre
2011-09-06 13:14:57 UTC
Permalink
Hi,

I faced same situation and found no solution. Did you find a solution?
Post by Adam
If you override the modified method on a string field in a data source, it
seems that the modified method is called twice. Once when the field is
modified and somehow the "leave" method is triggering a second call to the
method. Has anyone had to deal with this? I came up with a really dirty way
of getting around it by checking the call stack and only executing my code in
certain situations, but there has to be a better way of handling this.
I also noticed that it's only called once if you manually type in a value,
but if I select a value from the lookup, that is when the method is called
twice. Any suggestions?
Thanks,
Adam
Post by Adam
It looks like I'm introducing the problem by trying to refresh the child data
source after the field is modified, so the question is how I can refresh a
data source without the modified method being called a second time. It might
not be possible, considering the way AX works with these types of things is
to wait until the record is written before updating the child data source.
Loading...