Hello, I have a pageinit function that won't set t...
# suitescript
p
Hello, I have a pageinit function that won't set the values of the first line added to a purchase order. do you know how I can adjust this function to populate the first line? I added a record.selectLine function
p
Can’t help you unless you post your code
p
fieldchangedpi.js
there is the code
b
You have some weird code
p
can you not line init with the first line?
b
rec.getCurrentSublistValue and rec.setCurrentSublistValue dont use line numbers
p
ok I got that fixed
I can't get lineinit to work on the first line
b
New code?
p
fieldchangedpi.js
c
you can't access that first line
its a netsuite limitation
once there's a line committed it'll work though but until something exists on that first line, you can't do anything to it
p
do I have to put the function in a fieldchanged?
to get the first line to set?
c
thats what i've done in the past
like if item === xyz, do something to the field i wanted to mess with initially
a
@creece @Phillip You should be able to do another tricky stuff it may not be elegant but would do what you need, you can try two different solutions: • In your pageInit function if the event is Create(meaning new record) always remove the first line(0), then your lineInit would be triggered with a new line(the first) one is initialized. • Fill the frist line ONLY from your pageInit function, subsequent lines would be filled with your lineInit function.
p
is there a way to do this with fieldchanged?
to set the values
nevermind
I like your first option @alien4u
thank you