Hi all, I have been working on the following issue...
# suitescript
j
Hi all, I have been working on the following issue for some time. Have searched the Slack to find a solution but haven't worked it out yet. Use case: As a Finance employee I want to update all open Sales Orders with a changed address of the Customer I succesfully added a: - User Event script that opens a Suitelet in a new tab containing all open sales orders of a specific customer - Suitelet that displays the Sales Orders of a customer in a list (note; not a form) and adds a button to update the Sales Orders with the newly added custom address - Client Script that runs on the Suitelet that acts on the submit button on the list, to do a post on the Suitelet to update the Sales Orders The issue is within getting the values from the generated list into the client script, so that I can do a post to the Suitelet with the specific Sales Orders from Customer X How should I get the values from the generated list, so that I can use it in the ClientScript? I have tried to use: currentRecord.get(); -> give undefined Thanks!
b
what does your client script's button look like
j
I am adding the button from the Suitelet The function that is configured in the addbutton is setup in the Client Script
b
and the code for the button
j
message has been deleted
I have tried to do some currentRecord.get etc.
b
currentRecord should be undefined in your function
your function has no parameter
j
function within my Suitelet?
b
your client script has a parameter
that is always undefined
buttons dont get parameters unless you hardcode a value in your functionName
j
Should I add it here? list.addButton({             id: "custpage_btn_updateaddresses",             label: "Update Sales Orders",             functionName: "updateSalesOrderAddresses(ADDPARAMHERE)"         });
b
you could put parameters in there if you want
none of them will get you the currentRecord since it doesnt exist yet
j
Is it the correct way on how to get it functionally working?
b
i personally expect you to be doomed in your approach
😬 1
you should have done a suitelet form
you can get the currentRecord by using N/currentRecord
probably wont be useful, but at least not be undefined
j
within my client script? I have tried this, but didn't work out either
b
that looks good, except only forms get entry points
so put the lines getting the currentRecord in your button
j
So, I should change my Suitelet script to generate a form instead of a list
?
b
i personally would say yes
j
then I would have the option to get value and put it in the post to the Suitelet
b
forms have native submit buttons
so you wouldnt have to
you can probably make your list attempt work if you abandon your attempt at trying to get the current values and just use whatever parameters you used in the url to generate the list
j
Ok, but when submitting I will instantly have the values within request
b
you have learned the least useful part of server widgets if you have not learned forms first
j
Ok, thanks. Will change my approach
b
the submit button from a server widget form represents the submit button of a html form
your suitelet will handle the form post of that button
j
Is it possible to show results from a search into a list and also show a form where I can do a submit? So combine two UI elements
b
you have to set your own values, no convenience methods
👍 1