0

I am having great difficulty in creating a Sales Order using NetSuite’s REST API:

my @items;
my $it={
        'item'=>{
        'id'=>'55554',
    },
    'quantity'=>1,
    'amount'=>100.0,
    'taxAmount'=>20.0,
};
push @items,$it;    
my $pp={
        'entity'=>{
        'id’=>’12345'
    },
    'otherrefnum'=>'999999999',
    'memo'=>'This is a test order - please IGNORE',
    'exchangeRate'=>1.00,
    'location'=>{
        'id'=>7,
    },
    'item'=>{
        'items'=>[@items]
    },
    'currency'=>{
        'id'=>'1'
    },
    'subtotal'=>100.00,
    'taxTotal'=>20.00,
    'total'=>120.00,
};
my $rslt=ns_call('/services/rest/record/v1/salesOrder',$pp,'','POST');

I’m always getting 'detail' => 'Error while accessing a resource. You have entered an Invalid Field Value 1 for the following field: currency.'

If I remove the currency declaration it says it needs a currency record.

Otherwise I’m able to PATCH any existing Sales Order and generally call the REST API without any problems.What am I missing for inserting a Sales Order?

Anyone got any ideas?

  • Solved! The entity->id value needs to be the customer->id, not the customer->entityid. D'oh! Pretty bad error reporting on behalf of the api though. – silversquonk Mar 13 '23 at 15:45

0 Answers0