I am having a dumb moment. I have a custom record...
# suitescript
j
I am having a dumb moment. I have a custom record (let’s call it a) with a sublist of another custom record (b). B is set up properly with a field of type A set as the parent. The sublist appears properly when I view a record of type A. I’m trying to run a custom wf action when a record of type A is created that creates some records of type B. This is happening on beforeSubmit in create. I am getting the error
You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.
when I call
record.selectNewLine()
I have confirmed that the record A is in dynamic mode and that the sublist_id value is correct.
ALLOW CHILD RECORD EDITING
is ticked on the config of B. If I try to do this in the browser console it seems fine (e.g.
record.create()
followed by
record.selectNewLine()
I don’t know if this makes a difference, but the record is created using an Online form.
a
have you tried to create new custom record Bs with the value of A set instead of create lines of A?
I have a similar setup in one of my suiteapps.. and i just ran a search on the entire code base... I don't do a single
commitLine
or
selectNewLine
anywhere with the line records
I dont remember specifically running into that issue and coding around it either though so... who knows?
oh wait... you said on create before submit so you don't have an internal id of record A to set on your record B 😕
j
correct
I’ve confirmed that if I create the record A through the UI, the record Bs create via workflow with no issue. So this does seem to be related to the fact that the record A is created via Online Form instead. Sigh.
a
😞 that's not good, and I'm guessing you can't just move this to a UE?
to do it standard mode rather than dynamic...cos the form shouldn't matter there
j
I’ll test in UE. Not sure if that behaves differently with onlineform also.
I need to be cautious with the order as there are other things that happen upon save that will rely on the values in the sublist.
a
right.. I guess what I'm really meaning is aftersubmit so you can do your own record.load, but if the order matters that won't help
other option would be a client script? but Im not familiar with online forms maybe that's gonna have the same issues.
j
well there won’t BE a client script cuz….not loading in online form.
(at least not a normal client script)
a
huh? there's a custom code tab on the form still on online forms? you can just add it there no?
there's no script record/deployment then though
j
that can’t be used to add child record though
it’s kinda more like vanilla JS in there
a
maybe I'm overthinking this... on create before submit UE the context.old context.new records are IN standard mode, so that shouldn't care about the form at all, its executing on the record not the form
which should mean whatever nonsense its saying about the sublist being static should be moot
j
stupid standard mode
still testing here
👍 1
welp “You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.” on record.insertLine
will wait to see how support responds to my ticket HAHHAH
thanks for your suggestions!
a
Parent or Child or both, must have a checkbox checked Allow Child Record editing… that will allow child records creation via a sublist operation.
j
Yes, I already have that as mentioned above. Adding the child records via this workflow action works as expected when the record is created and saved through the regular UI. It’s failing when created via the online form being submitted.