The length of the ‘filteringattributes’ attribute of the ‘sdkmessageprocessingstep’ entity exceeded the maximum allowed length of ‘100’

 

While developing a plug-in for CRM 4.0 triggers can be set when the plug-in can be set off using the Plugin Registration Tool.

When too many triggers are selected the following error will occur.

Unhandled Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request.
Detail:

A validation error occurred. The length of the ‘filteringattributes’ attribute of the ‘sdkmessageprocessingstep’ entity exceeded the maximum allowed length of ‘100′.
Platform

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at PluginRegistrationTool.CrmSdk.CrmService.Create(BusinessEntity entity)
at PluginRegistrationTool.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
at PluginRegistrationTool.StepRegistrationForm.btnRegister_Click(Object sender, EventArgs e)

 

What is de filteringattribute attribute?

While registering a plugin trigger in the CRM database the [<OrganizatioName>_MSCRM].[SdkMessageProcessingStepBase] table is updated.
For every plugin step a record is created in this table.
One of the attributes in this table is

[FilteringAttributes] [nvarchar](256)
NULL

During the registration of the plugin step the MetadataSchema is checked and validated a.o. the MaxLength of this attribute.

SELECT Maxlength
FROM [<OrganizationName>_MSCRM].[MetadataSchema.Attribute]
wHERE name =’filteringattributes’

By default the result of this query will be ‘100’. Strange of course since the database will allow to insert nvarchar strings up to 256 characters.

A solution could be

Update [<OrganizationName>_MSCRM].[MetadataSchema.Attribute
SET Maxlength = 256
where name =’filteringattributes’

If the MaxLength is set to more then 256 a SQL Error may occur since data will be truncated.

Note: After an update IISReset /noforce is required.

Note: Above customization is unsupported and you must take precautionary measure to make sure to avoid any problem with CRM system.

Advertisements

Multiple SSL secured site on IIS7

Let’s say that you have

  • an IIS7 webserver running
  • Microsoft Dynamics CRM is running on your webserver
  • And there’s another site running on the same webserver.
  • And both site are internet facing and need to be SSL secured

IIS Management Console doesn’t give you the possibility to do that.
You used to do this in IIS6 using adsutil.vbs

cscript.exe adsutil.vbs set /w3svc/<replace with your site id>/SecureBindings “:443:www.domain1.com”

IIS7 support is now delivering this option:

C:\Windows\System32\inetsrv>appcmd set site /site.name:”<Replace with your site name>” /+bindings.[protocol=’https’,bindingInformation=’*:443:<replace with your url>’]

Good configin’

Copying Dynamics CRM form values to the clipboard

For multiple records MS CRM options like mail merge and Excel exports are mighty handy.
For single record data export the Clipboard is more the way to go.

If you need the name and address of a certain account or contact … you want that to be directly available… in your CTRL-V.
If you want to print using a label printer… perhaps.
Exporting it to Excel or starting the Mail Merge may be a bit much to do… you for one record.

Start using this option… an ISV button “Copy name and address to clipboard” executing a JavaScript copying certain values to the clipboard.

OnLoad

CopyToClipboard =

    function () {

        // Construct the string you want on the clipboard.

        var sClipBoard = crmForm.all.firstname.DataValue + ” ” + crmForm.all.lastname.DataValue + “\n” +

                       crmForm.all.address1_line1.DataValue + “\n” +

                       crmForm.all.address1_city.DataValue + “, ” + crmForm.all.address1_stateorprovince.DataValue + ” ” + crmForm.all.address1_postalcode.DataValue;

        // Use/Create a input area

        var oClipBoard = document.getElementById(“ClipBoard”);

        if (oClipBoard == null) {

           oClipBoard = document.createElement(“input”);

           oClipBoard.setAttribute(“id”, “ClipBoard”);

           oClipBoard.setAttribute(“type”, “hidden”);

            document.getElementById(“crmForm”).appendChild(oClipBoard);

            }

        // Put in the clipboard string

        oCopyArea.innerText = sClipBoard;

        // Now copy to the string clipboard

        var oCopyText = oCopyArea.createTextRange();

        oCopyText.execCommand(“Copy”);

        };

 

Make the function available as an ISV button:

 
 

        <Entity name=”contact” >

          <ToolBar>

            <Button JavaScript=” CopyToClipboard ();” Icon=”/_imgs/ico_16_132.gif” ValidForCreate=”1″ ValidForUpdate=”1″ AvailableOffline=”true”>

              <Titles>

                <Title LCID=”1033″ Text=” Copy name and address to clipboard ” />

              </Titles>

              <ToolTips>

                <ToolTip LCID=”1033″ Text=” Copy name and address to clipboard ” />

              </ToolTips>

            </Button>

          </ToolBar>

        </Entity>

How is this for a cool MS CRM 2011 feature explanation?

I love it when people make blog posts like these
http://blogs.msdn.com/b/crm/archive/2010/10/25/bing-maps-and-microsoft-dynamics-crm-online.aspx

Like this you can learn to use and understand MS CRM 2011 Solutions, Dashboard, JQuery, BingMaps, CRM Discovery Service, usage of REST services, Web Resources,.

Here’s the direct download link of the source code.

All I needed.

DateJS.js and MS CRM

My customer had a wish of calculating estimated revenue based on hour per week, amount per hour and calculated based on business days between start date and the end data.
There was a tiny little detail that caused some thinking… which was that the end data is most cases start date + 3 months… so I needed to calculate the end data.


Problem #1 was the calculation of business days between two dates.
This wasn’t too hard, since Google found me an answer that looked like this:

Solution #1

function calcBusinessDays(dDate1, dDate2) { // input given as Date objects

var iWeeks, iDateDiff, iAdjust = 0;

if (dDate2 < dDate1) return -1; // error code if dates transposed

var iWeekday1 = dDate1.getDay(); // day of week

var iWeekday2 = dDate2.getDay();

iWeekday1 = (iWeekday1 == 0) ? 7 : iWeekday1; // change Sunday from 0 to 7

iWeekday2 = (iWeekday2 == 0) ? 7 : iWeekday2;

if ((iWeekday1 > 5) && (iWeekday2 > 5)) iAdjust = 1; // adjustment if both days on weekend

iWeekday1 = (iWeekday1 > 5) ? 5 : iWeekday1; // only count weekdays

iWeekday2 = (iWeekday2 > 5) ? 5 : iWeekday2;

// calculate difference in weeks (1000mS * 60sec * 60min * 24hrs * 7 days = 604800000)

iWeeks = Math.floor((dDate2.getTime() – dDate1.getTime()) / 604800000)

if (iWeekday1 <= iWeekday2) {

iDateDiff = (iWeeks * 5) + (iWeekday2 – iWeekday1)

} else {

iDateDiff = ((iWeeks + 1) * 5) – (iWeekday1 – iWeekday2)

}

iDateDiff -= iAdjust // take into account both days on weekend

return (iDateDiff + 1); // add 1 because dates are inclusive

}

Problem #2 was the calculation of the end date.
Adding a month is not a function in standard JS… so I tried

Let’s say the start date was December 1st this year, which in CRM looks like this:

Wed Dec 1 10:27:00 UTC+0100 2010 [Object]

If I calculate my end date in the old school fashion JS:

New Date.setDate(startDate.getDate() + 90) 
My date will look like this 
"Wed Dec 1 10:27:00 UTC+0100 201090" [string] 
MS CRM will handle this string, when a field is set to this value. 
However de calcBusinessDays function required a Date Object and not a string. 

Solution #2

http://www.datejs.com/ is the solution here.

Add the Data.js to be loaded in the <CRM Install Folder>\_static\_common\scripts\global.js

document.write(‘<script language=”javascript” src=”\/_customJava\/customDate.js”><\/script>’)

The calculation then looks like this:

crmForm.all.new_expectedrevenue.DataValue = calcBusinessDays(crmForm.all.new_startdate.DataValue, crmForm.all.new_enddate.DataValue.add(3).month()) * crmForm.all.new_rateperhour.DataValue;

The date function in the DateJS library do return Date objects.

Other examples of the DataJS library are below… it’s a very powerful library.

// Get today’s date

Date.today();

// Add 5 days to today

Date.today().add(5).days();

// Get Friday of this week

Date.friday();

// Get March of this year

Date.march();

// Is today Friday?

Date.today().is().friday(); // true|false

// What day is it?

Date.today().getDayName();

// Get the first Monday of the year

Date.january().first().monday()

// Get the last Friday of the year

Date.dec().final().fri()

// Set a date to the 15th of the current month at 4:30 PM,

// then add 90 days and make sure that date is a weekday,

// else move to the next weekday.

var d1 = Date.today()

.set({ day: 15, hour: 16, minute: 30 })

.add({ days: 90 })

if (!d1.isWeekday()) {

d1.next().monday();

}

// Lets start simple. “Today”

Date.parse(‘today’);

// How about tomorrow?

Date.parse(‘tomorrow’);

// July 8?

Date.parse(‘July 8’);

// With a year?

Date.parse(‘July 8th, 2007’);

// And time?

Date.parse(‘July 8th, 2007, 10:30 PM’);

// Get the date, move to Monday (if not already Monday),

// then alert the date to the user in a different format.

var d1 = Date.parse(‘8-Jul-2007’);

if (!d1.is().monday()) {

d1.last().monday();

}

alert(d1.toString(‘dddd, MMMM d, yyyy’));


Hide “CRM for Outlook” button

We’ve been implementing MS CRM 4.0 on premise at a customer that uses Lotus Notes.
After installing roll-up 7 the CRM for Outlook button became available.
Since this customer doesn’t use MS Outlook, the request came to hide the CRM for Outlook button.

It’s pretty easy, once you know it.

  • On the Microsoft Dynamics CRM Application Server start RegEdit.
  • Locate the registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM.
  • Create a new DWORD (32-bit) Value by the name DisableOutlookSetupLink and set the value to 1 to disable the CRM for Outlook button for all users.