脚本宝典收集整理的这篇文章主要介绍了php – Netsuite:如何将自定义字段附加到销售订单,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在整个项目的任何一点,它都是追踪和错误,并试图理解一切,直到东西开始工作.
我很难将自定义字段分配给销售订单,我知道它必须是对象的对象的对象,以便它能够将XMl分层以便肥皂接管但是什么与什么有什么关系?
我有一些我工作的代码,但它正在抱怨它不是正确的RecordRef类型.如果有人和Netsuite一起工作并且感觉到我的痛苦,请在我拔掉所有头发之前把你的知识借给我.
提前致谢.
码:
$customFields = array('internalId' => 'custbody_new_die_yn','value' => array('name' => 'custbody_new_die_yn','internalId' => 'NO')); $customObject = new nsComplexObject("SelectCustomFieldRef"); $customObject->setFields($customFields); $salesOrderFields = array( 'entity' => new nsRecordRef(array('internalId' => $userId)),'paymentMethod' => array('internalId' => 8),'ccNumber' => 4111111111111111,'ccExpiredate' => date("c",mktime(0,11,1,2011)),'ccName' => 'test Testerson','iteMList' => array( 'item' => array( 'item' => array('internalId' => 5963),'quantity' => 5 ) ),'department' => new nsRecordRef(array('internalId' => 1)),'class' => new nsRecordRef(array('internalId' => 47)),'customFieldList' => $customObject );
NetSuite帮助中心提供了大量关于这些内容的文档 – 绝不是每个人都需要的,而是一个良好的开端. Netsuite Help Center
在Ids& amp;上查看SuiteFlex / SuiteTalk(Web服务)部分.引用.
Using Internal Ids,External Ids,and References
有了这个说我会尝试帮助.net示例&将自定义字段添加到销售订单的说明.
以下是添加不同CustomFieldRefs的几个示例:
//A list object to Store all the customFieldRefs List<CustomFieldRef> oCustomFieldRefList = new List<CustomFieldRef>(); //List or Record TyPE reference SelectCustomFieldRef custbody_XXX_freight_terms = new SelectCustomFieldRef(); custbody_XXX_freight_terms.internalId = "custbody_XXX_freight_terms"; ListOrRecordRef oFreightTermsRecordRef = new ListOrRecordRef(); oFreightTermsRecordRef.internalId = <internalId of specific record in Netsuite>; //See the References link above for more info on this - trying to figure out typeId caused me a lot of pain. oFreightTermsRecordRef.typeId = <internalId of the List Record Type in Netsuite>; custbody_XXX_freight_terms.value = oFreightTermsRecordRef; oCustomFieldRefList.Add(custbody_XXX_freight_terms); //Freeform text sorta field StringCustomFieldRef objStringCustomFieldRef = new StringCustomFieldRef(); objStringCustomFieldRef.internalId = "custbody_XXX_tracking_link"; objStringCustomFieldRef.value = "StringValue"; oCustomFieldRefList.Add(objStringCustomFieldRef); //CheckBox field type BooleanCustomFieldRef custbody_XXX_if_fulfilled = new BooleanCustomFieldRef(); custbody_XXX_if_fulfilled.internalId = "custbody_XXX_if_fulfilled"; custbody_XXX_if_fulfilled.value = true; oCustomFieldRefList.Add(custbody_XXX_if_fulfilled); //By far the most complicated example a multi-select list referencing other records in Netsuite MultiSelectCustomFieldRef custrecord_XXX_transaction_link = new MultiSelectCustomFieldRef(); //internal id of field you are updating custrecord_XXX_transaction_link.internalId = "custrecord_XXX_transaction_link"; List<ListOrRecordRef> oListOrRecordRefList = new List<ListOrRecordRef>(); ListOrRecordRef oListOrRecordRefItemFulfillment = new ListOrRecordRef(); oListOrRecordRefItemFulfillment.name = "Item Fulfillment"; oListOrRecordRefItemFulfillment.internalId = <ItemFulfillmentInternalId>; //Item Fulfillment is record type (Transaction -30) - this is From the above Reference links oListOrRecordRefItemFulfillment.typeId = "-30"; oListOrRecordRefList.Add(oListOrRecordRefItemFulfillment); ListOrRecordRef oListOrRecordRefSalesOrder = new ListOrRecordRef(); oListOrRecordRefSalesOrder.name = "Sales Order"; oListOrRecordRefSalesOrder.internalId = <SalesOrderInternalId>; //Sales Order is record type (Transaction -30) - this is from the above Reference links oListOrRecordRefSalesOrder.typeId = "-30"; oListOrRecordRefList.Add(oListOrRecordRefSalesOrder); //Add array of all the ListOrRecordRefs to the MultiSelectCustomFieldRef custrecord_XXX_transaction_link.value = oListOrRecordRefList.ToArray(); oCustomFieldRefList.Add(custrecord_XXX_transaction_link); //And then add all these to the Custom Record List (Array) on the Sales Order Record objSalesOrder.customFieldList = oCustomFieldRefList.ToArray();
从我在上面的例子中可以看出,我认为你的问题是ListOrRecordRef typeId.很难从你的例子中看出你引用的是什么typeId,但如果你能解决这个问题并在SelectCustomFieldRef上设置TypeId,我认为应该解决你的问题.
以上是脚本宝典为你收集整理的php – Netsuite:如何将自定义字段附加到销售订单全部内容,希望文章能够帮你解决php – Netsuite:如何将自定义字段附加到销售订单所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。