This project is read-only.

Send Email Body to field other than 'description'

Feb 20, 2009 at 11:56 PM
Hi, I am pretty new to CRM. We were previously using workflows to create cases from emails but decided this is much more effective. Thanks for your hard work!

Previously, in order to have all the email body come across to the case, I created a new ntext field on the case form and had an onload script running that stripped the html tags etc. Ideally we would still like to ensure the full email body comes across to the case when using queue manager. To send the body across to the new field would it be as simple as updating the following using the new field name (new_emailcasebody) rather than description? Cheers

'Should the description be updated?
        If QueueSettings.UpdateCaseDescription Then
            'A lame attempt to remove html formatting and preserve some air in the text...
            Dim objDesc As New StringProperty
            objDesc.Name = "description"
            objDesc.Value = _objCRM.CleanHTML(objEMail.description)

            'Limit length
            objAtt = _objCRM.GetAttribute(EntityName.incident.ToString, "description")

            If objDesc.Value.Length > CType(objAtt, CRMMeta.MemoAttributeMetadata).MaxLength.Value - 1 Then
                objDesc.Value = objDesc.Value.Substring(0, CType(objAtt, CRMMeta.MemoAttributeMetadata).MaxLength.Value - 1)
            End If

            objProperties.Add(objDesc)
        End If
Coordinator
Feb 21, 2009 at 10:57 PM

Hi,

That's correct, just change "description" to whatever you want. Or if you don't want to modify the app, simply add a create workflow that will move the content of description to your own attribute.

Feb 22, 2009 at 10:51 PM
Hi, Sorry another Q,

If I was to do via workflow rather than change the code, would the message body still be truncated according to your code, as it is still looking at the description field? If I was to change the code, would this be correct? Thanks for your help.

'Should the description be updated?
        If QueueSettings.UpdateCaseDescription Then
            'A lame attempt to remove html formatting and preserve some air in the text...
            Dim objDesc As New StringProperty
            objDesc.Name = "new_emailcasebody"
            objDesc.Value = _objCRM.CleanHTML(objEMail.description)

            'Limit length
            objAtt = _objCRM.GetAttribute(EntityName.incident.ToString, "new_emailcasebody")

            If objDesc.Value.Length > CType(objAtt, CRMMeta.MemoAttributeMetadata).MaxLength.Value - 1 Then
                objDesc.Value = objDesc.Value.Substring(0, CType(objAtt, CRMMeta.MemoAttributeMetadata).MaxLength.Value - 1)
            End If

            objProperties.Add(objDesc)
        End If
Coordinator
Feb 23, 2009 at 8:12 AM
We have to truncate it according to the metadata (GetAttribute) max length otherwise it would cause an exception. This is true for custom attributes as well so your code should work. Otherwise simply copy the content from description to new_emailcasebody using a workflow.