so i have i suitelet i am triggering a client scri...
# suitescript
r
so i have i suitelet i am triggering a client script on a button then i use
Copy code
var record = currentRecord.get();
and i have a sublist created
Copy code
var sublist = form.addSublist({
                   id:'custpage_selectsalesorder' ,
                   label: 'Select SO to print',
                   type:  serverWidget.SublistType.LIST
               })
then on 'BUTTON' click i run a saved search and i just want the results in the sublist... how do i go into it? how do i set the value of sublist .... its SUBLIST TYPE IS LIST
Copy code
record.setCurrentSublistValue({
        sublistId: 'custpage_selectsalesorder',
        fieldId: 'date',        
       value: expectedshipdate,
     });
OR
Copy code
record.setSublistValue({
        sublistId: 'custpage_selectsalesorder',
        fieldId: 'date',        
       line: i,
       value: expectedshipdate,
     });
b
r
yes i know i tried both ways ..but i want to display it is list so
b
read the entire page
r
i did, but it says record.setSublistValue is not a function i dont get it .. i have updated the display type to entry
b
r
client
suitelet
i just dont know what to do anymore.. i dont understand where am i going wrong ? i changed and updated
i tried both ways
a
My recommendations: • Start with a simple Suitelet, make sure you understand correctly how method GET and POST works for a Suitelet. Make sure you understand how the Submit button works. • Create some body fields and see how you get those values when the submit button is clicked. • Then create a Sublist and see how you get those values when the form is submitted(Submit button). • Then review different Sublist types, LIST, STATICLIST(this is the one that creates pagination automatically) but it would not be submitted with the form the same way a regular SUBLIST will do.
b
i will once again emphasize reading the documentation for serverWidget.SublistType. Neither version of your code will work
r
@alien4u i have two buttons
submit
and
search
and i want to update the sublist on
search
button click and then when i whether click the print on each line (that i have provided) ... i click the
submit
button which creates the advanced PDF for which i am yet to write the full logic..for which i have to GET the value from the search first successfully
@battk okay, if i use
Copy code
serverWidget.SublistType.LIST
and if add an internalId field with the
Copy code
internalId.updateDisplayType({displayType: serverWidget.FieldDisplayType.ENTRY});

record.selectNewLine("custpage_selectsalesorder");

record.setCurrentSublistValue(
          "custpage_selectsalesorder",
          "internalId",
          internalid
        );

record.commitLine("custpage_selectsalesorder");
this should work right?
but it isnt
i dont understand what to use i dont want a INLINEEDITOR i want a LIST and i want to update its result from the saved search... just display and then when at line level when print checkbox is checkbox is checked ..print the advanced pdf in POST
b
is your code trying to add lines to your sublist
r
Yes
b
what does the documentation for serverWidget.SublistType say about that
r
Untitled
no thats not it... i get what you are saying .. but
refer to above ..this works on suitelet but when i try through client script its not working
b
you are trying to do something that the documentation says you cant do
dont be surprised when no matter what you try, nothing works
r
i guess then i have to call another suitelet from the client script
and update my suitelet?
is there any other way around this?
b
suitelet forms are not known for being dynamic
best you can do using suitescript is submit the form and return a new form
theoretically there is a refresh button, ive never found a practical use for it
dont expect suitelet forms to be able to do what you want dont expect the code you use serverside to be the same as clientside
they do a very specific limited thing
anything that goes beyond that means you probably want to use an actual javascript library for building your ui
r
is it not possible to update the suitelet?
i see , have you ever tried it?
b
just like the documentation says, you cant add new lines to your sublist
you can update existing lines
e
I've run across this same issue where the sublist is defined server-side on the suitelet and then you want/need to manipulate the sublist you created on the server-side suitelet but there is no way to do it on the client script using the same code on the suitelet. You'll need to manipulate the table that represents the sublist using DOM objects.
Start with this construct to access your sublist table...
b
I have done something similar 1. Create the form and add required button using Suitelet, which you have 2. Link the client script to the Suitelet, which you have 3. Create the sublist of type
INLINEEDITOR
and change the display type of all the fields which you don’t want to be edited to
DISABLED
. 4. On the client script, when the button is clicked, perform the saved search and list them on the sublist using
.selectNewLine
and
.setCurrentSublistValue
. I have done something similar with sublist type
LIST
on POST require to the Suitelet. You repeat everything on the GET request along with addition of the sublist rows. I used
.setSublistValue
for this. With this, you can also add inlinehtml to print pdfs or do whatever you want from each sublist row.