Sample Data for Grants Manager Accelerator


Hi,

I’ve recently started working on the Grants Manager Accelerator

http://grantsmanager.codeplex.com/

After deploying the solution from cloud to on-premise, i had to populate the on premise instance with some sample data.

For this i exported the data from online for most of the entities and converted them to csv.

I am just sharing all the csv files that i have used. (might be helpful)

https://nishantrana.me/wp-content/uploads/2012/01/grants-management-sample-data.doc

After downloading the file change the extension from .doc to .zip

Bye.

Cleared MB2-868 CRM 2011 Applications Exam


Hi,

I cleared the CRM 2011 Applications exam today. There were total 75 questions in it.

When compared to Customization exam this one was little easier as the Application part in CRM 2011 is more or less like CRM 4.0 only, apart from addition of few new features.

There were question around Marketing List (Static and Dynamic), Campaigns (and quick campaigns), Lead conversion, Service Scheduling etc. These official training materials should be more than sufficient

  • 80292A: Service Management in Microsoft Dynamics CRM 2011
  • 80293A: Service Scheduling in Microsoft Dynamics CRM 2011
  • 80290A: Marketing Automation in Microsoft Dynamics CRM 2011
  • 80291A: Sales Management in Microsoft Dynamics CRM 2011

Bye.

Using Deep Insert (creating multiple new records in the same operation) in Silverlight (CRM 2011)


Hi,

Sharing a basic example using which we can create Parent entity and the related entity records in the same operation\

http://msdn.microsoft.com/en-us/library/gg309638.aspx

Check out this helpful post

http://inogic.blogspot.com/2011/12/odata-properties-and-methods-explored.html


public MainPage()
 {
 InitializeComponent();
 }

GGContext context;

private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
 var orgServiceUrl = "http://servername/orgname/XRMServices/2011/OrganizationData.svc";

 // initialize the context
 context = new GGContext(new Uri(orgServiceUrl));

// using client http stack
 context.HttpStack = System.Data.Services.Client.HttpStack.ClientHttp;
 context.UseDefaultCredentials = false;
 context.Credentials = new NetworkCredential("administrator", "password", "domain");
 // create contact record
 Contact contact = new Contact();
 contact.LastName = "Rana";
 contact.FirstName = "Nisha";

 // create two tasks and one email activity
 var myTask1 = new Task();
 myTask1.Subject = "Task1 created at " + DateTime.Now.ToLongTimeString();
 var myTask2 = new Task();
 myTask2.Subject = "Task2 created at " + DateTime.Now.ToLongTimeString();
 var myEmail = new Email();
 myEmail.Subject = "Email created at " + DateTime.Now.ToLongTimeString();

// add the tasks and email to their respective set
 context.AddToTaskSet(myTask1);
 context.AddToTaskSet(myTask2);
 context.AddToEmailSet(myEmail);

// add contact to be created to the contact set
 context.AddToContactSet(contact);

// add the related records
 contact.Contact_Tasks.Add(myTask1);
 contact.Contact_Tasks.Add(myTask2);
 contact.Contact_Emails.Add(myEmail);

 // add the link
 // http://inogic.blogspot.com/2011/12/odata-properties-and-methods-explored.html
 context.AddLink(contact, "Contact_Tasks", myTask1);
 context.AddLink(contact, "Contact_Tasks", myTask2);
 context.AddLink(contact, "Contact_Emails", myEmail);

context.BeginSaveChanges(CreateContactHandler, contact);
 }
 private void CreateContactHandler(IAsyncResult result)
 {
 // in the call back method call the EndSaveChanges method
 // it returns DataServiceResponse object.
 // we can get the error information from this object in case an operation fails
 context.EndSaveChanges(result);
 // id of the created contact record
 Guid createdContactGuid = ((Contact)result.AsyncState).ContactId;
 }

Hope it helps

Sample code to parse JSON Date Format


Hi,

Just sharing a sample code to parse JSON Date Format (e.g. “\/Date(628318530718)\/”) to Date.


entity = JSON.parse(retrieveReq.responseText).d;

if (entity['BirthDate'] != null) {

var jdate = parseJsonDate(entity['BirthDate']);
 var year = jdate.getFullYear();
 var month = jdate.getMonth() + 1 < 10 ? '0' + (jdate.getMonth() + 1) : (jdate.getMonth() + 1);
 var date = jdate.getDate() < 10 ? '0' + jdate.getDate() : jdate.getDate();
 var dateString = month + '/' + date + '/' + year;

 alert(dateString);
 }

function parseJsonDate(jsonDate) {
 var offset = new Date().getTimezoneOffset() * 60000;
 var parts = /\/Date\((-?\d+)([+-]\d{2})?(\d{2})?.*/.exec(jsonDate);

if (parts[2] == undefined)
 parts[2] = 0;

if (parts[3] == undefined)
 parts[3] = 0;

return new Date(+parts[1] + offset + parts[2] * 3600000 + parts[3] * 60000);
 }

}

Bye.

Sample Code to Cancel All the Open Activities for a particular record in CRM 2011.


Hi,

Just sharing a sample code that could be used to cancel all the open activities for a particular record.

 private void CancelChildActivities(Guid entityRecordGuid, IOrganizationService service)
 {
 QueryExpression qe = new QueryExpression();
 qe.ColumnSet = new ColumnSet(new string[] { "activityid", "activitytypecode" });
 qe.EntityName = "activitypointer";

FilterExpression filterStateCode = new FilterExpression();
 filterStateCode.FilterOperator = LogicalOperator.Or;
 filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Open");
 filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Scheduled");

FilterExpression filter = new FilterExpression();
 filter.FilterOperator = LogicalOperator.And;
 filter.AddCondition("regardingobjectid", ConditionOperator.Equal, entityRecordGuid);
 filter.AddFilter(filterStateCode);

qe.Criteria = filter;

RetrieveMultipleRequest request = new RetrieveMultipleRequest();
 request.Query = qe;
 RetrieveMultipleResponse response = (RetrieveMultipleResponse)service.Execute(request);

foreach (Entity activity in response.EntityCollection.Entities)
 {
 CancelActivity(activity, service);
 }

}

 private void CancelActivity(Entity entity, IOrganizationService service)
 {
 EntityReference moniker = new EntityReference();

if (entity.LogicalName == "activitypointer")
 {
 if (entity.Attributes.Contains("activityid") & entity.Attributes.Contains("activitytypecode"))
 {
 moniker.LogicalName = entity.Attributes["activitytypecode"].ToString();
 moniker.Id = (Guid)entity.Attributes["activityid"];

SetStateRequest request = new SetStateRequest();
 request.EntityMoniker = moniker;
 request.State = new OptionSetValue(2);
 request.Status = new OptionSetValue(-1);
 SetStateResponse response = (SetStateResponse)service.Execute(request);
 }
 }

}

Bye.

Customization (Unsupported) of Lookup in CRM 2011.


Hi,

For disabling view button, disabling “look for” option or hiding Button in lookup we can make use of JavaScript.

We need to refer to our lookup through DOM in our onload event and set its attributes (unsupported).

Suppose our lookup id is customerid

document.getElementById(“customerid”).setAttribute(“disableViewPicker“, “1”);


document.getElementById(“customerid”).setAttribute(“disableQuickFind“, “1”); 


document.getElementById(“customerid”).setAttribute(“_lookupbrowse“, “1”); 

Hiding New Button

function myHideLookupButton()

{

crmForm.all.customerid.attachEvent(“setadditionalparams“,HideButton);

}

function HideButton()

{

crmForm.all.customerid.AddParam(“ShowNewButton“, 0);

}

Bye.