Images

,





Resize Form & Hide Left Navigation Area of CRM Form

,

Hi,

As much as I like the look and feel of CRM when you are developing a true xRM solution for a client, as we all know, less can be more.

With this in mind, whilst developing a solution for a client recently, I wanted to hide the entire left-hand navigation menu to give my form a simpler feel to it. So when setting it up I used 2 handy little pieces of JavaScript.

The first resized the window, OnLoad, to the size I wanted for my form:

window.resizeTo(700,520);

This gave me the following OnLoad:

78

As you can see though, most of the screen is taken up with the Left Navigation are, which for this form I didn't need.  So, i hid it using the following code:

document.all.crmNavBar.parentElement.style.display = "none";
document.all.tdAreas.colSpan = 2;

Which game me the following results….

77

As I said, nice simple JavaScript but I think it makes a huge difference to the appearance of the form and therefore (hopefully) how well the user interacts with it.

Enjoy!

Joel

Set CRM Form To Full Screen

,

Hi,

Quick but useful piece of JavaScript for you. Put this in the OnLoad event of any CRM form and it will maximise the window to fill your current screen size. Handy eh?!

window.moveTo(0,0);

window.resizeTo(screen.availWidth, screen.availHeight);

Enjoy!

Joel

test

,

Dynamics CRM 4.0 - Filtered Lookups From Picklist Value

,
Howdy, 


The below script is for doing filtered lookups based on a picklist value - nice piece of script!


document.FilterLookup = function(source, target)
{
    if (IsNull(source) || IsNull(target)) { return; }
    var name = IsNull(source.DataValue) ? '' : source.SelectedText;
name=encodeURIComponent(name);
    target.additionalparams = 'search=' + name;
}
document.FilterLookup(crmForm.all.yourpicklistfieldname, crmForm.all.yourlookupfieldname);



Paste the following into the OnChange event of the Picklist:

document.FilterLookup(crmForm.all.yourpicklistfieldname, crmForm.all.yourlookupfieldname);


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 = "";