Archive for the ‘MSCRM - Development’ Category

MSCRM 4 icons

Thursday, November 12th, 2009

Ever need to link to the MSCRM icon?  The icons are all stored in the _imgs folder off the main crm directory (note you should not include the organization name in the url).  The name for the 16 by 16 icons are ico_16_{0}.gif  where {0} is the Entity Type.  I have not added custom icon so I am not sure if they follow the same format.  Also note there are ico_18_{0}.gif and ico_lrg_{0}.gif

Entity Type Codes:

Entity name Value
None 0
Account 1
AccountLeads 16
ActivityMimeAttachment 1001
ActivityParty 135
ActivityPartyRollupByAccount 4603
ActivityPartyRollupByContact 4604
ActivityPointer 4200
Annotation 5
AnnualFiscalCalendar 2000
Appointment 4201
AsyncOperation 4700
AttributeMap 4601
BulkOperation 4406
BulkOperationLog 4405
BusinessUnit 10
BusinessUnitMap 6
BusinessUnitNewsArticle 132
Calendar 4003
CalendarRule 4004
Campaign 4400
CampaignActivity 4402
CampaignActivityItem 4404
CampaignItem 4403
CampaignResponse 4401
ColumnMapping 4417
Commitment 4215
Competitor 123
CompetitorAddress 1004
CompetitorProduct 1006
CompetitorSalesLiterature 26
ConstraintBasedGroup 4007
Contact 2
ContactInvoices 17
ContactLeads 22
ContactOrders 19
ContactQueues 18
Contract 1010
ContractDetail 1011
ContractTemplate 2011
CustomerAddress 1071
CustomerOpportunityRole 4503
CustomerRelationship 4502
Discount 1013
DiscountType 1080
DocumentIndex 126
DuplicateRecord 4415
Email 4202
EntityMap 4600
Equipment 4000
Fax 4204
FilterTemplate 30
FixedMonthlyFiscalCalendar 2004
Import 4410
ImportFile 4412
ImportMap 4411
Incident 112
IncidentResolution 4206
IntegrationStatus 3000
InternalAddress 1003
Invoice 1090
InvoiceDetail 1091
KbArticle 127
KbArticleComment 1082
KbArticleTemplate 1016
Lead 4
LeadAddress 1017
LeadCompetitors 24
LeadProduct 27
Letter 4207
License 2027
List 4300
ListMember 4301
LookUpMapping 4419
MailMergeTemplate 9106
MonthlyFiscalCalendar 2003
Opportunity 3
OpportunityClose 4208
OpportunityCompetitors 25
OpportunityProduct 1083
OrderClose 4209
Organization 1019
OrganizationUI 1021
OwnerMapping 4420
PhoneCall 4210
PickListMapping 4418
PluginType 4602
PluginAssembly 4605
PriceLevel 1022
PrincipalObjectAccess 11
Privilege 1023
PrivilegeObjectTypeCodes 31
Product 1024
ProductAssociation 1025
ProductPriceLevel 1026
ProductSalesLiterature 21
ProductSubstitute 1028
QuarterlyFiscalCalendar 2002
Queue 2020
QueueItem 2029
Quote 1084
QuoteClose 4211
QuoteDetail 1085
RelationshipRole 4500
RelationshipRoleMap 4501
Resource 4002
ResourceGroup 4005
ResourceSpec 4006
Role 1036
RolePrivileges 12
RoleTemplate 1037
RoleTemplatePrivileges 28
DuplicateRule 4414
DuplicateRuleCondition 4416
SalesLiterature 1038
SalesLiteratureItem 1070
SalesOrder 1088
SalesOrderDetail 1089
SavedQuery 1039
SdkMessage 4606
SdkMessagePair 4613
SdkMessageRequest 4609
SdkMessageRequestField 4614
SdkMessageRequestInput 4612
SdkMessageResponse 4610
SdkMessageResponseField 4611
SdkMessageFilter 4607
SdkMessageProcessingStep 4608
SdkMessageProcessingStepImage 4615
SemiAnnualFiscalCalendar 2001
Service 4001
ServiceAppointment 4214
ServiceContractContacts 20
Site 4009
StatusMap 1075
StringMap 1043
Subject 129
Subscription 29
SubscriptionClients 1072
SubscriptionSyncInfo 33
SystemUser 8
SystemUserLicenses 13
SystemUserPrincipals 14
SystemUserRoles 15
Task 4212
Team 9
TeamMembership 23
Template 2010
Territory 2013
TransformationMapping 4426
TransformationParameterMapping 4427
UnresolvedAddress 2012
UoM 1055
UoMSchedule 1056
UserFiscalCalendar 1086
UserQuery 4230
UserSettings 150
WorkflowCompletedScope 4701
WorkflowWaitSubscription 4702
Workflow 4703
WorkflowDependency 4704

Creating A Following Associated Grid

Thursday, November 5th, 2009

Here is an example of how to create a follwing associated gird on a entity form. The idea here is to put two embedded grids on the form and relate one to the other. An embedded grid is an associated grid embedded in an iFrame. This is great is a great way to see associated records without having to navigate to the associated view. To learn about embedded grids see Customer Effective Blog. The next step is to capture the “onselectionchange” event of the first grid and pass this id and type to the second grid. To learn about “onselectionchange” event see More CRM Grid Goodies: Detecting Click Event by Customer Effective Blog.

Here is how it is done.

First add a parent iFrame and a child iFrame to the form. These will hold the embedded grids, set the src to “about:blank”. Now will start adding code to the On_Load event of the form.

function GetFrameSource(tabSet)
{
if (crmForm.ObjectId != null)
{
var oId = crmForm.ObjectId;
var oType = crmForm.ObjectTypeCode;
var security = crmFormSubmit.crmFormSubmitSecurity.value;
return “areas.aspx?oId=” + oId + “&oType=” + oType + “&security=” + security + “&tabSet=” + tabSet;
}
else
return “about:blank”;
}
}

crmForm.all.IFRAME_parent.src = GetFrameSource(”new_new_maxexchangeserver_new_remoteaddressbo”);

The GetFrameSource function get the url for the current form for the set tabSet.

function GetFrameSourceID(oId, oType, tabSet)
{
if (crmForm.ObjectId != null)
{
var security = crmFormSubmit.crmFormSubmitSecurity.value;
return “areas.aspx?oId=” + oId + “&oType=” + oType + “&security=” + security + “&tabSet=” + tabSet;
}
else
{
return “about:blank”;
}
}

The GetFrameSourceID get the url for the parent grid row. You need to pass the id of the current entity in the grid as well as the typeid of the entity.

var bFired = false;
GridClick = function()
{
// check to see if this event has been fired already
if(bFired == false)
{
var frameDoc = document.getElementById(”IFRAME_parent”).contentWindow.document;
var crmGrid = frameDoc.all['crmGrid'];
var a = crmGrid.InnerGrid.SelectedRecords;
if (a.length > 0)
{
//Get the url to set for the child grid. Note we are always using the first selected value if more than one is selected.
crmForm.all.IFRAME_child.src = GetFrameSourceID(a[0][0],a[0][1],”new_new_remoteaddressbook_new_maxexchangepack”);
}
bFired = true;
}
else
{
// toggle our fired flag back
bFired = false;
}
}

The GridClick function will be called each time a row is selected.

AttachGridEvent = function()
{
if(crmForm.all.IFRAME_parent.readyState == “complete”)
{
var frameDoc = document.getElementById(”IFRAME_parent”).contentWindow.document;
frameDoc.all['crmGrid'].InnerGrid.attachEvent(”onselectionchange”, GridClick);
GridClick();
}
}
crmForm.all.IFRAME_parent.onreadystatechange = AttachGridEvent;

The AttachGridEvent attaches the GridClick event to the grid onselectionchange event. The challange here is we can not attach to the grid in the iFrame until the grid is loaded (readyState == “complete”). To do this we attach the GridClick event on the change of ready state and only add it if the readyState == “complete”.


© 2009-2012 iCRM Blog All Rights Reserved -- Copyright notice by Blog Copyright