
Hello,
I'm having some problems creating an URL for the entites forms on CRM Online. I have the following function for the URL construction:
public String ConstructUrl(String organizationName, String entityName, String recordId)
{
String url = "";
if (!organizationName.Equals("") && !entityName.Equals("") && !recordId.Equals(""))
{
url = "https://" + organizationName + ".crm4.dynamics.com/main.aspx?pagetype=entityrecord&etn=" + entityName + "&id=" + recordId;
}
return url;
}
The problem is the organizationName, this is not the Organization Unique name , nor the Organization Name which can be found under the User name on the top right corner. I think i need to access the discovery service from within the plugin to get this name but I cannot. I'm trying with the folloing code:
RetrieveOrganizationRequest
orgRequest =
new RetrieveOrganizationRequest()
{
UniqueName = context.OrganizationName,
AccessType = EndpointAccessType.Default,
Release = OrganizationRelease.Current
};
IDiscoveryService discoveryService = (IDiscoveryService)serviceProvider.GetService(typeof(IDiscoveryService));
RetrieveOrganizationResponse org = (RetrieveOrganizationResponse)discoveryService.Execute(orgRequest);
orgName = org.Detail.UrlName;
Can someone tell me what am I doing wrong?
The main question is: How can I get the Organization.UrlName in a Sandbox plugin?
Thanks in advance.
Zoran
*This post is locked for comments
I have the same question (0)