hi everyone, I asked this a couple of days ago and...
# suitescript
k
hi everyone, I asked this a couple of days ago and didnt hear anything, so giving it a shot one more time, is it possible to pull a list of addressbook via a suitelet to present it as a dropdown in a sublist? and a followup question to that, is it possible to let users add a new addressbook from the above mentioned dropdown? thank you!
b
you can get a list of all address books, which is generally useless
you will have better luck building your own select options
k
thank you for the response @battk! if i create my own select options, i still need to access all of those addressbook right, and convert them into my selection option values?
b
usually for these sort of things you want the address book of a specific entity
you can do a search for them or load the record
if you plan on adding an address book, you might as well load the record
outside the scope of safe suitescript is using a new window to add address books to the entity like how netsuite does it on transactions
that would be a last resort
its much safer to add address related fields to your suitelet and use those to create addresses on your entity
k
right, I am trying to access the list of address book for a customer in a suitelet. what I am struggling is 1. to present this list of address book as a dropdown in the suitelet, sublist field, and 2. to add a feature, like the New value in a dropdown in NS UI, to let them add a new address book to the list. what is the best way to achieve this?
b
do you know which customer on the get to the suitelet
or is the customer a select field chosen on the form return by the suitelet
k
users enter their sales order number in the suitelet, from there we can identify customer as well as other info
b
my advice here would be to add client script to the suitelet form via Form.clientScriptModulePath
use Field.insertSelectOption to add select options to your field after the customer is chosen
add fields to your form to allow your user to enter in new address information
use the submit button for your suitelet to receive that information and modify the customer as necessary
you may be able to do it client side with a custom button, especially if there are no permission issues
s
you could also create a cs from clientScriptModulePath pass some params say when you hit a button, it'll grab which sales order, and work serverside on the suitelet post request to insert the select options of the field. I generally think this way is safer, but i think permissions aside both ways work battk's way will work better for sure if your suitelet if the role permissions are very well defined
k
right, my concern is, lets say the user is selecting addresses in the sublist, after selecting couple of addresses in the sublist (couple of lines in the sublist), the user wants to add a new address, at this time, I can direct the user to a new form to add a new address, how can I ensure that the address the user selected in the sublist is stored, so that once the user is done adding a new address, the user can resume selecting addresses including the new one just created?
also, will this solution be viable for a external suitelet?
b
an external suitelet that exposes address information sounds terrible
k
that is not the solution i am trying to go with, but I am just thinking options. how about external suitelet embedded in a secure site?
b
that doesnt help you, the external suitelet and the secure site dont share the same securing mechanisms
unless you have an unusual level of integration, your suitelet has no way of telling if a user is logged into your secure site or not
k
we will probably have a different web form integrated with a restlet for external use, i was just exploring my options!
what do you think about the other question regarding being sublist still holding the value, while users enter new address?
b
do it how netsuite does it
open a new window to a suitelet that allows you to add addresses
when done, have the new window communicate that new address to Window.parent
k
awesome, thank you so much! this is what I needed! 🙂