Search

Friday, February 12, 2010

Connect to CRM Web Service without impersonation

Today I'm doing CRM deployment to another server/organization. I get "The request failed HTTP status 401: Unauthorized"

I scratched my head about 2 hours. Double confirmed x 100 times on my CRM service account's access, permission. There are all fine and nothing wrong with that.

Finally, I found a very intersting KB from Microsoft.
http://support.microsoft.com/kb/948746

Wohh, now I only know the root cause.
"To work around this problem, use Deployment Manager to change the name of the organization so that the display name of the organization does not contain blank spaces."

Alternatively, I found out that, without changing in Deployment Manager, we can remove the blank space of organization name when calling the CRM Web Service. (eg, My Org to MyOrg).

Wednesday, February 10, 2010

Microsoft’s Product Logo

Microsoft provided official product logo download for us.

Check this out.

http://www.microsoft.com/Presspass/gallery/ms-logos.mspx?FINISH=YES

createdon vs overriddencreatedon

When we create a record in CRM, the created on field always points at the date the record is created. Of course we could go into the database and update the date by using a SQL script. But then again, “it's not supported".

And what we found from CRM SDK. createdon is a Read-only field and can’t be updated and created.

Platform required : No
Application requirement level : Read-only
Valid for create : No
Valid for retrieve : Yes
Valid for update : No

After googled it around, I found a something interesting…


In CRM 4.0, the CRM development team has silently introduced a new feature – overriddencreatedon field. While creating a record, we can set the attribute overriddencreatedon field. The value of this field will be used to set the record's created on attribute.

account agent = new account();
 
agent.new_agentname = "pq";
agent.overriddencreatedon = CreateCrmDateTime(new DateTime(2004, 10, 19));
 
services.Create(agent);

















A small feature makes big differences.

CRM 4.0 Get the FetchXML queries in Advanced Find

You can just open the Advanced find page and build the query as you like. Then run the query to see if it returns the data as you wish it should. Press F11 to get the address bar and enter this script and press enter.

javascript:alert(resultRender.FetchXml.value);

or

javascript:prompt("my query:", resultRender.FetchXml.value);

Friday, February 5, 2010

Reindex an entire database

The following query is to reindex an entire database.

EXEC [sp_MSforeachtable] @command1="DBCC DBREINDEX('?')"

If you want to receive progress messages while it is running, try this version

EXEC [sp_MSforeachtable] @command1="RAISERROR('DBCC DBREINDEX(''?'') ...',10,1)
WITH NOWAIT DBCC DBREINDEX('?')"

Click here for reference.

Wednesday, February 3, 2010

Display Report in IFrame

Recently I read a blog on displaying SSRS report in IFrame of CRM entities. Now, I'm going to share with the workaround..

For this example, we created a custom report that takes in the Account Id as a parameter and displays the report.

  1. To add report in report manager, go to report manager URL and upload the report file .*rdl.
  2. After that, to find the report URL, go to report server and right click on report's properties to copy the URL.
  3. Add a IFrame in Account entity and URL of the IFrame, enter ‘about:blank’.
  4. We will now add logic in the form OnLoad event that will create the report URL and append the Account Id for the report to use to display the report.
  5. Add the following codes in OnLoad.
    var guid = crmForm.ObjectId;
    
    var url = 'http://tbe/ReportServer?%2fTesting_AddReportIntoIFrame&rs:Command=Render&rs:Format=HTML4.0&rc:Toolbar=false&rc:Parameters=false&rc:Parameters=false&AccountId=' + guid;
    
    document.getElementById('IFRAME_Testing').src = url;
    
    
  6. Now save and close the form and publish the entity.
  7. Navigate to an account and you should see the new tab and report render in the IFrame.
Notes:
  • Since we want the report in an IFrame, we do not want the report viewer toolbar and parameters to show. Hence the ‘rc:Toolbar=false&rc:Parameters=false”. Since we want the report to render in HTML 4.0, we can specify the format to render the report in by specifying ‘rs:Format=HTML4.0’.