如何使用 StringCustomFieldRef 值的列表名称而不是 internalID 来调用 NetSuite SuiteTalk inventoryitem add?

How do I call NetSuite SuiteTalk inventoryitem add using list name for StringCustomFieldRef value instead of internalID?

通过 API 添加新的库存项目时,我们需要填写一些基于列表的自定义字段。我希望能够为该字段使用字符串值,但是当我尝试调用错误。

我们有一个包含两个值的自定义列表: InternalId 1 是 "LTL" InternalId 2 是 "FedEx"

我尝试将值作为 StringCustomFieldRef 发送,当将该值设置为 "LTL" 的字符串值时,我们收到无效引用错误。将值设置为 1 的 internalId 时有效。

我还尝试使用 SelectCustomFieldRef,当将 value->name 设置为 "LTL" 的字符串值时,它会出错,就像我们根本没有传递该值一样。当我们将 value->internalId 设置为 1 时,它起作用了。

是否可以只传入字符串值?

无效:

                $customField1 = new StringCustomFieldRef();
                $customField1 ->value = "LTL";
                $customField1 ->scriptId = 'custitem_zu_zu_fulfill_pref';

作品:

                $customField1 = new StringCustomFieldRef();
                $customField1 ->value = "1";
                $customField1 ->scriptId = 'custitem_zu_zu_fulfill_pref';

这是错误响应:

<platformCore:statusDetail type="ERROR">
    <platformCore:code>INVALID_KEY_OR_REF</platformCore:code>
    <platformCore:message>Invalid custitem_zu_zu_fulfill_pref reference key LTL.</platformCore:message>
</platformCore:statusDetail>

不,很遗憾,您不能设置具有 Name 值的字段——您将不得不使用 internalId。如果您的自定义字段是基于列表的,那么您应该使用 SelectCustomFieldRefMultiSelectCustomFieldRef.

如果您希望使用 Name 值,您可以执行 CustomListSearchBasic 以获得每个项目的 NameinternalId,并将其与您的匹配选择的名称。