tag:blogger.com,1999:blog-518307109112772972.post4289391695915700535..comments2024-03-28T00:29:34.101-04:00Comments on Gonzalo Ruiz - Dynamics CRM: Avoiding form reload when switching CRM forms based on a fieldGonzhttp://www.blogger.com/profile/02521457712101956774noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-518307109112772972.post-34399639140686244752016-09-21T12:00:19.132-04:002016-09-21T12:00:19.132-04:00You can make this work in 2016 by going to Setting...You can make this work in 2016 by going to Settings->Adminsitration->System settings->in the general tab select ‘Yes’ under Use legacy form rendering. Note that this option might be removed in future releases of CRM.fredhttps://www.blogger.com/profile/04861442357754270161noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-43880269814744906462016-09-21T11:59:07.075-04:002016-09-21T11:59:07.075-04:00There is a work around that makes this solution wo...There is a work around that makes this solution work in crm 2015 update 1 and up (so works in latest build of crm 2016 as well). Go to Settings - Administration - System Settings - General tab: Select ‘Yes’ under Use legacy form rendering to enable this mode for all users <br /><br />This will disable Turbo Forms which is what CRM uses since 2015 update 1 which basically stores all settings in localstorage to avoid a round trip to server to fetch the formId. Keep in mind that turbo forms makes the loading faster so this is a trade off. Also MS. might remove setting that legacy form option from the system settings in future releases.<br />fredhttps://www.blogger.com/profile/04861442357754270161noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-58152592283043841002016-05-12T07:53:27.465-04:002016-05-12T07:53:27.465-04:00I know it's also not supported but I think it ...I know it's also not supported but I think it breaks because the formid is stored in the localStorage. When we change the url value with the correct formid in the localStorage for the key ___ it seems to be working. So for the moment we just need to wait Microsoft proposes a way to choose the form to use depending on some conditions, use javascript to switch on load or show/hide tabs with everything on the same form...Thomashttps://www.blogger.com/profile/00746118602788682081noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-19994952636113256642016-01-07T16:23:09.299-05:002016-01-07T16:23:09.299-05:00Yes you're the man! Turns out this is unsuppor...Yes you're the man! Turns out this is unsupported and breaks in future versions though unfortunatelyGonzhttps://www.blogger.com/profile/02521457712101956774noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-68386617200084544072015-11-20T08:05:51.166-05:002015-11-20T08:05:51.166-05:00Thanks to your famous colleague for this great pos...Thanks to your famous colleague for this great post :)Steeve Gauvreauhttps://www.facebook.com/SG-Expert-Inc-525651360920730/noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-56246244423256416982015-08-20T12:30:54.017-04:002015-08-20T12:30:54.017-04:00Hi Guys,
After update to 2015 Spring Release (7.1...Hi Guys,<br /><br />After update to 2015 Spring Release (7.1) this approach stop working. With the new rendering engine the UI setting is not being pulled from server (this is my guess) and changing that setting from a plugin doesn't have effect on the displayed form.<br />Does anyone have some alternative to this? I been looking for alternatives and seems that the only one is reloading (or redirecting) the right form.José Ritohttps://www.blogger.com/profile/00896626519738812891noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-23116026800564604752015-08-05T18:00:05.661-04:002015-08-05T18:00:05.661-04:00Hi Gonzalo,
I had this implemented and it was grea...Hi Gonzalo,<br />I had this implemented and it was great, but after upgrade to CRM Online 2015 Update 1 it stop working. Seems to me that the new rendeing engine has something to do but is only a guess. Do you know anything about changes that may affect this approach?José Ritohttps://www.blogger.com/profile/00896626519738812891noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-14179564682501626192015-07-30T03:09:05.060-04:002015-07-30T03:09:05.060-04:00Great Work!
Code is working Perfect! But There is ...Great Work!<br />Code is working Perfect! But There is one Problem<br />I have Registered plug on retrieve of incident in crm2015, and also write log on first line of execute method. <br />i observed that for 1 request plug in fires 2 time for each (Pre & post) <br /><br />how we can avoid this<br /><br />Please help if you have any idea<br />Pradip Jadhavhttps://www.blogger.com/profile/10938540723685775038noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-18756484471857822822015-06-19T02:15:01.767-04:002015-06-19T02:15:01.767-04:00This does not work for custom entity. The retrieve...This does not work for custom entity. The retrieve plugin gets called for both 20 & 40 stage and the settings get updated too but form load doesnt reflect the changes. this definitely works with contact entity because the plugin is fired twice but for custom this is called only once.Anonymoushttps://www.blogger.com/profile/00779857315932598948noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-66805341805709230052015-06-19T02:14:47.174-04:002015-06-19T02:14:47.174-04:00This does not work for custom entity. The retrieve...This does not work for custom entity. The retrieve plugin gets called for both 20 & 40 stage and the settings get updated too but form load doesnt reflect the changes. this definitely works with contact entity because the plugin is fired twice but for custom this is called only once.Anonymoushttps://www.blogger.com/profile/00779857315932598948noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-30171969964726764432015-02-27T06:50:58.378-05:002015-02-27T06:50:58.378-05:00This comment has been removed by a blog administrator.Anonymoushttps://www.blogger.com/profile/04857981966809027275noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-64370584064782224782015-02-23T12:45:59.218-05:002015-02-23T12:45:59.218-05:00I got the same problem in my CRM 2011. The plugin ...I got the same problem in my CRM 2011. The plugin is registered as synchronous at pre-operation (20) and post-operation (40) but no lucky. The form is switched at the second visit.David Vaellonoreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-89507791088725867712015-02-09T10:27:55.373-05:002015-02-09T10:27:55.373-05:00FWIW, and perhaps for the benfits of others who co...FWIW, and perhaps for the benfits of others who come across this, I just got this working. After including a generated entity types class from CrmSvcUtil, I replaced the custom references and the custom methods that Mr. Ruiz was using. For the GetEntityFromContext method you mention, I ended up using the standard EntityReference that the Retrieve Target provides and then performing a RetrieveMultiple query using the target from the Retrieve to avoid a recursive call.Phillip U.noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-86165610472714274282015-02-06T10:52:23.928-05:002015-02-06T10:52:23.928-05:00Thanks for the great idea. I was wondering if you...Thanks for the great idea. I was wondering if you could help me out with the pre- and post-operation bits though? I am not familiar with the means you are using to determine the stage of the plugin (IsPreOperationStage method) and hoped you could provide a link or code for how you extended the context to include those methods.Phillip U.noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-8613457540126660192015-01-29T20:50:08.661-05:002015-01-29T20:50:08.661-05:00Make sure you register the plugin as synchronous a...Make sure you register the plugin as synchronous and in the steps specified.Gonzhttps://www.blogger.com/profile/02521457712101956774noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-88609684336610506782015-01-29T20:47:19.240-05:002015-01-29T20:47:19.240-05:00This comment has been removed by the author.Gonzhttps://www.blogger.com/profile/02521457712101956774noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-27382645210790049642015-01-22T07:30:54.438-05:002015-01-22T07:30:54.438-05:00Thank you for the example! Unfortunately I got a p...Thank you for the example! Unfortunately I got a problem, that the form only get switched at my second visit to a given entity. It seems, that your code updates the last viewed form correctly, but the update gets ignored on the visit which triggered the update. Did you got a similar behavior?Tomnoreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-69654146239447061822015-01-20T08:59:26.078-05:002015-01-20T08:59:26.078-05:00CRM gets the value of LastViewedFormXml before get...CRM gets the value of LastViewedFormXml before geting the value of the recordAnonymoushttps://www.blogger.com/profile/03283262549352312296noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-81063748781819773392015-01-20T08:29:19.451-05:002015-01-20T08:29:19.451-05:00This Code works however the value is modified afte...This Code works however the value is modified after the form loads. please adviseAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-12391100237008341422014-12-26T19:29:11.120-05:002014-12-26T19:29:11.120-05:00Great post, thanks! It appears that you are using...Great post, thanks! It appears that you are using some extension methods on IPluginExecutionContext, that help with checking the Stage and getting the current entity. Am I correct? I don't see any method named GetEntityFromContext on that interface. Also, are you using RetrieveMultiple to get the entity to avoid a recursive call in the Retrieve plugin, or using some other handling (SharedVariables??) to avoid recursive calls? Thanks again!Larry McCoyhttps://www.blogger.com/profile/09818307547257836765noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-62604908118509816552014-12-22T17:45:40.125-05:002014-12-22T17:45:40.125-05:00Hola Gonzalo, no he podido lograr que me funcione ...Hola Gonzalo, no he podido lograr que me funcione utilizando el post-operation en el mensaje Retrieve, me puedes ayudar??<br /><br />Gracias,<br /><br />private void SetForm(Entity caso, IOrganizationService service, Guid userId, string nombreFormulario)<br /> {<br /> RetrieveEntityRequest request = new RetrieveEntityRequest();<br /> request.LogicalName = "incident";<br /><br /> // Retrieve the MetaData.<br /> RetrieveEntityResponse response = (RetrieveEntityResponse)service.Execute(request);<br /> int objecttypecode = response.EntityMetadata.ObjectTypeCode.Value;<br /><br /> var query = new QueryExpression("userentityuisettings");<br /> query.Criteria.AddCondition("ownerid", ConditionOperator.Equal, userId);<br /> query.Criteria.AddCondition("objecttypecode", ConditionOperator.Equal, objecttypecode);<br /> query.ColumnSet = new ColumnSet("lastviewedformxml");<br /><br /> var settings = service.RetrieveMultiple(query).Entities;<br /><br /> var setting = settings[0].ToEntity();<br /><br /> string idFormToUse = string.Empty;<br /> var query2 = new QueryExpression("systemform");<br /> query2.Criteria.AddCondition("name", ConditionOperator.Equal, nombreFormulario);<br /> query2.ColumnSet = new ColumnSet("formid");<br /><br /> var form = service.RetrieveMultiple(query2).Entities;<br /> if (form != null)<br /> {<br /> string guidformateado = form[0].Id.ToString();<br /> idFormToUse = string.Format("", guidformateado);<br /><br /> if (setting.Contains("lastviewedformxml"))<br /> {<br /> string last = setting.Attributes["lastviewedformxml"].ToString();<br /> if (!idFormToUse.Equals(last, StringComparison.InvariantCultureIgnoreCase))<br /> {<br /> Entity userUI = new Entity("userentityuisettings");<br /> userUI.Id = setting.Id;<br /> userUI.Attributes["lastviewedformxml"] = idFormToUse;<br /> service.Update(userUI);<br /> }<br /> }<br /> }<br /> else<br /> {<br /> return;<br /> }<br /> }Anonymoushttps://www.blogger.com/profile/10962996356199968571noreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-88492465171417948422014-11-25T09:02:27.095-05:002014-11-25T09:02:27.095-05:00Hi Gonzalo,
great post! Had this idea already in J...Hi Gonzalo,<br />great post! Had this idea already in June this year but never had the opportunity to test it fully. Seems supported if you read through http://msdn.microsoft.com/en-us/library/gg327834.aspx. Why? If the strongly typed classes generated by the code generation tool (CrmSvcUtil.exe) contains the attributes, I would tend to say this is supported. Best regards, Philip<br />Philip Verlindenhttp://blog.philipverlinden.benoreply@blogger.comtag:blogger.com,1999:blog-518307109112772972.post-16764462446592906622014-11-20T04:50:07.435-05:002014-11-20T04:50:07.435-05:00Hi Gonzalo,
great Blog & great News to hear, ...Hi Gonzalo, <br />great Blog & great News to hear, that there is someone who tries to eliminate this annoying formchanger-problem. MS ignores the real user Problems here permanently.<br />thx for that.<br />Have you tested this in crm2015?<br />What makes me uncertain is your justified objection "gray area" & "..not dokumented in SDK" ... hmmm<br />Maybe we'll try it .. <br />the temptation is too big, that this damned formchanger could be history :-)<br />THX THX THX<br />Greets PeBPeBnoreply@blogger.com