通过电子邮件搜索客户

Customer Search By Email

我们为 5.30.001 创建了一个新的 OzLINK_WSE Web 服务端点,并创建了一个定义 OzCustomer 以启用基于电子邮件地址的搜索。

WSE Definition

我们尝试了两种不同的搜索,但均无效:-

第一个(GetList)

var cust = c.GetList(new OzCustomer { Email = new StringValue { Value = "info@active-staffing.con" } }, false).Cast<OzCustomer>();

returns这个错误

An unhandled exception of type 'System.ServiceModel.FaultException' occurred in mscorlib.dll
Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> 
PX.Api.ContractBased.OperationDoesNotSupportValuesException: Operation does not support values.
   at PX.Api.ContractBased.EntityService.GetList(EntityGateBase gate, String version, String name, 
   EntityImpl entity, Boolean returnFullEntities, Boolean ignoreValueFields, PXGraph graph)
   at PX.Api.ContractBased.Soap.EntityGate.GetList(Entity entity, Boolean returnFullEntities)
   --- End of inner exception stack trace ---

第二个(获取)

var cust = c.Get(new OzCustomer { Email = new StringValue { Value = "info@active-staffing.con" } });

returns 不同的错误

An unhandled exception of type 'System.ServiceModel.FaultException' occurred in mscorlib.dll
Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Api.ContractBased.MoreThanOneEntitySatisfiesTheConditionException: More than one entity satisfies the condition.
   at PX.Api.ContractBased.EntityService.Get(EntityGateBase gate, String version, String name, EntityImpl entity, Boolean returnFullEntity, PXGraph graph)
   at PX.Api.ContractBased.Soap.EntityGate.Get(Entity entity)
   --- End of inner exception stack trace ---

谁能告诉我们如何通过电子邮件地址搜索联系人并避免这些问题。

GetList中使用StringSearch代替StringValue:

var cust = c
  .GetList(
    new OzCustomer {
      Email = new StringSearch { Value = "info@active-staffing.con" }
    }, false)
  .Cast<OzCustomer>();