Boosting Dynamics CRM Productivity with Embedded Advanced Find Feature
Guowei_Xu
407
Introduction
The Advanced Find feature in Dynamics CRM is a powerful tool for filtering and querying data. However, embedding it into a form can greatly enhance user productivity.
In this blog, we will guide you through embedding Advanced Find into a form and saving filter criteria into a text field.
Desired behaviors:
1, Insert an IFrame in the form, and embed the Advanced Find into the IFrame.
2, Save the filter criteria into a text field.
Step 1: Insert an IFrame into the Form and bind the OnReadyStateComplete Event
Step 2: binding the HTML to IFrame
setAdvFindControl: function (formContext) {
//ToDo: only for test
var entityObjectTypeCode = 1; //Account
let src = formContext.getClientUrl() + "/SFA/goal/ParticipatingQueryCondition.aspx?entitytypecode=" + entityObjectTypeCode
formContext.getControl("IFRAME_AdvFind").setSrc(src);
}
//ToDo: only for test
var entityObjectTypeCode = 1; //Account
let src = formContext.getClientUrl() + "/SFA/goal/ParticipatingQueryCondition.aspx?entitytypecode=" + entityObjectTypeCode
formContext.getControl("IFRAME_AdvFind").setSrc(src);
}
Step 3: Save the filter criteria
Once the Advanced Find feature is embedded, it's crucial to save the filter criteria. This can be achieved by setting up a script to capture the filter criteria and save it into a designated text field.
======
onSave: function (executionContext) {
var formContext = executionContext.getFormContext();
let fetchXml = formContext.getControl("IFRAME_AdvFind").getObject("advFind").contentWindow.$find("advFind").get_fetchXml();
formContext.getAttribute("new_fetchxml").setValue(fetchXml);
}
var formContext = executionContext.getFormContext();
let fetchXml = formContext.getControl("IFRAME_AdvFind").getObject("advFind").contentWindow.$find("advFind").get_fetchXml();
formContext.getAttribute("new_fetchxml").setValue(fetchXml);
}
Step 4: Set saved Fetchxml to UI on OnLoad Event
Finally, ensure that the saved filter criteria are applied to the user interface. By setting up a function to retrieve and display the saved filter criteria, users can easily access and modify their previously saved filter settings.
======
setFindXml: function (formContext) {
var fetchXml = formContext.getAttribute("new_fetchxml").getValue();
var fetchXml = formContext.getAttribute("new_fetchxml").getValue();
let url = formContext.getControl("IFRAME_AdvFind").getSrc();
if (url === "https://") {
return;
}
if (fetchXml) {
let contentWindow = formContext.getControl("IFRAME_AdvFind").getObject("advFind").contentWindow;
if (contentWindow) {
if (undefined !== contentWindow.$find) {
let advFindObj = contentWindow.$find("advFind");
if (advFindObj) {
advFindObj.set_fetchXml(fetchXml);
if (url === "https://") {
return;
}
if (fetchXml) {
let contentWindow = formContext.getControl("IFRAME_AdvFind").getObject("advFind").contentWindow;
if (contentWindow) {
if (undefined !== contentWindow.$find) {
let advFindObj = contentWindow.$find("advFind");
if (advFindObj) {
advFindObj.set_fetchXml(fetchXml);
}
}
}
}
}
}
}
}
}
Test it:
After following these steps, you can test the embedded Advanced Find feature to ensure that it functions as intended. This allows you to verify that the filter criteria are saved and applied correctly, enhancing the user experience.
Conclusion:
By embedding the Advanced Find feature into the form and saving filter criteria into a text field, you can greatly improve user productivity and efficiency within Dynamics CRM. This enhancement streamlines the process of using Advanced Find and provides a more seamless user experience.
===The End===
Comments
-
-
Boosting Dynamics CRM Productivity with Embedded Advanced Find Feature
*This post is locked for comments