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)

How to get Organization url or discovery url in plugin

(0) ShareShare
ReportReport
Posted on by

Is there a way to get either discovery url or organisation url in plugin. 
I know i can get organisation name/id. But I need complete url so that i can differentiate between dev/ QA / Production

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Abhishek Dhoriya Profile Picture
    1,013 on at

    Hi kavita,

    You can User Plugin Registration Tool's Unsecure Config Parameters  to pass your URL from external which you can capture inside the plugin and which can be used for differentiating your three different environments.

  • Community Member Profile Picture
    on at

    This is what we are doing already , but every time there is change to plugin , we register it  on dev and then import this solution to qa and eventually to production. Now the problem is , if I forget to change url in dev n production (this is also repetitive work) , it will point wrong database

  • Mahendar Pal Profile Picture
    45,095 on at

    Hi Kavita,

    How about keeping these information over web resource and read web resource in your plugin.

  • MilindP Profile Picture
    1,019 on at

    pass if as secured parameter to the plug-in

  • Suggested answer
    Abhishek Dhoriya Profile Picture
    1,013 on at

    you can have use one custom entity (eg. Plugin Parameter) with URL field that you will read in your plugin , not only URL parameter but also you can add more parameter as per your wish. This approach has following benefits.

    1) You have the control to change the  Parameter value post deployment with minimal efforts.

    2) Customization is one time effort in across all environments.

    3) you can add remove Parameter as per your choice.

  • Community Member Profile Picture
    on at

    I want to know the organization url , so that I can decide which DB to connect. What you have proposed is getting url after connection to DB.

  • Rajkumar Rajaraman Profile Picture
    on at

    Kavita,

    Refer this link:

    rokhri.com/.../crm-2011-get-list-of-all-organizations-and-get-url-from-organization-details-collection

    Hope this helps.

    Regards,

    R.Rajkumar

    "Please mark my answer as verified if you found it helpful"

  • Suggested answer
    anilambadan Profile Picture
    1,160 on at

    Hi Kavita,

    You may be able to create a webservice to get Organization url. So in the web.config for the web service you can put different urls for organisation service based on environments. And in your code based the url (HttpContext.Current.Request.Url.AbsoluteUri)  you can decide whether you are on which environment. then you can find out the url from the web.config based on the url.

    Otherwise you can hard code the url based on the current page's url

    if(HttpContext.Current.Request.Url.AbsoluteUri.contain("live")

    {

    url="liveurl";

    }

    else if (HttpContext.Current.Request.Url.AbsoluteUri.contains("Dev")

    {

    url="devurl";

    }

    Please note, I haven't tried the above idea.

    thanks

    Anil

  • Community Member Profile Picture
    on at

    This would work , but I'm working with CRM2011 onpremise , and it throws "SecurityException : The assembly does not allow partially trusted callers" for HttpContext .

    I'm completely stuck.

  • Rajkumar Rajaraman Profile Picture
    on at

    The issue is that the plug-in is being deployed to the Sandbox. Since the plug-in is in the Sandbox, it is running as a partially trusted caller.

    Refer the following thread:

    social.microsoft.com/.../systemsecuritysecurityexception-that-assembly-does-not-allow-partially-trusted-callers

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