我尝试过以下其他帖子中发现的以下内容,但似乎没有什么区别:
1.转到以下路径并找到“stage.js”文件“C:\ Program Files \ Microsoft Dynamics CRM \ CRMWeb_static_common \ scripts \”
2.在进行任何修改之前创建此文件的备份副本,以便您也拥有原始副本
3.在文本编辑器中打开“stage.js”,例如EmEditor
4.找到以下代码行:sFindCriteria = Trim(findCriteria.value.replace(/ [] + /,“”)); findCriteria.value = sFindCriteria;
5.现在将其更改为:sFindCriteria = Trim(findCriteria.value.replace(/ [] + /,“”)); if(sFindCriteria!=“”&& sFindCriteria.substr(0 ,1)!=“”)sFindCriteria =“”+ sFindCriteria; findCriteria.value = sFindCriteria;
6.保存文件并尝试快速查找以查看更改
为什么这不起作用的任何想法以及我可以改变以使其发挥作用?
答案 0 :(得分:2)
我相信你在谈论这篇文章:P In Dynamics CRM, how do I enable wildcard (*) search by default in Quick Find?
我在2014年问过同一个问题,但现在我已经得到了解决方案。我同意Henk van Boeijen
修改内置脚本是一种不受支持的方式,所以我找到了一种支持的方式。
写一个插件:
public void Execute(IServiceProvider serviceProvider)
{
string OriginalSearchQueryString = String.Empty;
string UpdatedOriginalQueryToLikeQuery = String.Empty;
try
{
IPluginExecutionContext ContextInstance = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationService ServiceInstance = ((IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory))).CreateOrganizationService(ContextInstance.InitiatingUserId);
// Critical Point here - NOTICE that the InputParameters Contains the word Query
if (ContextInstance.Depth < 2 && ContextInstance.InputParameters.Contains(QueryLiteral) && ContextInstance.InputParameters[QueryLiteral] is QueryExpression)
{
QueryExpression QueryPointer = (ContextInstance.InputParameters[QueryLiteral] as QueryExpression);
//Verify the conversion worked as expected - if not, everything else is useless
if (null != QueryPointer)
{
// Check if the request is coming from any Search View
// We know this b/c Criteria isn't null and the Filters Count > 1
if (null != QueryPointer.Criteria && (QueryPointer.Criteria.Filters.Count > 1 || QueryPointer.Criteria.Filters.Count == 1))
{
if (QueryPointer.Criteria.Filters.Count > 1 && QueryPointer.Criteria.Filters[0].Conditions.Count > 0 && QueryPointer.Criteria.Filters[0].Conditions[0].Values.Count > 0)
OriginalSearchQueryString = QueryPointer.Criteria.Filters[1].Conditions[0].Values[0].ToString();
else if (QueryPointer.Criteria.Filters.Count == 1 && QueryPointer.Criteria.Filters[0].Conditions.Count > 0 && QueryPointer.Criteria.Filters[0].Conditions[0].Values.Count > 0)
OriginalSearchQueryString = QueryPointer.Criteria.Filters[0].Conditions[0].Values[0].ToString();
if (CheckIfTheQueryIsNotForWebResourceAndSearchIsNotByLetter(ContextInstance.PrimaryEntityName, OriginalSearchQueryString))
{
OriginalSearchQueryString = String.Format(CultureInfo.CurrentCulture, "{0}{1}", LIKE, OriginalSearchQueryString);
OriginalSearchQueryString = ModifyAllConditionExpressionsInCriteriaToLikeOperator(OriginalSearchQueryString, QueryPointer);
ContextInstance.InputParameters[QueryLiteral] = QueryPointer;
}
}
}
}
}
catch (Exception ex)
{
Logger.Error("Exception occured in QuickSearch()", ex);
}
}
private bool CheckIfTheQueryIsNotForWebResourceAndSearchIsNotByLetter(string entityLogicalName, string originalSearch)
{
if (entityLogicalName.ToLower() == "webresource" || String.IsNullOrWhiteSpace(originalSearch) || entityLogicalName.ToLower() == "opportunity")
return false;
else if (originalSearch.StartsWith("[") && originalSearch.EndsWith("]%"))
return false;
return true;
}
private string ModifyAllConditionExpressionsInCriteriaToLikeOperator(string OriginalSearchQueryString, QueryExpression QueryPointer)
{
if (null != QueryPointer.Criteria)
{
//Change the default 'BeginsWith'Operator to 'Contains/Like' operator in the basic search query
foreach (FilterExpression FilterSet in QueryPointer.Criteria.Filters)
{
foreach (ConditionExpression ConditionSet in FilterSet.Conditions)
{
if (ConditionSet.Operator == ConditionOperator.Like)
{
if (OriginalSearchQueryString != "")
ConditionSet.Values[0] = OriginalSearchQueryString;
else
{
OriginalSearchQueryString = QueryPointer.Criteria.Filters[0].Conditions[0].Values[0].ToString();
OriginalSearchQueryString = String.Format(CultureInfo.CurrentCulture,
"{0}{1}", LIKE, OriginalSearchQueryString);
ConditionSet.Values[0] = OriginalSearchQueryString;
}
}
}
}
}
return OriginalSearchQueryString;
}
注册此插件,如下所示:
Message
: RetrieveMultiple
Primary Entity
: none
Secondary Entity
: none
Eventing Pipleine Stage of Execution
: Pre-Operation
Execution Mode
的 强> Synchronous