I tried to edit system form from my code (dynamically add, remove and edit webresource).
One web resource in xml form structure is (for example):
<row>
<cell id="{8e331865-dcbd-4820-03e6-edb908641d02}" showlabel="false" colspan="1" auto="false" rowspan="15">
<labels>
<label description="Test" languagecode="1033" />
</labels>
<control id="WebResource_Test" classid="{9FDF5F91-88B1-47f4-AD53-C11EFC01A01D}">
<parameters>
<Url>a24_/DocumentUpload/index.html</Url>
<Data>dfsfsdfsfsdfsfds</Data>
<PassParameters>false</PassParameters>
<ShowOnMobileClient>false</ShowOnMobileClient>
<Security>false</Security>
<Scrolling>auto</Scrolling>
<Border>true</Border>
<WebResourceId>{315563AC-5C70-E711-80D7-00155D10673A}</WebResourceId>
</parameters>
</control>
<events>
<event name="onload" application="false">
<dependencies />
</event>
</events>
</cell>
</row>
Edit works fine, and remove (remove whole cell, or row where web resource control is settled).
Adding new web resource is problem. From my code everything looks fine but when I open form in CRM (for example Account form) element adjustment is a bit strange. After it I tried to fix element layout in CRM form editor and publish, usually whole form is broken, sometimes I cannot open it at all. When I check form XML, there is some new elements, ( form add some placeholders), some elements/rows which are not clickable...
Is it even possible to edit form outside of CRM form editor ?
Or there is some thing I did not take into account when I add new web resource.
Things I take into consideration:
- Every resource/control has classid="{9FDF5F91-88B1-47f4-AD53-C11EFC01A01D}".
According to documentation it is always the same
- WebResourceId is the Id of the resource in CRM data base from entity webresource.
- Publish form from code every time I change something.
Things I did not take into consideration:
- I did not create empty rows (as I think CRM editor does) for every rowspan I set into webresource. For example if row span is 6, I need to create additional 5 empty rows below my web resource row.
- Cell id. I create new guid for that,and just that, did not connect it with anything. I am not sure is it ok, or should be linked in some other entity.
*This post is locked for comments