客户通过电子邮件搜索

时间:2016-04-13 17:47:40

标签: acumatica

我们为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>();

返回此错误

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" } });

返回不同的错误

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 ---

有人可以告知我们如何通过电子邮件地址搜索联系人并避免这些问题。

1 个答案:

答案 0 :(得分:1)

StringSearch中使用StringValue代替GetList

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