我对 crm 2013 有疑问。我将 fetchXML 用于过滤(例如)计费帐户。当我们的团队使用 CRM 2011 时一切正常,但我们迁移到 CRM 2013 并在添加相关项目时遇到问题。
retrieveRecord(
recordId,
"xxx_project",
null,
null,
function (result) {
var xId = (result.xxx_Customer) ? result.xxx_xCustomer : "";
// Fetch to retrieve filtered data.
var fetch =
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
" <entity name='xxx_billingaccount'>" +
" <attribute name='xxx_billingaccountid' />" +
" <attribute name='xxx_name' />" +
" <attribute name='statecode' />" +
" <attribute name='xxx_xid' />" +
" <order attribute='xxx_name' descending='false' />" +
" <filter type='and'>" +
" <condition attribute='xxx_xid' operator='eq' value='" + xId + "' />" +
" </filter>" +
" </entity>" +
"</fetch>";
// Columns to display in the custom view (make sure to include these in the fetch query).
var layout = "<grid name='resultset' object='1' jump='xxx_name' select='1' icon='0' preview='1'>" +
" <row name='result' id='xxx_billingaccountid'>" +
" <cell name='xxx_name' width='150' />" +
" <cell name='statecode' width='150' />" +
" <cell name='xxx_xid' width='150' />" +
" </row>" +
"</grid>";
SDK.Entity.BillingAccount.displayFilteredLookupView(gridTypeCode, gridControl, fetch, layout, "Filtered by Customer ID Billing Accounts");
},
SDK.Entity.BillingAccount.errorHandler);
displayFilteredLookupView: function (gridTypeCode, gridControl, fetch, layout, viewName) {
var viewId = "{3D02B064-4D8D-4E7C-B919-965D5D2C225D}";
var relName = gridControl.GetParameter("relName"),
roleOrd = gridControl.GetParameter("roleOrd");
// Creates the custom view object.
var customView = {
fetchXml: fetch,
id: viewId,
layoutXml: layout,
name: viewName,
recordType: gridTypeCode,
Type: 0
};
// Pops the lookup window with our view injected.
var lookupItems = LookupObjects(null, "multi", gridTypeCode, 0, null, "", null, null, null, null, null, null, viewId, [customView], null, null, null, null, null, null, 1);
// Once the lookup window is closed, we need the parent record ID and ETC before associating selected records.
if (lookupItems && lookupItems.items.length > 0) {
var parent = GetParentObject(),
parentId = parent.id,
parentTypeCode = parent.objectTypeCode;
//associates the selected records
AssociateObjects(parentTypeCode, parentId, gridTypeCode, lookupItems, IsNull(roleOrd) || roleOrd == 2, "", relName);
}
},
当我搜索解决此问题的路径时,我找到了一个链接http://community.dynamics.com/crm/f/117/p/119416/248998.aspx。这对我们的项目来说非常糟糕。
也许任何人都可以帮助我解决这个问题......