Источник:
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