如何向Acumatica系统提交多选属性的取值
Acumatica 多选属性提交问题
我在本站及Acumatica官方示例代码中均未找到提交多选属性取值的相关参考:单值属性可正常提交,但多选属性始终无法正确上传。接口返回的多选属性值为逗号分隔的字符串格式,但直接按该格式提交无法生效;将每个选项拆分为多个单值条目提交的方式也无效,仅最后一个选项会被赋值。
以下是我已尝试的代码(实际运行时列表中还包含其他可正常提交的单值属性,单值逻辑无问题):
- 第一种提交方式
// 该写法执行后多选属性没有任何赋值 string interestedIn = "Brochure, Contact, Collecting small stones"; List<Acumatica.AttributeDetail> attributes = new List<Acumatica.AttributeDetail>(); attributes.Add( new Acumatica.AttributeDetail { Attribute = new Acumatica.StringValue { Value = "Interested in" }, Value = new Acumatica.StringValue { Value = interestIn } } ); custAdd.Attributes = attributes.ToArray();
- 第二种提交方式
// 该写法执行后只有列表中的最后一项会被赋值给属性 string interestedIn = "Brochure, Contact, Collecting small stones"; List<Acumatica.AttributeDetail> attributes = new List<Acumatica.AttributeDetail>(); string[] interests = Convert.ToString(interestedIn).Split(','); foreach (string interest in interests) { attributes.Add( new Acumatica.AttributeDetail { Attribute = new Acumatica.StringValue { Value = "Interested in" }, Value = new Acumatica.StringValue { Value = interest.Trim() } } ); }; custAdd.Attributes = attributes.ToArray();
内容的提问来源于stack exchange,提问作者CSX321
相关产品推荐
相关产品推荐

