An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.


We were getting the above error while testing one of our WCF service. On syncing the clock of our client and server machine we were able to resolve the issue.

This helped us resolve the issue

http://social.msdn.microsoft.com/Forums/eu/wcf/thread/eccf2b09-6ea1-4663-9ddf-af29901ea60a

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.

Filtered lookup for n:n relationship.


Hi,

Daniel Cai has recently posted about his solution for filtered lookup in case of n:n relationship in his blog.

It works like a charm.

Do check it out.

http://danielcai.blogspot.com/2011/12/filtered-lookup-for-existing-button-of.html

Bye.

Calling Organization.svc from JavaScript in CRM 2011.


Hi,

There is a SOAPLogger tool that ships with CRM 2011 SDK which can be used to capture HTTP request and response.

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

Using that tool we can write our code in C# and it captures the corresponding SOAP Request and Response for it in a file named Output.txt, which we can then use in our JavaScript.

Sample SetStateRequest code

Request


Response

I have simply modified the tool to output the JavaScript as well which we can then use in onload or onchange event in CRM.

JavaScript

Download

Hope it helps.

New features in CRM 2011


Hi,

Just sharing a link which i have found extremely helpful to know about new features in CRM 2011

http://www.dynamicsexchange.com/CRM-2011/New-in-CRM-2011.aspx

Bye.

 

 

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓