Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to know CRM account detail whether it is on premise or online using HTML/js resource?

Posted on by Microsoft Employee

Hi,

I am working on a solution where I need to change code flow according to the CRM Account Type(On Premise/Online).

Can anybody suggest me how can I come to know whether account is OnPremise or Online using WebAPI(Ajax) call?

Please guide

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to know CRM account detail whether it is on premise or online using HTML/js resource?

    Hi Chhaya,

    this code is valid for all versions:

    var clienturl = Xrm.Page.context.getClientUrl();
    var iscloud = clienturl.indexOf("dynamics.com") > -1;
    if(iscloud)
    ...
    else
    ...

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to know CRM account detail whether it is on premise or online using HTML/js resource?

    Just to add to Rawish's comment, the context.isOnPremise is only available for CRM version 9 and above.

    If you have version 9 (July 2017 update), that is the way to go.

    If you are still on 8.2 or previous version the getClientUrl is probably the easiest way to get you the results that you are looking for.

    Hope this helps.

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: How to know CRM account detail whether it is on premise or online using HTML/js resource?

    Hi Chhaya,

    Below blog from Syed might help :

    http://mscrm365.blogspot.in/2017/12/how-to-check-crm-instance-is-online-or.html 

    mark this suggestion as verified if helpful

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to know CRM account detail whether it is on premise or online using HTML/js resource?

    I don't think you need webapi for that.

    You can just get the Client Url using Xrm.Page.context.getClientUrl()

    If that client Url has dynamics.com in the Url, you know that it's the online environment.

    Hope this helps

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans