Skip to main content
Answer

How to search a customer by create date through SOAP API?

  • November 23, 2021
  • 1 reply
  • 91 views

Forum|alt.badge.img

Following code is able to search customer by CustomerID. I need to do similar search by Customer’s Create Date. How should I do that?

 

List<Command> cmdSelect = new List<Command>();
            cmdSelect.Add(AR303000.CustomerSummary.ServiceCommands.EveryCustomerID);

            cmdSelect.Add(AR303000.CustomerSummary.CustomerID);
            cmdSelect.Add(AR303000.CustomerSummary.CustomerClass);
            cmdSelect.Add(AR303000.GeneralAccountAddress.AddressLine1);
            cmdSelect.Add(AR303000.GeneralAccountAddress.City);
            cmdSelect.Add(AR303000.GeneralAccountAddress.State);
            cmdSelect.Add(AR303000.GeneralAccountAddress.PostalCode);
            cmdSelect.Add(AR303000.Contacts.Contact);

            List<Filter> filters = new List<Filter>();
            filters.Add(new Filter()
            {
                Field = new Field()
                {
                    FieldName = AR303000.CustomerSummary.CustomerID.FieldName,
                    ObjectName = AR303000.CustomerSummary.CustomerID.ObjectName
                },
                Condition = FilterCondition.Equals,
                Value = "CUST1XTEST1",
                Operator = FilterOperator.And
            });

Best answer by adilaleem

I found the answer:

 

Field = new Field
                {
                    ObjectName = AR303000.CustomerSummary.CustomerID.ObjectName,
                    FieldName = "LastModifiedDateTime"
                },
                Condition = FilterCondition.Greater,
                Value = DateTime.Now.AddMonths(-1).ToLongDateString()

1 reply

Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • Answer
  • November 23, 2021

I found the answer:

 

Field = new Field
                {
                    ObjectName = AR303000.CustomerSummary.CustomerID.ObjectName,
                    FieldName = "LastModifiedDateTime"
                },
                Condition = FilterCondition.Greater,
                Value = DateTime.Now.AddMonths(-1).ToLongDateString()