Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Dynamics Crm 365 WebApi - Edit WebResource Systemforms from JavaScript

Posted on by Microsoft Employee

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans