Thursday, April 26, 2012

CRM 2011: Changing Ownership of an Entity after the fact.

Hey Guys!
I've posted a blog post to my CRM 2011 specific blog about my experiences dealing with changing an entity from OrgOwned to UserOwned.
http://dynamics2011.blogspot.com/2012/04/crm-2011-changing-entity-from.html

Monday, April 9, 2012

CRM 2011: Utilizing Role Based Security to hide and show records

Here's a link to my CRM 2011 blog with an example of how to properly use role based security and team ownership to control data access:
http://dynamics2011.blogspot.com/2012/04/crm-2011-utilizing-role-based-security.html

Thursday, January 19, 2012

IFRAME not showing up on CRM 2011 form

So today I was tasked with removing required fields off a CRM form that also has an IFRAME and some ScriptableMember logic to tie the ribbon to the silverlight within the IFRAME.

To remove the section with the required field is simple enough. First you need to export an unmanaged solution and open up the customizations.xml. Locate the section node and remove as needed. Import back in and viola. Remember to keep a copy of your export file in case something goes wrong.

So once I got every field off the form except for the IFRAME, I saw that the IFRAME wasn't showing up. I checked the DOM and it did exist but the visibility was set to false. This seemed odd since all the checkboxes associated with the IFRAME and section were set to true.

I decided to try to add to the footer, modified by and when, but that didn't work either.

I also tried adding another IFRAME to no avail.

The solution lies in using the xrm elements in javascript. I'll post the javascript now but please keep reading because yet another bug came to light after this....

//the 0 will correspond with whatever tab you are working with....
Xrm.Page.ui.tabs.get(0).setVisible(true);


So this successfully shows the IFRAME with no other controls on the form. But once I did this I found out that the ribbon no longer functioned. After pulling all my hair out I ended up adding a crm created field in the same tab in a new section underneath and set that to invisible as well as its label. Once I did that everything worked flawlessly.

Happy Coding!

Wednesday, September 14, 2011

Link to my MS Dynamics CRM 2011 Blog:

Link to my MS Dynamics CRM 2011 Blog: http://dynamics2011.blogspot.com/

I haven't decided which one I will use going forth but until then check both for more CRM 4 and 2011 tips!

Thursday, June 3, 2010

Customer Portal Accelerator's Content Management

In this brief lesson I'll describe the basic setup of the content management role in the Customer Portal Accelerator. This lesson will focus on setting up a power user that can modify the look and feel of the website by simply logging into the portal.

First things first, read the Content Management Guide located within the documentation folder. This document is found in your install files you got from CodePlex.

Setting up a Power User:
To set up a power user, go to the Content Management tab located in the main bar on the left and navigate to Web Roles.

If the Customer Portal Administrators role does not exist, you'll need to create it. Just select New, name it Customer Portal Administrators and set it to your website.

Once this is done you'll add a Contact record to the role. This Contact needs to have already registered with the website.

Now login to the website with this Contact and you'll see the various Edit buttons and WYSIWYG areas.

Troubleshooting:
If you're not seeing any of the Edit buttons, you should verify two things:

1. Make sure your web.config has this node in it:
<location path="Services/Cms.svc">
<system.web>
<authorization>
<allow roles="Customer Portal Administrators"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
Notice this node has the Customer Portal Administrators role defined.
 
2. Make sure the server the website is hosted on has the WCF roles needed.
Verify:
.Net 3.0 is installed.
Windows Communication Foundation HTTP Activation is turned on.
Windows Communication Foundation Non-HTTP Activation is turned on.
 
Conclusion:
With this post you should now be able to hand off the design of the website to a webmaster or marketing user. To restrict their access simply remove them from the role and they will no longer be able to update.
My next post will deal with adding custom controls to the website to add another layer of functionality.
 
Happy Coding!

Tuesday, June 1, 2010

Installing Customer Portal Accelerator for Dynamics CRM 4.0

This post will focus on the Customer Portal Accelerator developed by CodePlex. According to CodePlex:
"The Customer Portal accelerator for Microsoft Dynamics CRM provides businesses the ability to deliver portal capabilities to their customers while tracking and managing these interactions in Microsoft Dynamics CRM"

I see this tool as a great way to set up meeting hubs (webinar, online tutorials, etc) and to utilize Web To Lead functionality. The Portal can use an internal login or Windows LiveID which is a big advancement over the eService Portal. The interface can be modified simply by logging in and selecting which section of the webpage to modify. All values are stored in the database and can be modified on the fly.

The meeting feature allows your organization to set up marketing lists that can be e-mailed a direct link to your event. However you can also host an open registration event for things like a webinar or open house. When the user registers CRM will store a response from the contact if they are in your system. If they aren't in your system, the Portal will create a Lead. All of this is tied back to the Windows LiveID. Once a user is logged in they can see various events your organization will host throughout the calendar year.

Installation:
The installation is quite simple and if you follow the documentation you shouldn't have a problem. I would suggest backing up the entities it wants to overwrite as well as your ISV Config and your sitemap. You will need a Windows LiveID to get the Application ID. I would recommend creating a LiveID for your company as this App ID will be linked directly to the LiveID.

Suggestions:
When installing you will need to manually create a website in IIS. Move the website provided into a new folder where you see fit (i.e. c:\inetpub\wwwroot\CustomerPortal).
I ran into issues with the WebsiteCopy.exe command line input.
Here's what I used:
websitecopy.exe /targetconnectionstring:"Authentication Type=AD; User ID=domain\username; Password=password; server=http://server:port/OrgName" /targetwebsitename:"Customer Portal" /sourcefile:"C:\Documents and Settings\Administrator\Desktop\CUSTOMER_PORTAL_RTW_R1\Installation\Customizations\customerportal.xml"

When I ran this for the server property I used localhost. This will register the site inside of CRM, NOT create the website in IIS.
The other issue I ran into was modifying the web.config.
<appSettings>
<add key="crm-site" value="Customer Portal"/> <!-- Make sure to change this to the name you used in IIS -->
<add key="Microsoft.Xrm.Portal.Web.CmsServiceBaseUri" value="/Services/Cms.svc"/>
</appSettings>
And for the connection strings:
<connectionStrings>
<add name="Xrm" connectionString="Authentication Type=AD; Server=http://localhost:port/orgname; User ID=domain\username; Password=Password; />
<add name="Live" connectionString="Application Id=FromLiveIDWebsite; Secret=FromLiveIDWebsite"/>
</connectionStrings>
Again this is ONLY FOR IFD. There is additional connection string advice located within the install documentation.
 
Once this is done you should be able to access your site and login using Windows LiveID credentials.
 
My next post will deal with modifying access for individuals including Webmasters, generic users and your marketing team.
 
Happy Coding!

Tuesday, May 25, 2010

Using SOAP to create a record in MS Dynamics CRM 4.0

I recently began creating a Windows Sidebar gadget that would interface with Dynamics CRM. The challenge with gadgets is that they only use HTML pages with scripting (you can redirect to a webpage outside of the gadget but that's another lesson). So to retrieve data the route I went with was SOAP.
SOAP allowed me the security I needed as well as a quick response.
If you're new to SOAP, the syntax is XML and here's a good link from W3Schools.

The purpose of this tutorial is to explain how to create a record in MS Dynamics using a SOAP XML message.

Here's the code:
var xml;


xml = "<?xml version='1.0' encoding='utf-8'?>" + "\n\n" + "<soap:Envelope" +
' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
'<soap:Header>' +
'<CrmAuthenticationToken xmlns="http://schemas.microsoft.com/crm/2007/WebServices">' +
'<AuthenticationType xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">0</AuthenticationType>' +
'<OrganizationName xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">OrganizationName</OrganizationName>' +
'<CallerId xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">00000000-0000-0000-0000-000000000000</CallerId>' +
'</CrmAuthenticationToken>' +
'</soap:Header>' +
'<soap:Body>' +
'<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>' +
"<CreateDuplicatesOptionalParameter><value>false</value></CreateDuplicatesOptionalParameter>" +
"<PersistInSyncOptionalParameter><value>false</value></PersistInSyncOptionalParameter>" +
"<entity xsi:type='work'>" +
"<workdescription>" + workText + "</workdescription>" +
"<hours>" + hours + "</hours>" +
"<minutes>" + minutes + "</minutes>" +
"<isbillable>" + billable + "</isbillable>" +
"<total>" + total + "</total>" +
'<accountidname>' + accountIdName + '</accountidname>' +
"<workdate>" + (currentDate.getMonth() + 1) + '/' + currentDate.getDate() + '/' + currentDate.getYear() + "</workdate>" +
"</entity>" +
"</Create>" +
'</soap:Body>' +
'</soap:Envelope>'
xmlhttp.open("POST", "http://localhost:5555/mscrmservices/2007/crmservice.asmx", false);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
xmlhttp.setRequestHeader("SOAPAction", http://schemas.microsoft.com/crm/2007/WebServices/Create);
xmlhttp.setRequestHeader("Content-Length", xml.length);
xmlhttp.send(xml)
var result = xmlhttp.responseXML.xml;


This XML, when properly executed will create a record of "Work" with a workdescription, hours, minutes, isbillable, total, accountidname and workdate. the var result will contain the guid of the newly created record.

Key things to look at:

'<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>'
This line has the keyword Create, notice the difference than a standard RetrieveMultiple you might have seen in the past. This tells the service to create a record. The child nodes are column names within the table. Remember to be sure to at least set the required fields.

xmlhttp.open("POST", "http://localhost:5555/mscrmservices/2007/crmservice.asmx", false);
This line needs to point toward your instance of Dynamics. Change the localhost to suit your needs, you do not need the Organization Name.

xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">OrganizationName</OrganizationName>'
This line needs the OrganizationName of your CRM instance. You can find that after the .com or port number.

Typical Problems:

The two main issues I ran into were a workflow firing off on creation of a record and not setting the correct business required fields. If you do NOT set the fields the service will attempt to create multiples and put in incorrect data. Remember to keep an eye on your table to check for duplicates.

Conclusion:

Once I got past the duplicate issue I found myself really enjoying the flexibility of using SOAP to create a record. Its pretty simple and handles security nicely.

Happy coding!