Pop a crm activity window from any entity

  • Digg
  • Facebook
  • LinkedIn
  • Twitter
 

This is not related to linq at all but we thought we’d share something we found along our dynamics crm journey…

We wanted to have couple of buttons on the toolbar to quickly pop activity windows for some custom entities. We decided to look at how ‘Send Email’ pops the window for the contact entity. With a bit of help from IE Dev Toolbar we found the following bit of code that did exactly what we wanted.

addActivityTo(activityTypeCode, currentRecordId, currentRecordTypeCode, currentRecordFriendlyDisplayName, toRecordId, toRecordTypeCode, toRecordFriendlyDisplayName, ”);
  • Activity type code – you can get a list from the crm sdk. (eg: 4202 is an email activity)
  • Current record id – crmForm.ObjectId
  • Current record type code – crmForm.ObjectTypeCode
  • Current record friendly display name – crmForm.all.attributename_of_your_choice
  • To record id – can be null
  • To record type code – only supports account (1), contact (2), lead, system user
  • to record friendly display name – crmForm.all.somelookup.DataValue[0].name

Example – used inside the isv.config file
Please note error checking has been removed for brevity

<ToolBar ValidForCreate="0" ValidForUpdate="1">
  <Button Icon="/_imgs/ico_18_xxxx.gif" PassParams="1"
          WinParams="height=xxx,width=xxx" WinMode="0" 
          JavaScript="addActivityTo(4202, crmForm.ObjectId, crmForm.ObjectTypeCode, 
                        crmForm.all.name.DataValue, 
                        crmForm.all.xl_contactid.DataValue[0].id, 
                        2, crmForm.all.xl_contactid.DataValue[0].name, 
                        '');">

We hope this will be useful to someone else out there

No Feedback

No feedback yet.

RSS feed for feedback on this post. TrackBack URI

Leave your feedback

© XrmLinq 2009.