MS Dynamics CRM (2013/2015/2016/D365)- Filtering a lookup(Customer) field

In the scenario, when customer field is being used in the form and later need to make changes to show either Account/ Contact in the lookup, you can write below script to filter. Please find detailed information about addPreSearch and addCustomFiler here

Place below line of code under the onLoad script.

 

Xrm.Page.getControl(“parentcustomerid”).addPreSearch(addFilter);

 

function addFilter() {

fetchQuery = “<filter type=’and’><condition attribute=’accountid’ operator=’null’ /></filter>”;

Xrm.Page.getControl(“parentcustomerid”).addCustomFilter(fetchQuery, ‘account’);

}

 

Similarly, to hide contacts, use the script below

function addFilter() {

fetchQuery = “<filter type=’and’><condition attribute=’contactid’ operator=’null’ /></filter>”;

Xrm.Page.getControl(“parentcustomerid”).addCustomFilter(fetchQuery, ‘contact’);

}

I hope this helps.

 

 

SSRS – Remove numbers or Text from a Field

I am very new to SSRS and there was a need to remove numbers from the value coming from DB. I found this quick way to write an expression to remove numbers or Text from a field in SSRS. Hope it would be useful to a newbie 🙂

System.Text.RegularExpressions.Regex.Replace(FieldValue,RegExPattern, ValueToReplace)

=System.Text.RegularExpressions.Regex.Replace(IIF(IsNothing(Fields!FieldName.Value), “”, Fields!FieldName.Value),  “[0-9]”, “”)

In a similar way to remove text from the string and to show only the numbers, here is the formula –

=System.Text.RegularExpressions.Regex.Replace(IIF(IsNothing(Fields!FieldName.Value), “”, Fields!FieldName.Value), “[^0-9]”, “”)