WebMasterSam

.Net, SEO, Dynamics CRM, AdSense/AdWords, Dating sites, Silverlight, Web hosting and more
PPC management, Online Marketing, Search Marketing, SEO, Website development - dotmedias.com

About me

I'm an IT consultant working primarily with the .Net Framework as a developper and architect. I also work on my own on my personnal dating websites. I've been developping websites since 2000.

If you like what I do, feel free to support me

PayPal - The safer, easier way to pay online!

Bookmark

Bookmark and Share

Sponsored links

Amazon hot deals

Computer releases

Last comments

None

Microsoft Dynamics CRM 4.0 tabSet list

As I explained in another article, when you want to retrieve to name of the entity displayed in a CRM page it's easy to check for the etc parameter and then translate the number to a name by calling the MetaData service. But, as I also said, when you check for the page "areas.aspx", you don't have the entity number of the related entity... instead you get a tabSet parameter. The tabSet contains either the relationship name or a tabSet name...

Because the same related entity can have multiple tabSet names, I decided to list everything I found to simplify the job for you (I all got those using Fiddler and clicking on every link of related entities in CRM...).

Area name Related entity name
areaActivities ActivityPointer
areaActivityHistory ActivityPointer
areaAsyncOperations WFProcess
areaRelationships CustomerRelationship
areaRelationship CustomerRelationship
areaContacts Contact
areaSubConts Contact
areaSubAccts Account
areaAddresses CustomerAddress
areaOpps Opportunity
areaOpportunities Opportunity
areaQuotes Quote
areaOrders SalesOrder
areaInvoices Invoice
areaService Incident
areaCases Incident
areaContract Contract
areaListsInSFA List
areaCampaignsInSFA Campaign
areaProducts Product
areaSubs Product
areaComp Competitor
areaComps Competitor
areaSalesLit SalesLiterature
areaItems ProductPriceLevel
areaContractLines ContractDetail
areaRoles Role
areaTeams Team
areaServices Service
areaResourceGroup ResourceGroup
areaResourceGroups ResourceGroup
areaUsers SystemUser
areaBiz BusinessUnit
areaResource Resource
areaUnits UoM
areaPrices ProductPriceLevel
areaMembers SystemUser
areaExistingProducts QuoteDetail
SalesOrder
Invoice
areaWriteInProducts QuoteDetail
SalesOrder
Invoice

All this may save you some hours of clicking !

Posted: Apr 27 2009, 13:46 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: .Net | CRM 4.0 | Programming
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

JavaScript AJAX wrapper for CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

This class is a clean wrapper for all your AJAX calls.

JavaScript AJAX wrapper for CRM 4.0


function AjaxWrapper()
{
    var object = this;

    object.Request = NewRequest();
    object.Request.onreadystatechange = CompleteRequest;

    this.Sync = true;
    this.Method = "GET";
    this.URL = "";
    this.WebServiceMethod = "";
    this.Parameters = new ParameterCollection();

    this.Execute = ExecuteRequest;
    this.AsyncCallbackMethod = null;

    this.ResultXML = null;
    this.ResultText = null;

    function NewRequest()
    {
        if (window.XMLHttpRequest)
            return new XMLHttpRequest();
        else
            return new ActiveXObject("Microsoft.XMLHTTP");
    }

    function ExecuteRequest()
    {
        var parameters = object.Parameters.toString();        

        ResetRequest();        

        if (this.Method.toUpperCase() == "POST")
        {
            if (object.WebServiceMethod.length > 0)
                object.Request.open(object.Method, object.URL + "/" + object.WebServiceMethod, !object.Sync);
            else
                object.Request.open(object.Method, object.URL, !object.Sync);            

            object.Request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            object.Request.send(object.Parameters);
        }
        else if (this.Method.toUpperCase() == "GET")
        {
            if (object.WebServiceMethod.length > 0 && parameters.length > 0)
                object.Request.open(object.Method, object.URL + "/" + object.WebServiceMethod + "?" + parameters, !object.Sync);
            else if (object.WebServiceMethod.length > 0)
                object.Request.open(object.Method, object.URL + "/" + object.WebServiceMethod, !object.Sync);
            else if (parametres.length > 0)
                object.Request.open(object.Method, object.URL + "?" + parameters, !object.Sync);
            else
                object.Request.open(object.Method, object.URL, !object.Sync);            

            object.Request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            object.Request.send();
        }
        else
        {
            throw "The method '" + this.Method.toUpperCase() + "' is not supported !";
        }        

        if (object.Sync)
            FinishRequest(object.Request.responseText);
    }

    function CompleteRequest()
    {
        if (object.Request.readyState == 4)
        {
            if (object.Request.status == 200)
            {
                FinishRequest(object.Request.responseText);                

                if (object.AsyncCallbackMethod != null)
                    object.AsyncCallbackMethod();
            }
        }
    }

    function ResetRequest()
    {
        object.Request = NewRequest();
        object.Request.onreadystatechange = CompleteRequest;
    }    

    function FinishRequest(retourTexte)
    {
        var xmlDoc = new ActiveXObject("MSXML2.DOMDocument");

        object.ResultText = object.Request.responseText;        

        try
        {
            xmlDoc.loadXML(object.Request.responseText);            

            if (xmlDoc.parsed && xmlDoc.xml.length > 0)
                object.ResultXML = xmlDoc;
            else
                object.ResultXML = null;
        }
        catch (ex)
        {
            object.ResultXML = null;
        }
    }
}

The ParameterCollection to help adding QueryString parameters safely (well-encoded values)


function ParameterCollection()
{
    this._list = new Array();
    
    this.Add = function (name, value)
    {
        this._list[this._list.length] = new Array(name, value);
    }    

    this.toString = function ()
    {
        var queryString = "";        

        for (var i=0; i<this._list.length; i++)
        {
            if (queryString.length > 0)
                queryString = queryString + "&";            

            queryString = queryString + this._list[i][0] + "=" + encodeURIComponent(this._list[i][1]);
        }        

        return queryString;
    }
}

Posted: Apr 13 2009, 17:17 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript | Programming
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Hide and show items in a picklist in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

Those methods seems a lot more complicated than they has to be because we can't really hide and show items in picklists (HTML select). In HTML if you want to hide an "option" of a select, you need to remove it ! So when you want to show it back again you need to readd it to the list, and in addition to that, it will be placed at the end, not where he was before... so I created methods to help people to really hide and show CRM picklist items only by their value.

Hide a picklist item in CRM 4.0


function HidePickListItem(listID, value)
{
    var objList = document.getElementById(listID);

    // If the list has never been saved, save it now
    if (objList.SavedList == null)
    {
        var arrListe = new Array();        

        for (var i=0; i<objList.options.length; i++)
        {
             arrListe[i] = new Object();
             arrListe[i].value = objList.options[i].value;
             arrListe[i].Libelle = objList.options[i].text;
             arrListe[i].Visible = true;
        }

        objList.SavedList = arrListe;
    }

    for (var i=0; i<objList.SavedList.length; i++)
        if (objList.SavedList[i].value == value)
            objList.SavedList[i].Visible = false;

    for (var i=objList.options.length - 1; i>=0; i--)
        if (objList.options[i].value == value)
            objList.options.remove(i);
}

Show a picklist item that has been hidden in CRM 4.0


function ShowPickListItem(listID, value)
{
    var objList = document.getElementById(listID);

    if (objList.SavedList != null)
    {
        var selValue = null;
        var indexInsertion = 0;

        for (var i=0; i<objList.SavedList.length; i++)
            if (objList.SavedList[i].value == value)
                objList.SavedList[i].Visible = true;

        // Keep the selected value so we can reselect it after
        if (objList.selectedIndex > -1)
            selValue = objList.options[objList.selectedIndex].value;

        // Remove all the items in the list
        for (var i=objList.options.length - 1; i>=0; i--)
           objList.options.remove(i);

        // Add the items that must be visible
        for (var i=0; i<objList.SavedList.length; i++)
        {
             if (objList.SavedList[i].Visible)
             {
                var oOption = document.createElement('option');         

                oOption.text = objList.SavedList[i].Libelle;
                oOption.value = objList.SavedList[i].value;                

                objList.options.add(oOption);
            }
        }        

        // Reselect the item that was selected
        for (var i=0; i<objList.options.length; i++)
            if (objList.options[i].value == selValue)
                objList.selectedIndex = i;
    }
}

Posted: Apr 13 2009, 16:40 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Maximize the CRM child windows

 

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM. One of the client need was that all the windows appear fullscreen because their users are not familiar with mutliple levels of pop-up so by maximizing every window, you always have the feeling to be in the same window.

Maximize the window in CRM 4.0


function MaximizeWindow()
{
    window.moveTo(0, 0);
    window.resizeTo(screen.width, screen.height);
}

 

Posted: Apr 13 2009, 16:27 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to get selected items in a CRM grid in CRM 4.0

 

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

Get the selected items in a CRM grid in CRM 4.0

With this function you get only the GUIDs of the records selected.


function GetSelectedItemsInGrid()
{
    return getSelected("crmGrid");
}

 

Posted: Apr 13 2009, 16:22 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to hide and show left navigation items in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

The first you need to do when you want to manipulate the left navigation section is to create a general function to get a reference to a navigation block. The reason is because each time you want to hide or show a block or nav item you need the DOM reference of the navigation block so instead of copying the code every time, you write a function and you call it everywhere.

Get the DOM reference to a left navigation block in CRM 4.0


function GetNavBlock(block)
{
    var objBlockDetails = document.getElementById("_NA_Info");
    var objBlockSales = document.getElementById("_NA_SFA");
    var objBlockService = document.getElementById("_NA_CS");
    var objBlockMarketing = document.getElementById("_NA_MA");
    var objNavBlock = null;    

    if (objBlockDetails.innerText.substr(0, objBlockDetails.innerText.indexOf(":")).toLowerCase() == block.toLowerCase())
        objNavBlock = objBlockDetails;
    else if (objBlockSales.innerText.substr(0, objBlockSales.innerText.indexOf(":")).toLowerCase() == block.toLowerCase())
        objNavBlock = objBlockSales;
    else if (objBlockService.innerText.substr(0, objBlockService.innerText.indexOf(":")).toLowerCase() == block.toLowerCase())
        objNavBlock = objBlockService;
    else if (objBlockMarketing.innerText.substr(0, objBlockMarketing.innerText.indexOf(":")).toLowerCase() == block.toLowerCase())
        objNavBlock = objBlockMarketing;
    else
        throw "The navigation block '" + block + "' doesn't exists.";

    return objNavBlock;
}

Hide a navigation block in CRM 4.0


function HideNavBlock(block)
{
    var objNavBlock = GetNavBlock(block);

    objNavBlock.parentElement.style.display = "none";
}

Show a navigation block in CRM 4.0


function ShowNavBlock(block)
{
    var objNavBlock = GetNavBlock(block);

    objNavBlock.parentElement.style.display = "";
}

Hide a navigation item in a navigation block in CRM 4.0


function HideNavItem(block, item)
{
    var objNavBlock = GetNavBlock(block);

    for (var i=0; i<objNavBlock.nextSibling.childNodes.length; i++)
    {
        var menuItem = objNavBlock.nextSibling.childNodes[i];

        if (menuItem.childNodes[0].childNodes[1].innerText == item)
            menuItem.style.display = "none";
    }
}

Show a navigation item in a navigation block in CRM 4.0


function ShowNavItem(block, item)
{
    var objNavBlock = GetNavBlock(block);

    for (var i=0; i<objNavBlock.nextSibling.childNodes.length; i++)
    {
        var menuItem = objNavBlock.nextSibling.childNodes[i];

        if (menuItem.childNodes[0].childNodes[1].innerText == item)
            menuItem.style.display = "";
    }
}

Posted: Apr 13 2009, 16:04 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to hide, show and select tabs in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

Hide a tab in CRM 4.0


function HideTab(tabNumber)
{
    var tab = document.getElementById("tab" + (tabNumber - 1).toString() + "Tab");    

    tab.style.display = "none";
}

Show a tab in CRM 4.0


function ShowTab(tabNumber)
{
    var tab = document.getElementById("tab" + (tabNumber - 1).toString() + "Tab");    

    tab.style.display = "";
}

Select a tab in CRM 4.0


function SelectTab(tabNumber)
{
    var tab = document.getElementById("tab" + (tabNumber - 1).toString() + "Tab");

    tab.click();
}

Posted: Apr 13 2009, 16:00 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to hide and show sections in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

Hide a section in a tab in CRM 4.0


function HideSection(tabNumber, sectionNumber)
{
    var tab = document.getElementById("tab" + (tabNumber - 1).toString());    

    tab.childNodes[0].rows[(sectionNumber - 1).toString()].style.display = "none";
}

Show a section in a tab in CRM 4.0


function ShowSection(tabNumber, sectionNumber)
{
    var tab = document.getElementById("tab" + (tabNumber - 1).toString());    

    tab.childNodes[0].rows[(sectionNumber - 1).toString()].style.display = "";
}

Posted: Apr 13 2009, 15:30 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to disable and enable fields in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

Disable a field in CRM 4.0


function DisableField(id)
{
    var lookup = id.indexOf('_ledit') > 0;
    var objField = lookup ? crmForm.all[id.replace('_ledit', '')] : crmForm.all[id];

    if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "radio")
        objField.disabled = true;
    else if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "checkbox")
        objField.disabled = true;
    else if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "text")
        objField.readOnly = true;
    else if (objField.tagName.toUpperCase() == "SELECT")
        objField.disabled = true;
    else if (objField.tagName.toUpperCase() == "TEXTAREA")
        objField.readOnly = true;
    else
        objField.Disabled = true;

    if ((objField.tagName.toUpperCase() == "INPUT" && objField.type != "radio" && objField.type != "checkbox") || objField.tagName.toUpperCase() == "SELECT" || objField.tagName.toUpperCase() == "TEXTAREA")
        objField.style.backgroundColor = "#DDDDDD";
}

Enable a field in CRM 4.0


function EnableField(id)
{
    var lookup = id.indexOf('_ledit') > 0;
    var objField = lookup ? crmForm.all[id.replace('_ledit', '')] : crmForm.all[id];    

    if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "radio")
        objField.disabled = false;
    else if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "checkbox")
        objField.disabled = false;
    else if (objField.tagName.toUpperCase() == "INPUT" && objField.type != "text")
        objField.readOnly = false;
    else if (objField.tagName.toUpperCase() == "SELECT")
        objField.disabled = false;
    else if (objField.tagName.toUpperCase() == "TEXTAREA")
        objField.readOnly = false;
    else
        objField.Disabled = false;        

    if ((objField.tagName.toUpperCase() == "INPUT" && objField.type != "radio" && objField.type != "checkbox") || objField.tagName.toUpperCase() == "SELECT" || objField.tagName.toUpperCase() == "TEXTAREA")
        objField.style.backgroundColor = "";
}

Posted: Apr 13 2009, 15:22 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

How to hide and display fields in CRM 4.0

If you already worked with Microsoft Dyamics CRM 4.0, you know that almost everything you do with JavaScript is considered a "hack" because you manipulate the DOM of the pages by yourself. Because of this I decided to give you some help with differents helper methods I developped at my day job.

I'm currently working on a big development project involving CRM.

How to hide a field in CRM 4.0

Here's a secure method that will correctly hide a field (lookups are a bit tricky).


function HideField(id)
{
    var objField = crmForm.all[id];
    var lookup = id.indexOf('_ledit') > 0 || objField.tagName.toUpperCase() == "IMG";
    var objFieldLookup = objField.tagName.toUpperCase() == "IMG" ? crmForm.all[id + '_d'] : crmForm.all[id.replace('_ledit', '_d')];

    objField.style.visibility = 'hidden';

    if (lookup)
        objFieldLookup.style.visibility = 'hidden';
}

How to show a field in CRM 4.0

Here's a secure method that will correctly show a field


function ShowField(id)
{
    var objField = crmForm.all[id];
    var lookup = id.indexOf('_ledit') > 0 || objField.tagName.toUpperCase() == "IMG";
    var objFieldLookup = objField.tagName.toUpperCase() == "IMG" ? crmForm.all[id + '_d'] : crmForm.all[id.replace('_ledit', '_d')];

    objField.style.visibility = 'visible';

    if (lookup)
        objFieldLookup.style.visibility = 'visible';
}

Posted: Apr 13 2009, 15:09 by WebMasterSam | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: CRM 4.0 | JavaScript
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us
LINK BUILDING IS PROHIBITED ON THIS WEBSITE