locked
How to get CRM Server Name in CRM Plugin RRS feed

  • Question

  • Hello Everybody,

    I am new to CRM development, i have a plugin which triggers on create of record in Task entity. Plugin has to create an email message with Subject and Description and an email will goes to owner of Task with an hyperlink to the task like http://localhost/OrgName//activities/task/edit.aspx?id=Guidofnewlycreatedtask.

    Problem:

    I need to get servername of the CRM and replace with localhost. Thru Plugin context i can get Organization Id.

     

    Any suggestions to get server name of the CRM in Plugin.

     

    Thanks in Advance.

    Mohan

    Thursday, April 8, 2010 9:06 AM

Answers

  •  

    Hi Mohan,

    You can get the server url by using:

     

    RegistryKey regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\MSCRM");

     

     string serverUrl = regKey.GetValue("ServerUrl").ToString();

     

    Hope this helps,

    Scott

    Friday, April 9, 2010 2:20 PM
    Answerer
  • try Environment.MachineName
    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Thursday, April 8, 2010 9:31 AM
    Moderator

All replies

  • try Environment.MachineName
    My blog : http://mscrmtools.blogspot.com
    You will find:
    Bulk Delete LauncherView Layout replicator
    ISV.Config Manager Form Javascript Manager
    Assembly RecoveryAnd others (use tool tag on my blog)
    Thursday, April 8, 2010 9:31 AM
    Moderator
  •  

    Hi Mohan,

    You can get the server url by using:

     

    RegistryKey regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\MSCRM");

     

     string serverUrl = regKey.GetValue("ServerUrl").ToString();

     

    Hope this helps,

    Scott

    Friday, April 9, 2010 2:20 PM
    Answerer
  • drop this into a form's onLoad event to get the Organization Name:

    alert("ORG_UNIQUE_NAME="+ORG_UNIQUE_NAME);

     

    if you really want just the DNS name of the server (it appears you are already on it) just right-click on My Computer and look at the Computer Name tab.

    Friday, April 9, 2010 4:15 PM