Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to use html web resource with dynamic content.

(0) ShareShare
ReportReport
Posted on by 6

Hello All Experts,

I want to use a simple html web resource which will do below things.

1. one select (Dropdown) will have 4 options.

2. on selecting of either of the option i would like to load the contents on the form.

3. contents will have text, textarea, checkbox etc.

4. finally will have submit and cancel button.

5. dynamic contents will gets saved when click on the submit button.

I just want to use the plain html and javascript and no third party library.

if it is possible kindly help me to get sample.

*This post is locked for comments

  • Verified answer
    Emre GULCAN Profile Picture
    2,379 on at
    RE: How to use html web resource with dynamic content.

    Hi,

    Firstly you should add (create) all fields on your custom webresource and disable or show/hide depend on your dropdown option.

    You can call external webservice or Dynamics CRM webapi on your "submit" button click event to save your data.

    You can find very very simple example below;

    <!DOCTYPE html>
    
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
        <script type="text/javascript">
            $(document).ready(function () {
    
                $("#ddlProcess").change(function () {
                    var selectedValue = $(this).val();
    
                    if (selectedValue == 1) {
                        //By Phone
                        $("#txtEmail").attr('disabled', 'disabled');
                        $("#txtPhonenumber").removeAttr('disabled');
                    }
                    else if (selectedValue == 2) {
                        //By Email
                        $("#txtPhonenumber").attr('disabled', 'disabled');
                        $("#txtEmail").removeAttr('disabled');
                    }
                    else {
                        //do your ELSE logic
                    }
                });
    
                $("#btnSubmit").click(function () {
                    //call your external webservice
                });
            });
        </script>
    
    </head>
    <body>
        <select id="ddlProcess">
            <option value="0">Please select</option>
            <option value="1">By Phone</option>
            <option value="2">By Email</option>
        </select>
    
        <label for="txtFirstname">Firstname</label>
        <input type="text" id="txtFirstname" />
    
        <label for="txtLastname">Lastname</label>
        <input type="text" id="txtLastname" />
    
        <label for="txtEmail">E-mail</label>
        <input type="text" id="txtEmail" />
    
        <label for="txtPhonenumber">PhoneNumber</label>
        <input type="text" id="txtPhonenumber" />
    
        <button id="btnSubmit">Save data</button>
    </body>
    </html>


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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,459 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans