How entity edit URL from within plug-in in MS Dynamics CRM 4.0









up vote
1
down vote

favorite












I would like to have a workflow create a task, then email the assigned user that they have a new task and include a link to the newly created task in the body of the email. I have client side code that will correctly create the edit URL, using the entities GUID and stores it in a custom attribute. However, when the task is created from within a workflow, the client script isn't run.



So, I think a plug-in should work, but I can't figure out how to determine the URL of the CRM installation. I'm authoring this in a test environment and definitely don't want to have to change things when I move to production. I'm sure I could use a config file, but seems like the plug-in should be able to figure this out at runtime.



Anyone have any ideas how to access the URL of the crm service from within a plug-in? Any other ideas?










share|improve this question



























    up vote
    1
    down vote

    favorite












    I would like to have a workflow create a task, then email the assigned user that they have a new task and include a link to the newly created task in the body of the email. I have client side code that will correctly create the edit URL, using the entities GUID and stores it in a custom attribute. However, when the task is created from within a workflow, the client script isn't run.



    So, I think a plug-in should work, but I can't figure out how to determine the URL of the CRM installation. I'm authoring this in a test environment and definitely don't want to have to change things when I move to production. I'm sure I could use a config file, but seems like the plug-in should be able to figure this out at runtime.



    Anyone have any ideas how to access the URL of the crm service from within a plug-in? Any other ideas?










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I would like to have a workflow create a task, then email the assigned user that they have a new task and include a link to the newly created task in the body of the email. I have client side code that will correctly create the edit URL, using the entities GUID and stores it in a custom attribute. However, when the task is created from within a workflow, the client script isn't run.



      So, I think a plug-in should work, but I can't figure out how to determine the URL of the CRM installation. I'm authoring this in a test environment and definitely don't want to have to change things when I move to production. I'm sure I could use a config file, but seems like the plug-in should be able to figure this out at runtime.



      Anyone have any ideas how to access the URL of the crm service from within a plug-in? Any other ideas?










      share|improve this question















      I would like to have a workflow create a task, then email the assigned user that they have a new task and include a link to the newly created task in the body of the email. I have client side code that will correctly create the edit URL, using the entities GUID and stores it in a custom attribute. However, when the task is created from within a workflow, the client script isn't run.



      So, I think a plug-in should work, but I can't figure out how to determine the URL of the CRM installation. I'm authoring this in a test environment and definitely don't want to have to change things when I move to production. I'm sure I could use a config file, but seems like the plug-in should be able to figure this out at runtime.



      Anyone have any ideas how to access the URL of the crm service from within a plug-in? Any other ideas?







      dynamics-crm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 10:17









      Cœur

      17.2k9102141




      17.2k9102141










      asked Apr 10 '10 at 1:50









      Greg McGuffey

      1,34831844




      1,34831844






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          There is no simple way to do this. However, there is one.



          The MSCRM_Config is the deployment database that handle physical deployment properties, like the URL from which users are accessing the CRM deployment. The url that you might want is the one stored in "ADWebApplicationRootDomain", in the MSCRM_CONFIG.dbo.DeploymentProperties table. You may need some permission to access this database.



          Note that this doesn't work in a deployment that is an Internet Facing Deployment.



          Another way could be to query the discovery service to retrieve the same information (in the case that you are on the Online edition of MSCRM4).






          share|improve this answer




















          • To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
            – Greg McGuffey
            Apr 10 '10 at 14:48










          • The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
            – BeardinaSuit
            Apr 10 '10 at 16:57










          • OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
            – Greg McGuffey
            Apr 12 '10 at 19:04

















          up vote
          1
          down vote













          What do you mean by "change things"?



          If you create a custom workflow assembly, you can give it a server url input. Once you register it with CRM, you can simply type in the server url when you configure the workflow. You'll have to update the url for any workflows that use the custom workflow assembly once you move to production, but you'll only have to do that once.



          My apologies if this is what you meant you wanted to avoid.



          Edit: Sounds like you may be able to use the CustomConfiguration attribute when you register the plugin. Here's some more info.



          http://blogs.msdn.com/crm/archive/2008/10/24/storing-configuration-data-for-microsoft-dynamics-crm-plug-ins.aspx






          share|improve this answer






















          • This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
            – Greg McGuffey
            Apr 10 '10 at 14:45

















          up vote
          0
          down vote













          String Url = ((string)(Registry.LocalMachine.OpenSubKey(
          "Software\Microsoft\MSCRM").GetValue("ServerUrl"))
          ).Replace("MSCRMServices", "");





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2611920%2fhow-entity-edit-url-from-within-plug-in-in-ms-dynamics-crm-4-0%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            There is no simple way to do this. However, there is one.



            The MSCRM_Config is the deployment database that handle physical deployment properties, like the URL from which users are accessing the CRM deployment. The url that you might want is the one stored in "ADWebApplicationRootDomain", in the MSCRM_CONFIG.dbo.DeploymentProperties table. You may need some permission to access this database.



            Note that this doesn't work in a deployment that is an Internet Facing Deployment.



            Another way could be to query the discovery service to retrieve the same information (in the case that you are on the Online edition of MSCRM4).






            share|improve this answer




















            • To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
              – Greg McGuffey
              Apr 10 '10 at 14:48










            • The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
              – BeardinaSuit
              Apr 10 '10 at 16:57










            • OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
              – Greg McGuffey
              Apr 12 '10 at 19:04














            up vote
            1
            down vote



            accepted










            There is no simple way to do this. However, there is one.



            The MSCRM_Config is the deployment database that handle physical deployment properties, like the URL from which users are accessing the CRM deployment. The url that you might want is the one stored in "ADWebApplicationRootDomain", in the MSCRM_CONFIG.dbo.DeploymentProperties table. You may need some permission to access this database.



            Note that this doesn't work in a deployment that is an Internet Facing Deployment.



            Another way could be to query the discovery service to retrieve the same information (in the case that you are on the Online edition of MSCRM4).






            share|improve this answer




















            • To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
              – Greg McGuffey
              Apr 10 '10 at 14:48










            • The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
              – BeardinaSuit
              Apr 10 '10 at 16:57










            • OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
              – Greg McGuffey
              Apr 12 '10 at 19:04












            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            There is no simple way to do this. However, there is one.



            The MSCRM_Config is the deployment database that handle physical deployment properties, like the URL from which users are accessing the CRM deployment. The url that you might want is the one stored in "ADWebApplicationRootDomain", in the MSCRM_CONFIG.dbo.DeploymentProperties table. You may need some permission to access this database.



            Note that this doesn't work in a deployment that is an Internet Facing Deployment.



            Another way could be to query the discovery service to retrieve the same information (in the case that you are on the Online edition of MSCRM4).






            share|improve this answer












            There is no simple way to do this. However, there is one.



            The MSCRM_Config is the deployment database that handle physical deployment properties, like the URL from which users are accessing the CRM deployment. The url that you might want is the one stored in "ADWebApplicationRootDomain", in the MSCRM_CONFIG.dbo.DeploymentProperties table. You may need some permission to access this database.



            Note that this doesn't work in a deployment that is an Internet Facing Deployment.



            Another way could be to query the discovery service to retrieve the same information (in the case that you are on the Online edition of MSCRM4).







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 10 '10 at 2:27









            BeardinaSuit

            714513




            714513











            • To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
              – Greg McGuffey
              Apr 10 '10 at 14:48










            • The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
              – BeardinaSuit
              Apr 10 '10 at 16:57










            • OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
              – Greg McGuffey
              Apr 12 '10 at 19:04
















            • To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
              – Greg McGuffey
              Apr 10 '10 at 14:48










            • The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
              – BeardinaSuit
              Apr 10 '10 at 16:57










            • OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
              – Greg McGuffey
              Apr 12 '10 at 19:04















            To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
            – Greg McGuffey
            Apr 10 '10 at 14:48




            To clarify what you're saying, the URL is in the table but only if I'm NOT using IFD? I haven't tried IFD yet, but I thought it added internet facing deployment to an onsite deployment. I.e. both worked. Is this incorrect?
            – Greg McGuffey
            Apr 10 '10 at 14:48












            The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
            – BeardinaSuit
            Apr 10 '10 at 16:57




            The problem is that if you deploy CRM using IFD, the URL should be orgname.dnsprefix.company.com when accessing from the internet. But what will be stored in CRM is internalservername and this can't be accessed from the internet...
            – BeardinaSuit
            Apr 10 '10 at 16:57












            OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
            – Greg McGuffey
            Apr 12 '10 at 19:04




            OK, so the internal URL would still work, but the URL wouldn't work for IFD users. That makes (unfortunate) sense. Thanks
            – Greg McGuffey
            Apr 12 '10 at 19:04












            up vote
            1
            down vote













            What do you mean by "change things"?



            If you create a custom workflow assembly, you can give it a server url input. Once you register it with CRM, you can simply type in the server url when you configure the workflow. You'll have to update the url for any workflows that use the custom workflow assembly once you move to production, but you'll only have to do that once.



            My apologies if this is what you meant you wanted to avoid.



            Edit: Sounds like you may be able to use the CustomConfiguration attribute when you register the plugin. Here's some more info.



            http://blogs.msdn.com/crm/archive/2008/10/24/storing-configuration-data-for-microsoft-dynamics-crm-plug-ins.aspx






            share|improve this answer






















            • This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
              – Greg McGuffey
              Apr 10 '10 at 14:45














            up vote
            1
            down vote













            What do you mean by "change things"?



            If you create a custom workflow assembly, you can give it a server url input. Once you register it with CRM, you can simply type in the server url when you configure the workflow. You'll have to update the url for any workflows that use the custom workflow assembly once you move to production, but you'll only have to do that once.



            My apologies if this is what you meant you wanted to avoid.



            Edit: Sounds like you may be able to use the CustomConfiguration attribute when you register the plugin. Here's some more info.



            http://blogs.msdn.com/crm/archive/2008/10/24/storing-configuration-data-for-microsoft-dynamics-crm-plug-ins.aspx






            share|improve this answer






















            • This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
              – Greg McGuffey
              Apr 10 '10 at 14:45












            up vote
            1
            down vote










            up vote
            1
            down vote









            What do you mean by "change things"?



            If you create a custom workflow assembly, you can give it a server url input. Once you register it with CRM, you can simply type in the server url when you configure the workflow. You'll have to update the url for any workflows that use the custom workflow assembly once you move to production, but you'll only have to do that once.



            My apologies if this is what you meant you wanted to avoid.



            Edit: Sounds like you may be able to use the CustomConfiguration attribute when you register the plugin. Here's some more info.



            http://blogs.msdn.com/crm/archive/2008/10/24/storing-configuration-data-for-microsoft-dynamics-crm-plug-ins.aspx






            share|improve this answer














            What do you mean by "change things"?



            If you create a custom workflow assembly, you can give it a server url input. Once you register it with CRM, you can simply type in the server url when you configure the workflow. You'll have to update the url for any workflows that use the custom workflow assembly once you move to production, but you'll only have to do that once.



            My apologies if this is what you meant you wanted to avoid.



            Edit: Sounds like you may be able to use the CustomConfiguration attribute when you register the plugin. Here's some more info.



            http://blogs.msdn.com/crm/archive/2008/10/24/storing-configuration-data-for-microsoft-dynamics-crm-plug-ins.aspx







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 11 '10 at 2:24

























            answered Apr 10 '10 at 3:39









            Polshgiant

            3,27311724




            3,27311724











            • This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
              – Greg McGuffey
              Apr 10 '10 at 14:45
















            • This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
              – Greg McGuffey
              Apr 10 '10 at 14:45















            This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
            – Greg McGuffey
            Apr 10 '10 at 14:45




            This is good to know, but I was using a plug-in, not a custom workflow activity. I need to be able to insert a URL into the body of an email (sendemailactivity) that is a link to a specific entity.
            – Greg McGuffey
            Apr 10 '10 at 14:45










            up vote
            0
            down vote













            String Url = ((string)(Registry.LocalMachine.OpenSubKey(
            "Software\Microsoft\MSCRM").GetValue("ServerUrl"))
            ).Replace("MSCRMServices", "");





            share|improve this answer


























              up vote
              0
              down vote













              String Url = ((string)(Registry.LocalMachine.OpenSubKey(
              "Software\Microsoft\MSCRM").GetValue("ServerUrl"))
              ).Replace("MSCRMServices", "");





              share|improve this answer
























                up vote
                0
                down vote










                up vote
                0
                down vote









                String Url = ((string)(Registry.LocalMachine.OpenSubKey(
                "Software\Microsoft\MSCRM").GetValue("ServerUrl"))
                ).Replace("MSCRMServices", "");





                share|improve this answer














                String Url = ((string)(Registry.LocalMachine.OpenSubKey(
                "Software\Microsoft\MSCRM").GetValue("ServerUrl"))
                ).Replace("MSCRMServices", "");






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 24 '12 at 8:15









                rene

                33.2k1178104




                33.2k1178104










                answered Apr 26 '10 at 10:32









                DarkAxe

                1




                1



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2611920%2fhow-entity-edit-url-from-within-plug-in-in-ms-dynamics-crm-4-0%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo