I'm working on a suitelet to allow my purchaser to...
# suitescript
e
I'm working on a suitelet to allow my purchaser to select some items off a list and Start a purchase order Is is possible to redirect them to a New Purchase Order screen but also fill in items/quantities on it? This is opposed to creating the PO via script, saving it, and then redirecting them to that saved PO in edit mode Wanting to do this so that approval emails don't get sent out until the purchaser looks over the PO and save it
s
You can pass some param(s) in the URL and have a pageInit client script read from the params.
Copy code
url.resolveRecord({
 recordType: orderType,
 recordId: null,
 isEditMode: true,
 params: {
  someParameterName: someValue
 }
});
you can use something like this for your URL that you are redirecting to from the suitelet
e
That makes sense. What do you think the best way to handle passing in params like so?
[{itemId: 12345, quantity: 1},{itemId: 5555, quantity: 5}]
Can I JSON.stringify that and pass it in as a param then JSON.parse it in the pageInit to get it back to an object?
s
Sounds like a resonable approach to me
e
🍻
c
Since you are controlling the re-direct to the PO, you can pass whatever params that you want in the URL. NetSuite may not pick them up but you can read them off of the window object and just use them. No need to send any JSON.
s
I believe he wants to send an array of objects as the parameter, which is why he was suggesting to perhaps stringify it first, but the url.resolveScript method might stringify your object for you