QueryExpression pagequery = new QueryExpression(); pagequery.EntityName = "account"; pagequery.Criteria.AddCondition(pagecondition); pagequery.Orders.Add(order); pagequery.ColumnSet.AddColumns("name", "emailaddress1");
QueryExpression query = new QueryExpression("contact"); query.ColumnSet.AddColumns("firstname", "lastname"); query.Criteria.AddFilter(filter1);
/// <summary> /// Determines if the uniqueField contains a unique value. /// </summary> /// <param name="entityName">Logical Name of the entity being checked</param> /// <param name="uniqueField">Field on the entity to check for uniqueness</param> /// <param name="recordIdField">Field on the entity that is hte Primary Key (not attribute) of the Entity - should be logical name of the entity followed by 'id' (i.e., accountid)</param> /// <param name="valueToCheck">Value to ensure is unique to this record</param> /// <param name="currentRecordId">Id (Primary Key) of the current record</param> /// <param name="service">An instance of IOrganizationService with Organization-wide permission to read the entity</param> /// <returns></returns> public bool isUniqueRecord(string entityName, string uniqueField, string recordIdField, string valueToCheck, Guid currentRecordId, IOrganizationService service) { var query = new QueryExpression(entityName) { ColumnSet = new ColumnSet(true) }; var criteria = new FilterExpression(LogicalOperator.And); criteria.AddCondition(new ConditionExpression(uniqueField, ConditionOperator.Equal, valueToCheck)); criteria.AddCondition(new ConditionExpression(recordIdField, ConditionOperator.NotEqual, currentRecordId)); query.Criteria = criteria; var result = service.RetrieveMultiple(query); if (result.Entities.Any()) return false; else return true; }
function ShowImages() { IMG_Logo.Visible = false; QueryExpression query = new QueryExpression("annotation"); query.Criteria.AddCondition("objectid", ConditionOperator.Equal, Id); query.Criteria.AddCondition("mimetype", ConditionOperator.In, new string[] { "image/x-png", "image/pjpeg", "image/png", "image/jpeg" }); query.Criteria.AddCondition("subject", ConditionOperator.NotEqual, "membershipcardthumbnail"); query.Criteria.AddCondition("subject", ConditionOperator.NotEqual, "membershipcardimage"); query.ColumnSet = new ColumnSet(true); EntityCollection AllLogoImageNotes = Common.Common.RetrieveMultiple(query); if (AllLogoImageNotes.Entities.Count > 0) { foreach (Entity Note in AllLogoImageNotes.Entities) { if (Note.Attributes.Contains("subject") && Note.Attributes.Contains("documentbody")) { if (Note["subject"].ToString().ToLower() == "accountlogoimage") { HttpRuntime.Cache.Remove("AccountLogoImage"); HttpRuntime.Cache.Remove("AccountLogoImageType"); HttpRuntime.Cache.Add("AccountLogoImage", Convert.FromBase64String(Note["documentbody"].ToString()), null, DateTime.Now.AddMinutes(5), TimeSpan.Zero, CacheItemPriority.Normal, null); HttpRuntime.Cache.Add("AccountLogoImageType", Note["mimetype"].ToString(), null, DateTime.Now.AddMinutes(5), TimeSpan.Zero, CacheItemPriority.Normal, null); IMG_Logo.ImageUrl = "AccountImageForm.aspx" + "?time=" + DateTime.Now.ToString(); IMG_Logo.Visible = true; } } } } }
ConditionExpression condition = new ConditionExpression(); //to check whether an email already exist condition.AttributeName = "emailaddress1"; condition.Operator = ConditionOperator.Equal; condition.Values = new string[] { "any email address"}; FilterExpression filter = new FilterExpression(); filter.FilterOperator = LogicalOperator.And; filter.Conditions = new ConditionExpression[] { condition }; QueryExpression query = new QueryExpression(); //to specify which entity query.EntityName = EntityName.contact.ToString(); query.ColumnSet = new AllColumns(); query.Criteria = filter; //here applying the filter BusinessEntityCollection app = service.RetrieveMultiple(query);
@Override public QueryExpression createSearchQueryExpression(String fileMask, String contentMask) { QueryExpression queryExpression = new QueryExpression(); if (!isNullOrEmpty(contentMask)) { queryExpression.setText(contentMask); } if (!isNullOrEmpty(fileMask)) { queryExpression.setName(fileMask); } if (!getLocation().isRoot()) { queryExpression.setPath(getLocation().toString()); } return queryExpression; } }
protected Promise<SearchResult> search( final Container container, String fileMask, String contentMask) { QueryExpression queryExpression = new QueryExpression(); if (!isNullOrEmpty(contentMask)) { queryExpression.setText(contentMask); } if (!isNullOrEmpty(fileMask)) { queryExpression.setName(fileMask); } if (!container.getLocation().isRoot()) { queryExpression.setPath(container.getLocation().toString()); } return ps.search(queryExpression); }
filter1.setConditions(ss); QueryExpression query = new QueryExpression(); query.setEntityName("account");