Answered by:
How to get CRM Server Name in CRM Plugin

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
- Marked as answer by Donna EdwardsMVP Monday, April 12, 2010 6:03 PM
Friday, April 9, 2010 2:20 PMAnswerer -
try Environment.MachineName
My blog : http://mscrmtools.blogspot.comYou will find:Bulk Delete Launcher View Layout replicator ISV.Config Manager Form Javascript Manager Assembly Recovery And others (use tool tag on my blog) - Marked as answer by Donna EdwardsMVP Monday, April 12, 2010 6:03 PM
Thursday, April 8, 2010 9:31 AMModeratorAll replies
-
try Environment.MachineName
My blog : http://mscrmtools.blogspot.comYou will find:Bulk Delete Launcher View Layout replicator ISV.Config Manager Form Javascript Manager Assembly Recovery And others (use tool tag on my blog) - Marked as answer by Donna EdwardsMVP Monday, April 12, 2010 6:03 PM
Thursday, April 8, 2010 9:31 AMModeratorHi 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
- Marked as answer by Donna EdwardsMVP Monday, April 12, 2010 6:03 PM
Friday, April 9, 2010 2:20 PMAnswererdrop 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.
- Proposed as answer by Marcus Mattson Friday, April 9, 2010 4:49 PM
- Proposed as answer by Marcus Mattson Friday, April 9, 2010 4:53 PM
Friday, April 9, 2010 4:15 PM