Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Elite Contributor
Posts: 70
Registered: ‎04-30-2009

SLX Web 7.5.1 - Code Snippet

Hi,

 

I'm creating an onPropertyChange event, in which I would like to save the value on a separate entity B when a value on entity A changes. The problem is, I write the following code:

 

                invest.Fund = fund.Name;
                invest.Save();


And when I run it, it falls into an infinite loop. If I take the save out, it doesn't loop, but it doesn't save either.

 

Any ideas?

 

Thanks!

~ Henry

Employee
Posts: 535
Registered: ‎03-30-2009

Re: SLX Web 7.5.1 - Code Snippet

Is Invest a child of the fund Entity?

 

If yes, then configure the Relationship betwen fund and invest to use a Cascade option that includes "Save".

 

Once configured in this manner - when the fund.Save() occurs, an invest.Save() will automatically happen for any related Invest entities that have been added and/or updated.

 

Note that this would occur automatically and that you woudl need to *remove* your explicit invest.Save();

 

I am not certain what the technique is if you are trying to update an Entity that is not related to the current Entity. I had struggled with that myself not long ago but lucked out and decided that a Relationship was actually going to be OK to create in my specific case.

 

 

Todd Hardin
SalesLogix Professional Services Group