RESCO:使用 JSBridge 在表单上更改字段时在查找字段上动态设置查找视图
RESCO : Set Look Up view dynamically on a lookup field on change of a field on the form using JSBridge
我正在尝试使用 JSBridge 为 Resco 中的查找字段设置视图,但代码不起作用。你能指出我哪里错了吗
下面是我的代码--
onLoad: function () {
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
var detailView = entityForm.getDetailView("Booking");
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq" value="{90F7A06F-CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
inlineSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
inlineSetup.addFilter("msdyn_workordersubstatus", customXMLView);
var dialogSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
dialogSetup.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", true);
var dialogOnly = false; // Allow both inline lookup and expanded lookup dialog
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
});
}
不确定下面代码中的第一个参数是什么 -
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
还尝试了 LookupForm,代码有效但不确定如何将其绑定到字段-
ShowLookUp: function () {
var lookupForm = new MobileCRM.UI.LookupForm();
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq" value="{90F7A06F-
CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
lookupForm.addEntityFilter("msdyn_workordersubstatus", customXMLView)
lookupForm.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", "true");
lookupForm.allowNull = true;
lookupForm.show(FS.BRB.onLookupFinished, MobileCRM.bridge.alert, null);
},
onLookupFinished: function () {
MobileCRM.UI.EntityForm.requestObject(
function (entityForm) {
},
MobileCRM.bridge.alert
);
}
如有任何建议,我们将不胜感激。
提前致谢
所以我找到了上述查询的答案。下面是在 resco 中动态设置查找视图的工作代码。
张贴它以帮助其他人。
onLoad: function () {
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
var detailView = entityForm.getDetailView("Booking");
var itemIndex = detailView.getItemIndex("vWO.msdyn_substatus"); //Not required, Used this to get the index of my lookup control on the form
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq"
value="{90F7A06F-CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
/// Create inline lookup setup (This shows when you click inside lookup without opening the dialog)
inlineSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
inlineSetup.addFilter("msdyn_workordersubstatus", customXMLView);
//Dialog Look Up (This shows when we click on the plus button)
var dialogSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
dialogSetup.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", true);
var dialogOnly = false; // Allow both inline lookup and expanded lookup dialog
detailView.updateLinkItemViews(11, dialogSetup, inlineSetup, dialogOnly); //here the
first parameter is the index of the lookup field
});
},
我犯的错误是,我没有在行中写入正确的控件索引号
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
更正:
detailView.updateLinkItemViews(11, dialogSetup, inlineSetup, dialogOnly);
我正在尝试使用 JSBridge 为 Resco 中的查找字段设置视图,但代码不起作用。你能指出我哪里错了吗
下面是我的代码--
onLoad: function () {
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
var detailView = entityForm.getDetailView("Booking");
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq" value="{90F7A06F-CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
inlineSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
inlineSetup.addFilter("msdyn_workordersubstatus", customXMLView);
var dialogSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
dialogSetup.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", true);
var dialogOnly = false; // Allow both inline lookup and expanded lookup dialog
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
});
}
不确定下面代码中的第一个参数是什么 -
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
还尝试了 LookupForm,代码有效但不确定如何将其绑定到字段-
ShowLookUp: function () {
var lookupForm = new MobileCRM.UI.LookupForm();
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq" value="{90F7A06F-
CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
lookupForm.addEntityFilter("msdyn_workordersubstatus", customXMLView)
lookupForm.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", "true");
lookupForm.allowNull = true;
lookupForm.show(FS.BRB.onLookupFinished, MobileCRM.bridge.alert, null);
},
onLookupFinished: function () {
MobileCRM.UI.EntityForm.requestObject(
function (entityForm) {
},
MobileCRM.bridge.alert
);
}
如有任何建议,我们将不胜感激。
提前致谢
所以我找到了上述查询的答案。下面是在 resco 中动态设置查找视图的工作代码。
张贴它以帮助其他人。
onLoad: function () {
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
var detailView = entityForm.getDetailView("Booking");
var itemIndex = detailView.getItemIndex("vWO.msdyn_substatus"); //Not required, Used this to get the index of my lookup control on the form
var customXMLView = '<fetch version="1.0"><entity name="msdyn_workordersubstatus">' +
'<filter type="and"><condition attribute="msdyn_workordersubstatusid" operator="eq"
value="{90F7A06F-CA1C-EA11-A811-000D3A6AACAF}"/></filter></entity></fetch>';
/// Create inline lookup setup (This shows when you click inside lookup without opening the dialog)
inlineSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
inlineSetup.addFilter("msdyn_workordersubstatus", customXMLView);
//Dialog Look Up (This shows when we click on the plus button)
var dialogSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
dialogSetup.addView("msdyn_workordersubstatus", "WorkOrderSubStatusList", true);
var dialogOnly = false; // Allow both inline lookup and expanded lookup dialog
detailView.updateLinkItemViews(11, dialogSetup, inlineSetup, dialogOnly); //here the
first parameter is the index of the lookup field
});
},
我犯的错误是,我没有在行中写入正确的控件索引号
detailView.updateLinkItemViews(0, dialogSetup, inlineSetup, dialogOnly);
更正:
detailView.updateLinkItemViews(11, dialogSetup, inlineSetup, dialogOnly);