有没有办法使用套件脚本创建矩阵项?

时间:2015-02-02 13:57:06

标签: netsuite

基本上我的要求是通过脚本创建一个矩阵项。我想知道是否有任何方法可以通过Restlet或任何工作流创建矩阵项。我成功创建了具有一些特定属性的父项,但似乎在提交记录后没有创建子项。

Bellow是我现在正在使用的代码片段。

var record= nlapiCreateRecord('serviceitem');
record.setFieldValue('name', 'Matrix Parent Record');
record.setFieldValue('matrixtype', 'PARENT');
record.setFieldValue('custitem_matrix_op1', '2');
record.setFieldValue('custitem_matrix_op2', '3');
var id=nlapiSubmitRecord(record);

任何帮助或建议将不胜感激。 谢谢。

3 个答案:

答案 0 :(得分:1)

小例子:



var parent = nlapiCreateRecord('noninventoryitem');
parent.setFieldValue('matrixtype', 'PARENT');
parent.setFieldValue('itemid', 'zzz ttt');
parent.setFieldValue('subsidiary', 2);// internalid for subs.
parent.setFieldValue('taxschedule', 4);// internalid for N/A in my account
parent.setFieldValues('itemoptions', ['CUSTCOL_LLL_EVENTLOCATION_OPT']);//option to be shown at PDP
parent.setFieldValue('custitem_event_location', 11);// particular option id (see in your list)
var parentid = nlapiSubmitRecord(parent);

var child = nlapiCreateRecord('noninventoryitem');
child.setFieldValue('matrixtype', 'CHILD');
child.setFieldValue('parent', parentid);
child.setFieldValue('itemid', 'zzz ttt child');
child.setFieldValue('taxschedule', 4);// internalid for N/A in my account
child.setFieldValues('itemoptions', ['CUSTCOL_LLL_EVENTLOCATION_OPT']);// same as in parent record
child.setFieldValue('matrixoptioncustitem_event_location', 11);// same as in parent record
var childid = nlapiSubmitRecord(child );




它将创建一个包含一个子项的矩阵。 不要忘记设置其他字段,如价格和"显示在网上商店" (isonline field)。

答案 1 :(得分:0)

创建父项后,您还需要创建子项,在子项中设置父项内部ID&提交记录。

但这里有一个缺点。由于静态子列表,我无法将子项附加到Matrix子列表中的父项。

答案 2 :(得分:0)

使用Suite Talk,你可以做这样的事情

loginButton.setReadPermissions(Arrays.asList("public_profile", "email", "..."));
相关问题