24 Haziran 2012 Pazar

CRM 2011 ERD(Entity relationship diagrams) Designer

The CRM 2011 ERD Designer is a Silverlight 4 application that is packaged as a Managed CRM 2011 Solution. This tool allows you to build ERD (Entity relationship diagrams) that are dynamically updated based on the published CRM entities and Fields; you can create/edit/remove entities and fields from the ERD designer. The tool allows also printing the diagrams.
ERD.png
For download or more information visit the codeplex

MS CRM Multiple Attachment Download

Microsoft Dynamics CRM 4.0 currently does not have a built in way for CRM Administrators to Export multiple attachments from the database and store it on a local directory on the Server or the local PC. This application allows you to do so.

Screenshot
The following is a screenshot of the first version of this application:

CRM_Multiple_Attach_Download_App_2.jpg

for download or more information visit the codeplex

10 Haziran 2012 Pazar

Setting a user lookup with the current user with Javascript in MS CRM 2011

If you want to get current user id in MS CRM 2011 form you can use following script: Xrm.Page.context.getUserId()

For setting  a user lookup for logged in user use following script
function SetUserInfo() {
 var context;
 var serverUrl;
 var UserID;
 var ODataPath;
 context = Xrm.Page.context;
 serverUrl = context.getServerUrl();
 UserID = context.getUserId();
 ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
 var retrieveUserReq = new XMLHttpRequest();
 retrieveUserReq.open("GET", ODataPath + "/SystemUserSet(guid'" + UserID + "')", true);
 retrieveUserReq.setRequestHeader("Accept", "application/json");
 retrieveUserReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
 retrieveUserReq.onreadystatechange = function () {
 retrieveUserReqCallBack(this);
 };
 retrieveUserReq.send();

}

function retrieveUserReqCallBack(retrieveUserReq) {
if (retrieveUserReq.readyState == 4 /* complete */) {

if (retrieveUserReq.status == 200) {
 var retrievedUser = this.parent.JSON.parse(retrieveUserReq.responseText).d;
 if (retrievedUser.FullName != null)

var setUservalue = new Array();
 setUservalue[0] = new Object();
 setUservalue[0].id = Xrm.Page.context.getUserId();
 setUservalue[0].entityType = 'systemuser';
 setUservalue[0].name = retrievedUser.FullName;

Xrm.Page.getAttribute("from").setValue(setUservalue)
 }

else {

 }
 }
}

4 Haziran 2012 Pazartesi

MS CRM 2011 Canceling the Save operation

To stop the save event in Javascript s use the following javascript on save event of form.

function Form_onsave(executionObj)
{
    var shouldSave = true;

    if (shouldSave)
    {
        alert("You can not save!");

        executionObj.getEventArgs().preventDefault();
    }
}
 Note: The pass execution context as first parameter checkbox is very important to this process. Without it, it will not work.

3 Haziran 2012 Pazar

MS CRM 2011 & 4.0 How to set up a lookup using Javascript

Javascript for MS CRM 2011

var value = new Array();
value[0] = new Object();
value[0].id = id;
value[0].name = textvalue;
value[0].entityType = typevalue;
Xrm.Page.getAttribute("fieldname").setValue(value);


Javascript for MS CRM 4

var value = new Array();
value[0] = new Object();
value[0].id = id;
value[0].name = textvalue;
value[0].typename = typevalue;
crmForm.all.fieldname.DataValue = value;