RE: Is It Possible to Create Intercompany Sales Order From Intercompany Purchase Order via Scripting?

Is it possible to create Intercompany Sales Order via scripting AND not have to go to Manager Intercompany Sales Order screen to pair with Intercompany Purchase Order.

 

shujazakakhan Rookie Asked on September 16, 2019 in SuiteScript.
Add Comment
1 Answers

Yes, it’s possible. The script type depends on how you want to trigger it. You just have to use the APIs for creating a stand alone sales order using the values from the originating Purchase Order and add the following to your script, referencing the Purchase Order:


objRecord.setValue('intercotransaction',poId);

Beginner Answered on September 16, 2019.

This is not working getting below error

INVALID_FLD_VALUE16.09.2019 13:08:23.408 {“type”:”error.SuiteScriptError”,”name”:”INVALID_FLD_VALUE”,”message”:”You have entered an Invalid Field Value 202054 for the following field: intercotransaction”,”stack”:[“<anonymous>(N/record/recordService.js)”,”<anonymous>(adhoc$-1$debugger.user:7)”,”<anonymous>(adhoc$-1$debugger.user:1)”],”cause”:{“type”:”internal error”,”code”:”INVALID_FLD_VALUE”,”details”:”You have entered an Invalid Field Value 202054 for the following field: intercotransaction”,”userEvent”:null,”stackTrace”:[“<anonymous>(N/record/recordService.js)”,”<anonymous>(adhoc$-1$debugger.user:7)”,”<anonymous>(adhoc$-1$debugger.user:1)”],”notifyOff”:false},”id”:””,”notifyOff”:false,”userFacing”:false}

Code:

require([‘N/record’, ‘N/runtime’], function (record, runtime) {
var a = record.create({type: ‘salesorder’});
a.setValue({fieldId: ‘entity’, value: 50464});
a.setValue({fieldId: ‘currency’, value: 2});
a.setValue({fieldId: ‘intercotransaction’, value: 202054});
a.save({ignoreMandatoryFields: true, enableSourcing: true});
});

on September 16, 2019.

This could be due to multiple reasons. Check if this PO transaction is indeed eligible for creating an intercompany transaction for. You also have to make sure that the entity you’re setting is the intercompany entity of the Purchase Order. For more details, read SuiteAnswers ID: 20804.

on September 16, 2019.

Yes, the transaction is eligible as I can see that Transaction in Transactions > Sales > Manage Intercompany Sales Orders
The entity is intercompany as I already created Intercompany Sales Order using this entity from Transactions > Sales > Manage Intercompany Sales Orders

on September 16, 2019.

Same problem and same error here. Does anyone have a working example of creating an intercompany Sales Order from an intercompany Purchase Order via SuiteScript?

on December 17, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.