moussa-e
2/17/2017 - 8:44 AM

Dynamics365 #SavedQuery #Views #MoussaElAnnan

Dynamics365 #SavedQuery #Views #MoussaElAnnan

/*
* Plugin Configuration:
* Message:  RetrieveMultiple
* Primary Entity: savequery
* Eventing Pipline: Pre-validation
*/
private void HideViewsFromList() {
    if (context.InputParameters.Contains("Query") && context.InputParameters["Query"] is QueryExpression)
    {
    var qe = (QueryExpression)context.InputParameters["Query"];
        if (qe.EntityName == "savedquery")
        {
            if (qe.Criteria != null)
            {
                if (qe.Criteria.Conditions != null)
                {
                var queryCondition = new ConditionExpression("name", ConditionOperator.NotLike, "my%");
                qe.Criteria.Conditions.Add(queryCondition);
                }
            }
        }
    }
}