tag:blogger.com,1999:blog-4494374321020146214.post4687927437802636822..comments2023-10-03T08:48:21.795-07:00Comments on A pinch of XRM for better CRM recipes: Clone an Opportunity in MS CRM 2011 by Plugin.Mohammad Yusuf Ansarihttp://www.blogger.com/profile/17648953639659636735noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-4494374321020146214.post-4423285423829975372014-08-25T14:59:16.542-07:002014-08-25T14:59:16.542-07:00context.Depth > 1 is very much a valid scenario...context.Depth > 1 is very much a valid scenario and should not be used as a check against looping. If you had a plugin on save of one entity that creates or updates a second entity, any messages registered on that second entity would have a context of 2. Same can apply to workflow triggering during data import etc.<br /><br />The system will automatically error out if the depth > 8. There's no reason to check the depth for looping unless you have bad code / logic.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4494374321020146214.post-19168358012818183962014-03-06T02:58:51.370-08:002014-03-06T02:58:51.370-08:00Could u please give any solution for this?Could u please give any solution for this?Anonymoushttps://www.blogger.com/profile/10532514252357463610noreply@blogger.comtag:blogger.com,1999:blog-4494374321020146214.post-17621876020134590602014-03-06T01:40:43.417-08:002014-03-06T01:40:43.417-08:00I tried what you said above but i am getting error...I tried what you said above but i am getting error while creating new entity.error is "Generic SQL error".this is my code<br />Entity newAccount = null;<br />Entity oldAccount = new Entity();<br /> oldAccount = service.Retrieve("account", AccountID, new ColumnSet(true));<br /> if (oldAccount != null)<br /> {<br /> oldAccount .Attributes.Remove("accountid");<br /> oldAccount .Id = Guid.NewGuid();<br /> newAccount = oldAccount ;<br /> Guid accountID = service.Create(newAccount);<br /> }Anonymoushttps://www.blogger.com/profile/10532514252357463610noreply@blogger.com