Dynamics CRM 4.0 - Restricted Bulk Edit of Attributes

,
Hi,


I was trying to bulk edit a number of attributes today on the contact form but for some reason, MS Dynamics CRM 4.0 would not let me. After some research I discovered that you cannot perform bulk edits of a field that has an active OnChange event.


To get around this, simply disable the event (un-tick the box), save and publish, make your changes and the re-enable the event


Handy!

Dynamics CRM 4.0 - Display field dependant on Picklist values

,
Hi,

In the below example, i had a list of 5 values stored in a field as a picklist. When values 1 and 2 were chosen i wanted to hide the field, and display it when values 3,4 and 5 are selected. If you only have a single value to hide the field, then simple remove the "if else" part of the code below...


if(crmForm.all.cit_phonestatus.DataValue == 1)
{
    crmForm.all.cit_dateret.disabled = true; // to disable

    // to hide
    crmForm.all.cit_dateret.style.display = "none";
    crmForm.all.cit_dateret_c.style.display = "none"; // for label
}
else if(crmForm.all.cit_phonestatus.DataValue == 2)
{
    crmForm.all.cit_dateret.disabled = true; // to disable

    // to hide
    crmForm.all.cit_dateret.style.display = "none";
    crmForm.all.cit_dateret_c.style.display = "none"; // for label
}

else {

crmForm.all.cit_dateret.disabled = false;
    crmForm.all.cit_dateret.style.display = "";
    crmForm.all.cit_dateret_c.style.display = "";
}

Dynamics CRM 4.0 - Open a new browser window and go to address

,
I realise that there are a number of ways you can do this but i have found this a handy pieces of JS to have. 

function load() {
var load = window.open('
http://www.domain.com','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

Dynamics CRM 4.0 - Force a Save Event in JavaScript

,
The below is JavaScript for forcing a Save event on forms with Dynamics CRM 4.0. I used this when I had an onChange event that required me to save before other onChange events would work correctly. I inserted this as the last line of my function and it works a treat! (For full instructions please go to http://blog.xrmconsultant.com)


crmform.save();


Simplest ones are the best!


Regards


xRM Consultant

Dynamics CRM 4.0 - Show/Hide Left Menu Navigation Options

,
The below code is for Showing/Hiding Navigation menu items on the left hand side of any forms within Dynamics CRM 4.0. The code below includes setting up a Navigation Options tab to allow you to select which items to show and a control attribute on another tab to show or hide the desired tab (For full instructions Download Full Document)


Post into the OnLoad & OnSave events of the form you wish to effect:




//Hide Or Show Display Options Tab. Note: the tab number is dependent on tab you wish to hid
If (crmForm.all.new_showhidenavtab.DataValue == false)
{
//hide the second tab
crmForm.all.tab5Tab.style.display = "none";
}
else {
//show the second tab
crmForm.all.tab5Tab.style.display = "";
}
//Hide or Show Left Navigation Items
if (crmForm.all.new_moreaddressesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAddresses").style.display = "none";
}
else {
//show the second tab
document.getElementById("navAddresses").style.display = "";

}
if (crmForm.all.new_activitiesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivities").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivities").style.display = "";
}
if (crmForm.all.new_historynavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivityHistory").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivityHistory").style.display = "";
}
if (crmForm.all.new_subaccountsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navSubAct").style.display = "none";
}
else {
//show the second tab
document.getElementById("navSubAct").style.display = "";
}
if (crmForm.all.new_contactsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navContacts").style.display = "none";
}
else {
//show the second tab
document.getElementById("navContacts").style.display = "";
}
if (crmForm.all.new_relationshipsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navRelationships").style.display = "none";
}
else {
//show the second tab
document.getElementById("navRelationships").style.display = "";
}
if (crmForm.all.new_workflowsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAsyncOperations").style.display = "none";
}
else {
//show the second tab
document.getElementById("navAsyncOperations").style.display = "";
}


Post into the OnChange events of the attributes:





Show/hidenavtab
//Hide Or Show Display Options Tab. Note: the tab number is dependent on tab you wish to hide
if (crmForm.all.new_showhidenavtab.DataValue == false)
{
//hide the second tab
crmForm.all.tab5Tab.style.display = "none";
}

else {
//show the second tab
crmForm.all.tab5Tab.style.display = "";
}

Moreaddressesnavoption
if (crmForm.all.new_moreaddressesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAddresses").style.display = "none";
}

else {
//show the second tab
document.getElementById("navAddresses").style.display = "";
}

Activitiesnavoption
if (crmForm.all.new_activitiesnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivities").style.display = "none";
}
else {
//show the second tab
document.getElementById("navActivities").style.display = "";
}
Historynavoption
if (crmForm.all.new_historynavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navActivityHistory").style.display = "none";
}

else {
//show the second tab
document.getElementById("navActivityHistory").style.display = "";
}

Sub-Accountsnavoption
if (crmForm.all.new_subaccountsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navSubAct").style.display = "none";
}

else {
//show the second tab
document.getElementById("navSubAct").style.display = "";
}

Contactsnavoption
if (crmForm.all.new_contactsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navContacts").style.display = "none";
}

else {
//show the second tab
document.getElementById("navContacts").style.display = "";
}

Relationshipsnavoption
if (crmForm.all.new_relationshipsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navRelationships").style.display = "none";
}

else {
//show the second tab
document.getElementById("navRelationships").style.display = "";
}

Workflowsnavoption
if (crmForm.all.new_workflowsnavoption.DataValue == false)
{
//hide the second tab
document.getElementById("navAsyncOperations").style.display = "none";
}

else {
//show the second tab
document.getElementById("navAsyncOperations").style.display = "";
}


Dynamics CRM 4.0 - Hide or Show Tab On Record

,
The below code is for Showing/Hiding Tabs on forms within Dynamics CRM 4.0. The code below allows you to have a control attribute on another tab to show or hide the desired tab (For full instructions on setting this up, please go to http://blog.xrmconsultant.com)

//Hide Or Show Display Options Tab
if (crmForm.all."nameofyourattributetocontrolshow/hidetab".DataValue == false)
{
//hide the second tab
crmForm.all.tab4Tab.style.display = "none";
}

else {
//show the second tab
crmForm.all.tab4Tab.style.display = "";