Setting a default value on a lookup field in Microsoft Dynamics CRM 4.0 October 27, 2009
Posted by jarrettexpertcrm in Microsoft CRM General.Tags: crm, crm tips, Dynamics Four, Dynamics4, jscript, look up fields, Microsoft, microsoft crm, Microsoft CRM 4.0
8 comments
I got a request to set the “Unit” on an Opportunity Product to always default to “Primary unit” when a product is created. Setting default values on lookup fields seems to be a common request, so i decided to post the code to achieve this. This is an Onload Event.
//Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
//Create an Object add to the array.
var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = ‘{299F37C4-6D9D-4628-ADF9-9479A6F209BA}’;
lookupItem.typename = ‘uom’;
lookupItem.name = ‘Primary Unit’;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.uomid.DataValue = lookupData;
If you want to use this code for other lookups, here is what you need to change:
//Create an array to set as the DataValue for the lookup control.
var lookupData = new Array();
//Create an Object add to the array.
var lookupItem= new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = ‘{Fields Guid}’;
lookupItem.typename = ‘Entity Name’;
lookupItem.name = Lookup Value;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.FieldName.DataValue = lookupData;
Enjoy!!
For more information about Dynamics Four you can contact us at http://www.dynamics4.com
Hiding multiple tabs based on picklist value in Microsoft CRM 4.0 October 5, 2009
Posted by jarrettexpertcrm in Microsoft CRM General.Tags: crm, crm tips, Dynamics Four, Dynamics4, hiding tabs, hiding tabs at runtime, jscript, Microsoft, microsoft crm, Microsoft CRM 4.0
add a comment
Being able to hide tabs until a certain value is selected in a picklist is becoming a common request. So i decided to post how you can accomplish that. Apply this code on the onload and onchane events (replace with your field names).
if
(crmForm.all.new_fieldname.DataValue == 1)
{
crmForm.all.tab1Tab.style.display = ‘none’;
crmForm.all.tab2Tab.style.display = ‘none’;
crmForm.all.tab3Tab.style.display = ‘inline’;
crmForm.all.tab4Tab.style.display = ‘inline’;
crmForm.all.tab5Tab.style.display = ‘none’;
crmForm.all.tab6Tab.style.display = ‘none’;
crmForm.all.tab7Tab.style.display = ‘none’
}
else if
(crmForm.all.new_fieldname.DataValue == 2)
{
crmForm.all.tab1Tab.style.display = ‘none’;
crmForm.all.tab2Tab.style.display = ‘none’;
crmForm.all.tab3Tab.style.display = ‘inline’;
crmForm.all.tab4Tab.style.display = ‘none’;
crmForm.all.tab5Tab.style.display = ‘inline’;
crmForm.all.tab6Tab.style.display = ‘none’;
crmForm.all.tab7Tab.style.display = ‘none’
}
else if
(crmForm.all.new_fieldname.DataValue == 3)
{
crmForm.all.tab1Tab.style.display = ‘none’;
crmForm.all.tab2Tab.style.display = ‘none’;
crmForm.all.tab3Tab.style.display = ‘inline’;
crmForm.all.tab4Tab.style.display = ‘none’;
crmForm.all.tab5Tab.style.display = ‘none’;
crmForm.all.tab6Tab.style.display = ‘inline’;
crmForm.all.tab7Tab.style.display = ‘none’
}
else if
(crmForm.all.new_fieldname.DataValue == 4)
{
crmForm.all.tab1Tab.style.display = ‘none’;
crmForm.all.tab2Tab.style.display = ‘none’;
crmForm.all.tab3Tab.style.display = ‘inline’;
crmForm.all.tab4Tab.style.display = ‘none’;
crmForm.all.tab5Tab.style.display = ‘none’;
crmForm.all.tab6Tab.style.display = ‘inline’;
crmForm.all.tab7Tab.style.display = ‘none’
}
For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com
Microsoft CRM 4.0 in Firefox August 15, 2009
Posted by jarrettexpertcrm in Microsoft CRM General.Tags: crm, crm tips, Dynamics Four, Dynamics4, firefox, firefox and crm, Microsoft, microsoft crm, Microsoft CRM 4.0
add a comment
For those Microsoft CRM users that prefer using Firefox as your browser, this post is for you. First you need to install the IE tab add- on https://addons.mozilla.org/en-US/firefox/addon/1419.
Once the install is done you will be prompted to restart Firefox. Once restarted go to your CRM site and right click on screen and select “view page in IE tab” and thats it!
For more information about Dynamics Four or to contact us please visit http://dynamics4.com
Showing records when offline in Microsoft CRM 4.0 Outlook Client August 4, 2009
Posted by jarrettexpertcrm in Microsoft CRM General.Tags: crm, crm tips, Dynamics Four, Dynamics4, Microsoft, microsoft crm, Microsoft CRM 4.0, Outlook Client. Offline sync
add a comment
Ever wonder why when going offline with the Microsoft CRM 4.0 Outlook Client you can only see records that you own? I made a video and and put it on youtube, Hopefully this video will shed some light.
For information about Dynamics Four or to contact us please visit http://dynamics4.com
Microsoft’s President’s award for Dynamics Four! July 14, 2009
Posted by jarrettexpertcrm in Microsoft CRM General.Tags: crm, Dynamics Four, Dynamics4, Microsoft, microsoft crm, Microsoft CRM 4.0, Microsoft's President's Award
add a comment
I am proud to say that some of my colleagues are in New Orleans to accept the President’s Award on behalf of Dynamics Four.
For more information about Dynamics Four or to contact us please visit www.dynamics4.com