megaphone
Update your Profile with your Support type to get your Support Type badge.
Nominate Your Peers for NetSuite Support Community's Choice of the Quarter! Submit your nomination today.
Stay in the know of how NetSuite can help grow your business with our guides, webinars, and events. Subscribe Here
What Topic Should We Cover Next? Your idea could be our next feature—drop your suggestion now!
No Limits. Just possibilities. Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Discover what's next at SuiteConnect Tour 2026.
Try Intelligent Payment Automation – Fee Free For Your First Month For more information, visit this thread.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.

Discussions

Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.

How to add Purchase Order to a Record?

edited Dec 3, 2019 2:50PM in General 6 comments

Hello Guys,

How can we add Purchase Order to a certain Record?

I have this code below and its not working. I'm having an "Invalid entity reference key"

$customer_id = $this->input->post('internalID');
 
// create array of fields
$purchaseOrderFields = array (
    'entity'  => array ('internalId' => $customer_id),
    'itemList'  => array (
                'item' => array (
                    array('item' =>
                                                    array('internalId' => 116),
           'quantity' => 1)
                                                 )
                        )
);

// create purchase order record
$purchaseOrder = new nsComplexObject('PurchaseOrder');

// set fields
$purchaseOrder->setFields($purchaseOrderFields);

// this will create a purchase order with 1 line item
$addResponse = $myNSclient->add($purchaseOrder);

Can anyone help me figure out what's wrong with my codes? I really need your help guys. Thanks.

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!

Leaderboard

This Week's Leaders

This Month's Leaders

All Time Leaders