Sunday, 11 May 2014

filtered lookups using javascript

ActualCostAllocationLookup = function () {
var thisBE = new BusinessEntityCombo("", "");
thisBE = GetBusinessEntity();
if (thisBE.name == 'SIML') {
var lookupAttributeEntityName = "ledgera";
var lookupAttributeName = "ledgeraccountid";
var strFilterCondition = '<condition attribute="statecode" operator="eq" value="0"/>';
AddCustomFilterView(lookupAttributeEntityName, lookupAttributeName, strFilterCondition);
}
else {
var lookupAttributeEntityName = "ledgeraccount";
var lookupAttributeName = "edgeraccountid";
//var strFilterCondition = '<condition attribute="businessentityid" operator="eq" value="' + thisBE.id + '"/>';
//AddCustomFilterView(lookupAttributeEntityName, lookupAttributeName, strFilterCondition);
var fetchXMLInput = '<fetch mapping="logical"><entity name="ledgeraccount"><attribute name="name" /><attribute name="businessentityledgeraccountsid" /><attribute name="description" /><attribute name="ledgeraccountid" /><order attribute="name" /><link-entity name="businessentity" from="businessentityid" to="businessentityledgeraccountsid" alias="aa"><filter type="and"><condition attribute="businessentityid" operator="eq" value="' + thisBE.id + '" /></filter></link-entity></entity></fetch>';
AddCustomFilterViewCustom(lookupAttributeEntityName, lookupAttributeName, fetchXMLInput);
}

No comments:

Post a Comment