Domanda

I have a calendar that displays activities from CRM 2013. This calendar is hosted as a separate MVC4 application.

I can surf to and use the calendar either by going directly to it at calendar.domain.com or by clicking my way to it inside of CRM.

In the details of each event there is a link to the original CRM activity, and by clicking on it a new window opens pointing to the original CRM entity.

This latter part with the link works great outside of crm when you are using the calendar directly, but when the page is integrated inside of CRM 2013 the new window points back to the calendar. Its like CRM is blocking the opening of the page and pointing it back to the originating source.

I have integrated the calendar inside of CRM using a webresource with the following html and the sitemap editor:

<html>
<head>
    <meta charset="utf-8">
</head>
<body>
    <script type="text/javascript">
        window.location.href = "https://calendar.domain.com/";
    </script>
</body>
</html>

When you go to in CRM, it redirects to the calendar seamlessly.

I have tried creating links with target="_parent" and target="_blank" but both result in the same thing, works outside of CRM, but inside crm the new page just shows the calendar again.

I also tried to use javascript to redirect the page, but the result is still the same.

<a href="#" onclick="javascript:openUrl('<<url>>');return false;">CRM Activity link</a>

function openUrl(rurl) {
    window.open(rurl);
}

I know there are ways to open entities using SDK functions but I am hoping I can avoid that so that I can use the same calendar both inside and out of CRM.

È stato utile?

Soluzione

Using trial and error I arrived at a javascript function that opens the record as a new page, it works both outside and as an page embedded inside crm 2013.

I'm calling the function with something like this:

openEntityRecord("activity", "1234-45687-6785-2342", "https://contoso.mydomain.com");

Function:

function openEntityRecord(enityLogicalName, guid, baseUrl) {
    var randomnumber = 100000000 + Math.floor(Math.random() * 900000000);
    var url = baseUrl + "main.aspx?etn=" + enityLogicalName + "&extraqs=&histKey=" + randomnumber + "&id={" + guid + "}&newWindow=true&pagetype=entityrecord";
    window.open(url, "", "status=0,resizable=1,width=1000px,height=600px");
}

Altri suggerimenti

Making some reports for CRM I've found a cleaner way of making Url.

You can use link which is originated from SSRS. You need 4 things for that:

  • Server Name = Contoso
  • Organization Name = TestOrg
  • Entity Logical Name = lead
  • Entity Guid = {f06097e3-9d7a-47de-bb2b-2e5e92754524}

And the link itself would be like this:

http://Contoso/TestOrg/CRMReports/viewer/drillopen.aspx?LogicalName=lead&ID=%7bf06097e3-9d7a-47de-bb2b-2e5e92754524%7d

Instead of LogicalName parameter you can use OTC which is Entity Type Code.

See system entity type codes here: http://msdn.microsoft.com/en-us/library/bb887791.aspx

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top