web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

open html (dialog) by ribbon button

(0) ShareShare
ReportReport
Posted on by 10

I have to create a new ribbon button on Account.

On click of this button, HTML webresource similar to dialog should open containing  - 

One dropdown list - which are lookup values from Account form (values to be fetched from CRM)

Text field - Reason

Submit button

On submit, it should create an email containing account url and requesting email receipent to approve change request . 

Please help !!

*This post is locked for comments

I have the same question (0)
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Kirti,

    So what all you have done so far and where do you need help/ assistance?

  • Verified answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Kirti,

    Step 1: Create a custom button on Account using ribbon workbench and call javascript from that

    Link for creating and calling javascript is below : mahenderpal.wordpress.com/.../calling-java-script-on-click-of-command-button-ms-crm-2015-step-by-step

    Step 2: Write javascript that will be called from button click which will open HTML page like below code :

    function OpenHTML() {

    if(Xrm.Page.data.entity.getEntityName()=="account")

    {

    var accoutid = Xrm.Page.getAttribute("new_axaccountid").getValue();

    if(accoutid)

    {

                            var customParameters = encodeURIComponent("AccountId="+accoutid);

    Xrm.Utility.openWebResource("new_GetInvoice", customParameters);

    }

    else

    {

    alert("Record not found !!!!!!")

    }

    }

    }  

    Step 3 : In above example i have create HTML with name : "new_GetInvoice", you also create a HTML web resource like this check below link for creating HTML web resource,

    crmbook.powerobjects.com/.../html-web-resources

    www.codeproject.com/.../Dynamic-Table-using-html-and-javascript

    Hope this helps,

    Shahbaaz

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    You can also utilise github.com/.../alertjs here or let us know if you are facing any issue in what you have done

  • kirti2709 Profile Picture
    10 on at

    I am having problem in creating HTML webresource because it should dynamically fetch territory entity records and display in dropdown.

    Done till below code -

    <html>

    <head>

       <title>Change Books of Business</title>

    </head>

    <body>

            Books of Business

           <select name="territory">

               <option value="bim1">BIM & Retail 1</option>

               <option value="bim2">BIM & Retail 2</option>

               <option value="bim3">BIM & Retail 3</option>

               <option value="bim4">Bim & Retail 4</option>

               <option value="bim5">Bim & Retail 5</option>

           </select>

           <br><br>

           Reason

           <input name="reason" type="text">

           <br><br />

           <input name="submitButton" type="submit" value="Submit">

     </body>

    </html>

    <select name="territory">

               <option value="bim1">BIM & Retail 1</option>

               <option value="bim2">BIM & Retail 2</option>

               <option value="bim3">BIM & Retail 3</option>

               <option value="bim4">Bim & Retail 4</option>

               <option value="bim5">Bim & Retail 5</option>

           </select>

    Here I have to bring values of territory dynamically as HTML opens

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    You can refer my post here: http://himbap.com/blog/?p=911 where fetching customer address and showing on a html drop down

  • kirti2709 Profile Picture
    10 on at

    Found solution -

    <html>

    <head>

       <title>Change Books of Business</title>

       <meta>

    </head>

    <body>

       <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

       <script src="..//WebResources/syn_Jquery_1.9.1_min" type="text/javascript"></script>

       <script src="..//WebResources/syn_json2" type="text/javascript"></script>

       <script src="..//WebResources/syn_XRMServiceToolkit" type="text/javascript"></script>

       <script language="javascript" type="text/javascript">

           function setBooks() {

               debugger;

               try {

                   //Get the parameters passed

                   var passedparams = ParseQueryString(GetGlobalContext().getQueryStringParameters()["Data"]);

                   //Populate the account ID

                   var accountID = passedparams.accountid;

                   accountID = accountID.replace('{', '').replace('}', '');

                   var accountFullName = passedparams.accountName;

                   var accountPriority = passedparams.accountPriority;

                   var currentAccountBook = passedparams.currentBook;

                   var newBookID = document.getElementById("territory").value;

                   var bookSelectedIndex = document.getElementById("territory").selectedIndex;

                   var newBookName = document.getElementsByTagName("option")[bookSelectedIndex].label;

                   var newAccountPriority = document.getElementById("priority").value;

                   var newReason = document.getElementById("reasonText").value;

                   var bookLookup = new Array();

                   bookLookup[0] = new Object();

                   bookLookup[0].id = newBookID;

                   bookLookup[0].name = newBookName;

                   bookLookup[0].entityType = "territory";

                   if (window.parent.opener.Xrm.Page.getAttribute("syn_reasontochangebooks") != null)

                   {

                       window.parent.opener.Xrm.Page.getAttribute("syn_reasontochangebooks").setValue(newReason);

                   }

                   if (window.parent.opener.Xrm.Page.getAttribute("syn_newbooksofbusiness") != null)

                   {

                       window.parent.opener.Xrm.Page.getAttribute("syn_newbooksofbusiness").setValue(bookLookup);

                   }                

                   if (window.parent.opener.Xrm.Page.getAttribute("syn_newaccountpriority") != null)

                   {

                       window.parent.opener.Xrm.Page.getAttribute("syn_newaccountpriority").setValue(newAccountPriority);

                   }

                   window.parent.opener.Xrm.Page.data.entity.save();

                   window.close();

               }

               catch (ex)

               {

                   console.log(ex.message);

               }

           }

           function ParseQueryString(query) {

               //debugger;

               var result = {};

               if (typeof query == "undefined" || query == null) {

                   return result;

               }

               var queryparts = query.split("&");

               for (var i = 0; i < queryparts.length; i++) {

                   var params = queryparts[i].split("=");

                   result[params[0]] = params.length > 1 ? params[1] : null;

               }

               return result;

           }

       </script>

       <style>

           h5 {

               font-family: Segoe UI,Tahoma,Arial;

               font-weight: bold;

               font-variant: normal;

               color: #000080;

               text-decoration: underline;

           }

           p {

               align-content: center;

               font-family: Segoe UI,Tahoma,Arial;

               font-size: 13px;

           }

       </style>

       <p>

           Books of Business

           <select name="territory" id="territory">

               <option value="90cf619a-7cf4-e711-8127-c4346bb59828" label="APAC 1">APAC 1</option>

               <option value="ea093502-7cf4-e711-8127-c4346bb59828" label="BIM & Retail 1">BIM & Retail 1</option>

               <option value="fad54008-7cf4-e711-8127-c4346bb59828" label="BIM & Retail 2">BIM & Retail 2</option>

               <option value="59583e0e-7cf4-e711-8127-c4346bb59828" label="BIM & Retail 3">BIM & Retail 3</option>

               <option value="3d793914-7cf4-e711-8127-c4346bb59828" label="Bim & Retail 4">Bim & Retail 4</option>

               <option value="edb85ba0-7cf4-e711-8127-c4346bb59828" label="EMEA 1">EMEA 1</option>

               <option value="aebe0aa7-7cf4-e711-8127-c4346bb59828" label="EMEA 2">EMEA 2</option>

               <option value="e15c391a-7cf4-e711-8127-c4346bb59828" label="Finserv & Insurance 1">Finserv & Insurance 1</option>

               <option value="7bc3ec2f-7cf4-e711-8127-c4346bb59828" label="Finserv & Insurance 2">Finserv & Insurance 2</option>

               <option value="7382e535-7cf4-e711-8127-c4346bb59828" label="Finserv & Insurance 3">Finserv & Insurance 3</option>

               <option value="e182e535-7cf4-e711-8127-c4346bb59828" label="Finserv & Insurance 4">Finserv & Insurance 4</option>

               <option value="c304e33b-7cf4-e711-8127-c4346bb59828" label="Finserv & Insurance 5">Finserv & Insurance 5</option>

               <option value="7bf78c4d-7cf4-e711-8127-c4346bb59828" label="Life Sciences & Healthcare 1">Life Sciences & Healthcare 1</option>

               <option value="d1798a53-7cf4-e711-8127-c4346bb59828" label="Life Sciences & Healthcare 2">Life Sciences & Healthcare 2</option>

               <option value="467fa56c-7cf4-e711-8127-c4346bb59828" label="Life Sciences & Healthcare 3">Life Sciences & Healthcare 3</option>

               <option value="477fa56c-7cf4-e711-8127-c4346bb59828" label="Life Sciences & Healthcare 4">Life Sciences & Healthcare 4</option>

               <option value="9e829373-7cf4-e711-8127-c4346bb59828" label="Life Sciences & Healthcare 5">Life Sciences & Healthcare 5</option>

               <option value="a7d4168d-7cf4-e711-8127-c4346bb59828" label="Strategic Book 1">Strategic Book 1</option>

               <option value="1a201393-7cf4-e711-8127-c4346bb59828" label="Strategic Book 2">Strategic Book 2</option>

               <option value="0c839373-7cf4-e711-8127-c4346bb59828" label="Tech 1">Tech 1</option>

               <option value="954a937f-7cf4-e711-8127-c4346bb59828" label="Tech 2">Tech 2</option>

               <option value="86567186-7cf4-e711-8127-c4346bb59828" label="Tech 3">Tech 3</option>

               <option value="87567186-7cf4-e711-8127-c4346bb59828" label="Tech 4">Tech 4</option>

           </select>

           <br><br />

           Account Priority

           <select name="accountpriority" id="priority">

               <option value="214680000">A Account</option>

               <option value="214680001">B Account</option>

               <option value="214680002">C Account</option>

               <option value="214680003">D Account</option>

               <option value="214680004">Tire 1</option>

               <option value="214680005">Tire 2</option>

           </select>

           <br><br />

           Reason

           <textarea name="reason" id="reasonText" cols="35" rows="2"></textarea>

           <br><br>

           <input name="submitButton" type="submit" value="Submit" onclick="setBooks()">

       </p>

    </body>

    </html>

  • Community Member Profile Picture
    on at

    Following this post and looking for solutions similar to this www.coolutils.com/TotalPDFConverter

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans