Java Script Task 10: Create a html page and show the accounts mark red color font for city equal to dallas show in left navigation form?

 User Story: if you click on the html page in the left navigation then show only which accounts with red color font which account having the city name as Dallas.

1)      Open CRM Rest Builder and Retrieve the Account entity details such as choose fields as Name and Address1-city

2)      Write Java script code and add that code into to Html by using script tag

3)      Add This Html code in to web resource  

o   Here choose Web Resource type as Web Page (HTML)

4)      Go to Default solution and choose Client Extension Component

o      Under Client Extension choose Site Map

o      Open Site Map and choose Area and click on Add button and choose sub area and in URL field choose html web resource name.

1)      Open CRM Rest Builder choose conditions and click on Create Request


After Click on Create Request below code is generated


Code:

<html>

    <head>

        hello

    </head>

    <body>

        <div id="groupOfRecords"></div>

        <script>

            var groupOfRecords=document.getElementById("groupOfRecords");

 

            parent.Xrm.WebApi.online.retrieveMultipleRecords("account", "?$select=address1_city,name").then(

            function success(results)

            {

              for(var i = 0i < results.entities.lengthi++)

            {

            var address1_city = results.entities[i]["address1_city"];

            var name = results.entities[i]["name"];

            //Creating Paragraph element

            var groupItem=document.createElement("p");

            groupItem.textContent=name;

            if(address1_city!=null)

            {

                if(address1_city.toLowerCase()=="dallas")

            {

                groupItem.style.color = "red";

                 }

             }

            groupOfRecords.appendChild(groupItem);

            }

          },

            function(error)

            {

                Xrm.Utility.alertDialog(error.message);

            }

            );

        </script>

    </body>

</html>

 

Open web resource and click on New Button


In Type section area choose webpage (HTML) and click on Text editor


After clicking on Text Editor below window will open

Here choose Source and Paste the above code, click on Ok and Publish


Go to Default solution and choose Client Extensionsà SiteMap


If you click on site map below window will open

Here choose area and click on Add button and choose Type as Web Resource

Url: Choose web resource name

Title: Enter user defined name

Click on save and publish

Output:


Comments

Popular posts from this blog

SSRS User Story-7: Create a SSRS report group by Case, retrieve all work orders and make work orders as sub group, retrieve all bookable resource bookings based on work order. If booking is completed then show the row color as green.

SSRS User Story 2: Generate a report on individual student, if I click on the payment details report in student record. It need to show all the transactions done in current year along with sum. (it should show for each student separately)

SSRS User Story-8: Create a SSRS report on the Opportunity entity, show the source lead and campaign details.