Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Add pop up window when creating a new lead or Opportunity

Posted on by 815

Hello,

We have 3 business units and have a question.

When creating a NEW lead or Opportunity, first system should ask on which Business Unit to create. Should be Drop down windows or pop up window.

Note : First should ask to select BU then it should allow to create new lead or opportunity.

Kindly help !

*This post is locked for comments

  • Syed_Faisal Profile Picture
    Syed_Faisal 815 on at
    RE: Add pop up window when creating a new lead or Opportunity

    Hi Mahender,

    Webresource created and it work fine inside network, outside (External) network it is not working, pl help.

    Here is the code :

    function SetBUField() {

       var BUName = window.parent.Xrm.Page.getAttribute("new_bu").getValue();

       if (BUName != null) {

           var req = new XMLHttpRequest();

           req.open("GET",

               Xrm.Page.context.getClientUrl() + "/api/data/v8.0/businessunits?$select=businessunitid,name",

               false);

           req.setRequestHeader("OData-MaxVersion", "4.0");

           req.setRequestHeader("OData-Version", "4.0");

           req.setRequestHeader("Accept", "application/json");

           req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

           req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");

           req.onreadystatechange = function () {

               if (this.readyState === 4) {

                   req.onreadystatechange = null;

                   if (this.status === 200) {

                       var results = JSON.parse(this.response);

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

                           var businessunitid = results.value[i]["businessunitid"];

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

                           if (name == BUName) {

                               var lookUpValue = new Array();

                               lookUpValue[0] = new Object();

                               lookUpValue[0].id = businessunitid.replace('{', "").replace('}', "").toString();

                               lookUpValue[0].name = name.toString();

                               lookUpValue[0].entityType = "businessunit";

                               Xrm.Page.getAttribute("new_businessunitid").setValue(lookUpValue);

                           }

                       }

                   } else {

                       Xrm.Utility.alertDialog(this.statusText);

                   }

               }

           };

           req.send();

       }

    }

    //Function to Filter Market Segment

    MarketSegmentFilterSearch = function () {

           Xrm.Page.getControl("new_marketsegmentid").addPreSearch(function () {

    AddPreSearch();

           });

    }

    //Function to Filter Market Segment

    AddPreSearch = function () {

      var businessUnitId = Xrm.Page.getAttribute("new_businessunitid").getValue()[0].id;

    if(businessUnitId != null){

       var Filter = "<filter type='and'><condition attribute='new_businessunitid' operator='eq' uitype='businessunit' value='"+businessUnitId+"'/></filter>";

                   Xrm.Page.getControl("new_marketsegmentid").addCustomFilter(Filter, "new_marketsegment");

    }

    }

  • Syed_Faisal Profile Picture
    Syed_Faisal 815 on at
    RE: Add pop up window when creating a new lead or Opportunity

    Hi Alex,

    I know but based on Business requirement, we changing the entire process.

  • Syed_Faisal Profile Picture
    Syed_Faisal 815 on at
    RE: Add pop up window when creating a new lead or Opportunity

    Hi Mahender,

    Thanks for the kind help,

    Could you also please help by step to do it?

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Add pop up window when creating a new lead or Opportunity

    You might also add a "required" lookup field to the form - probably even faster that way..

    On a side note, leads and opportunities are not created "on a business unit" - they are assigned to a user/team, and, that's how they get related to a business unit (in other words, even if you have a lookup, for example, it won't change much.. It's all about which user/team the lead/opportunity will be assigned to)

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Add pop up window when creating a new lead or Opportunity

    Hi Syed,

    You can create html webresource and create a custom New button for lead and opportunity which will first open your html webresource and after that it will redirect you to lead and opportunity form accordingly. you can easily override new button like this way. You can see our post for your reference: http://himbap.com/blog/?p=1486 we have not used html webresource but you can do that can open web resource using Xrm.Utility msdn.microsoft.com/.../jj602956.aspx

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