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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / How to get the Organiz...
Sales forum

How to get the Organization URL in plugin

(0) ShareShare
ReportReport
Posted on by 160

Hi All,

I want to retrieve the Organization URL in plugin. Can anyone let me know how we can achieve it?

Categories:
I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    I am not aware of a way to get it, normally you put the url inside the unsecured configuration of the plugin, or put inside a custom settings entity and retrieve it if you use one.

  • ram r Profile Picture
    on at

    This may be of some help

    https://community.dynamics.com/crm/f/117/t/168259

  • Krishna Bhanushali Profile Picture
    160 on at

    Hi Ramanathan, First link no more exists and the Second link consists of JavaScript function. Both the links did not helped me.

  • Krishna Bhanushali Profile Picture
    160 on at

    Thank you for the answer but I do not want to pass in Configuration of the plugin. Is there any other way to get the Organization URL directly in plugin ?

  • ram r Profile Picture
    on at

    There is some glitch with CRM community links now and could be a temp issue. Even I can't access the URL, lets wait for sometime and check again.

    Try this: https://community.dynamics.com/nav/crm/f/117/t/168259

  • Suggested answer
    chauhanhardik Profile Picture
    687 on at

    Hello Krishna,

    To achieve this create one field named "OrgUrl".

    now set value for the same using Xrm.Page.getAttributes("new_OrgUrl").setValue(Xrm.Page.context.getClientUrl())

    retrieve this field's value in plugin, Done.

    Thanks,

    Harry

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    You can create a Configuration Settings entity, where you store default parameters. Have a record in there for Organization Url, and retrieve that record by name from your plugin.

    We used that logic sometime to retrieve parameters that are not available from backend code.

    Not what you are looking for, but a solution.

  • Suggested answer
    Josh P Profile Picture
    2,895 on at

    This is an old thread, but this will work in Dynamics 365 for plugins:

    var orgName = serviceClient.ConnectedOrgPublishedEndpoints[Microsoft.Xrm.Sdk.Discovery.EndpointType.WebApplication];

    This returns the URL part: https://<orgname>.crm.dynamics.com/

  • Suggested answer
    Shahzeb Khan Profile Picture
    167 on at

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Sales

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans