Wednesday, February 5, 2014

Set up permission level to run JQUERY from webpart

If you plan to use webpart with Jquery u have to use Contribute permissions. If less privileged permissions are used, no information will be displayed.

I discovered that there is no need for whole Contribute permissions level. There is one permission responsible for this - Update Personal Web Parts - Update Web Parts to display personalized information. 

So we can create new permission level (make a copy of Read level) and add this permission.

Monday, March 25, 2013

Query CRM 2011 data with JSON synchronously

After we installed CRM update rollup 12 (KB 2795627), we encountered very big problems with our customizations relating to SOAP queries that were across multiple entities. CRM rollup 12 (finally) introduces us with additional browser compatibility for Firefox, Chrome, and Safari.

After rollup our customizations that were using SOAP requests didn't work anymore on Chrome, Firefox and Internet Explorer 10. We discovered that SOAP requests uses ActiveXobject and this is not supported!!!

To rebuild our customizations we used synchronous JSON queries, that solved our problems and even made our crm customizations better and whole scripting technique lighter.

This excellent article  Read records synchronously using JSON in CRM 2011 helped us to build our JSON queries like this:

Example function for retrieving current user full name

function getUserFullName() {

var userid = Xrm.Page.context.getUserId();

var retrieveRecordsReq = new XMLHttpRequest();
  var ODataPath = "/xrmservices/2011/OrganizationData.svc/SystemUserSet?$select=FullName&$filter=SystemUserId eq guid'" + userid + "'";'GET', ODataPath, false);
retrieveRecordsReq.setRequestHeader("Accept", "application/json");
retrieveRecordsReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");

var records = JSON.parse(retrieveRecordsReq.responseText).d;
var FullName = records.results[0].FullName;
return FullName;


Monday, December 3, 2012

An internal database error occurred in the Business Data Connectivity Shared service (BDC)

Firstly i want to say that i run across on this error not quite (as i thought) relating to BDC.. but:

My initial goal was simple - create some custom list in SP2010 with Lookup (information already on this site) fields. When i tried to do that i got following message:

So.. BDC service is related with creating Lookup type fields in SharePoint. Time ago we moved our SharePoint databases to new SQL server, but we didn't move our BDC db.. so i started to realize where is the problem. I have to create new BDC service application with new db in our new sql server + delete old BDC application (relationships), point my web application to new BDC service application.

I looked in SP Central Adminstration page for Service Applications (Application management -> Manage Service Applications).

1. Deleted old BDC application.
2. Created new BDC.
3. Point web application to new BDC (Application management -> Service Applications -> Service Application Associations)

But unfortuneatlly when i tried to create Lookup field i got new error saying:
Entity (External Content Type) cannot be found with Namespace = '', Name = 'New external content Type'


Previously i had some (With old BDC application) External Lists with custom external content types in them, so when we are creating Lookup fields, SharePoitn is looking for those content types and they didn't exist any more, so i DELETED THOSE OLD EXTERNAL LISTS.

Friday, October 12, 2012

This item is no longer available. It may have been deleted by another user

There are many articles about this SharePoint error message: "This item is no longer available. It may have been deleted by another user"

Mike Smith's Tech Training Notes and

These solutions didn't work for me!

Thursday, August 30, 2012

SCSM Creating Manual Activity for Incident in C#

Some time ago I had to develope application that could connect two systems: Microsoft Dynamics CRM & SCSM (Microsoft System Center Service Manager). The main purpose of this application is to synchronize data between two applications.

In this article i will show you only some little part (but maybe one of the  toughest for me...) of my application code.
I will continue to post some other usefull parts from this project. 

The code consists of 3 main steps:

1. Create relationship between incident & manual activity
2. Create manual activity
3. Assign created activity to incident

There is good post about creating incident in SCSM which really helped me out:

//Create relationship between incident & manual acticvity
ManagementPackRelationship workItemContainsActivityRelationship =
mg.EntityTypes.GetRelationshipClass(new Guid("2DA498BE-0485-B2B2-D520-6EBD1698E61B"));
CreatableEnterpriseManagementRelationshipObject AssignedToIncident = 

new CreatableEnterpriseManagementRelationshipObject(mg, workItemContainsActivityRelationship);

//Create Manual Activity
CreatableEnterpriseManagementObject activityItemObject = 

new CreatableEnterpriseManagementObject(mg, classManualActivity);
Guid newActivityGuid = Guid.NewGuid();
activityItemObject[classManualActivity, "Id"].Value = newActivityGuid.ToString();                                              
activityItemObject[classManualActivity, "Title"].Value = "<Title>";
activityItemObject[classManualActivity, "Description"].Value = "<Description>";

EnterpriseManagementObjectGenericCriteria genericCr = 

new EnterpriseManagementObjectGenericCriteria("Id == '" + <SCSM Incident Id>.ToString() + "'");
IObjectReader<EnterpriseManagementObject> reader = mg.EntityObjects.GetObjectReader<EnterpriseManagementObject>(genericCr, ObjectQueryOptions.Default);

 if (reader != null && reader.Count > 0) {
foreach (EnterpriseManagementObject obj in reader) {


IncrementalDiscoveryData dd = new IncrementalDiscoveryData();

//Assign Manual Activity to Incident