Показать сообщение отдельно
Старый 10.11.2009, 14:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
CRM Programmer: How to hide an items of drop-down list?
Источник: http://crmpro.blogspot.com/2009/11/h...down-list.html
==============

"We should not be able to choose some steps of Opportunity History, if the opportunity has no quotes or sales orders." - that was they said.

And that was I wrote.

var oService = null;
var oppid = null;

function FormOnLoad()
{
oService = new Ascentium_CrmService(null, null);

var oParentCrmForm = window.opener.parent.document.all.crmForm;
if(oParentCrmForm)
{
oppid = oParentCrmForm.ObjectId;
}

HideComboboxItems();
}


window.HideComboboxItems = function()
{
var newstep = document.getElementById("new_step");
if(newstep)
{
// checking opportunity for quotes
var sFetchXml =''+
'';

var aoFetchResult = oService.Fetch(sFetchXml);
var quoteCount = 0;

if(aoFetchResult.length > 0)
{
quoteCount = aoFetchResult[0].attributes["count"].value;
}

// if no qoutes, then hiding items 4,5,6,7 of dropdown list
if(quoteCount == 0 )
{
var allDropDownElements = newstep.childNodes;
var lastnodevalue = allDropDownElements.length;
for(var i=lastnodevalue; i >= 4; i--)
{
newstep.options.remove(i);
}
}
else
{
// if there is some qoutes, then checking for salesorders
var sFetchXml ='&lr;fetch mapping="logical" aggregate="true" version="1.0">'+
'';

var aoFetchResult = oService.Fetch(sFetchXml);
var SOCount = 0;

if(aoFetchResult.length > 0)
{
SOCount = aoFetchResult[0].attributes["count"].value;
}

// if no salesorders, then hiding items 6,7
if(SOCount == 0)
{
var allDropDownElements = newstep.childNodes;
var lastnodevalue = allDropDownElements.length;
for(var i=lastnodevalue; i >=6; i--)
{
newstep.options.remove(i);
}
}
}

}
}



Источник: http://crmpro.blogspot.com/2009/11/h...down-list.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.