[Solved] Hi, I would like to create an button that...
# suitescript
d
[Solved] Hi, I would like to create an button that takes the user to the create journal page, and i would like to prefil some of the fields. What would be a good approach to achieve this? I am currently thinking that a client script that is conditionally executed.
d
If you need a button in Edit mode only, the client script will fit. For View mode use UserEvent beforeLoad and
Copy code
context.form.addButton
function
d
Ah, the button will be in another context and send the user to the new journal page.
d
So basically my point is that you cannot use client scripts for View mode.
๐Ÿ‘ 1
d
Okey, thatโ€™s unfortunate. Is there any other mechanic that allows you to programmatically prefill a form for a user?
d
Oh yes, for that you can use another script (client) that will look for new JE records creation and prefill values.
p
The way to do the clientscript to pre-fill on the journal would be to redirect to a new journal page URL with a parameter, then check in the clientscript to see if the parameter has been set & fill accordingly
d
Thanks for the pointer guys, managed to set a few fields.
n
You can also prefill fields by doing this: https://*.app.netsuite.com/app/common/entity/custjob.nl?stage=lead&whence=&record.comments=test This is just an example but would prefill the comments field with the text "test", not sure this helps you though ๐Ÿ™‚
๐Ÿ‘ 1
๐Ÿ˜ฒ 1