Hi, I have a suitelet and it does some operation o...
# suitescript
d
Hi, I have a suitelet and it does some operation on sales order what I want is to reload the same SO on which I do the operation after I call the suitelet through a button. how can we do that?
1
b
d
where do I have to write this location.reload()?
in UE or SL?
I tried it in SuiteLet but didn’t work
b
location is clientside
d
I’m not using any client script in this case
b
the button runs clientside
d
nope. I’ve added it on beforeLoad of UE
b
the code in the button still runs clientside
r
use N/redirect module and in POST you can use, i did it..it worked cool
Copy code
redirect.toRecord({ type: record.Type.TASK, id: taskRecordId, parameters: { 'custparam_test':'helloWorld' } });
d
let me try.
but in my suitelet I’m not submitting anything
r
refer this for using a UE button to connect to client to suitelet, and try as battk suggested Add a Button on the Employee Record That Will Generate a PDF via SuteScript 2.0 - below
d
Sure thanks for the help
hey it worked @razer456 thanks for this. I have one last question. Can we add delay in the reload time of the sales order. I mean when we click on the button the client is getting fired then suitelet is getting fired in this time the record is pushed to database and it comes back to client. The changes are not reflecting immediately.
r
if you talking about changes not reflecting immediately, i think thats related to netsuites performance.. if you want to add delay i am not sure
d
I see. I got something called as setTimeout() which adds delay in CL
r
yeah sure thats works
b
most of the client side apis have asynchronous versions which allow you to run code after the request is finished
you dont need to guess when the request is complete
d
Async would work better. With setTimeout() you run the risk of not allowing enough time for NetSuite to save the records or forcing the user to wait for a very long extended amount of time. Neither scenario is good.
d
cool I”ll try Async