TL;DR - Cannot access sublist (child records) usin...
# suitescript
j
TL;DR - Cannot access sublist (child records) using record.load with a role that only has view on both parent & child. I have two custom record types, let’s call them A and B. B is a child record of A. Both record types have an owner that is someone other than myself. I am testing with two roles, Admin and a custom role called “ROLE1”. ROLE1 has view on both A and B record types. When logged in with ROLE1 I can view records of type A and B. When viewing a record of type A I can see the sublist of B records on A. When I do a record.load of a record of type A in suitescript using ROLE1, the sublist is empty. What’s going on here? I need to be able to record.load and get the data from the sublist when using ROLE1. If I switch from “Use Permission List” to “No Permission Required” on record A, I can view the sublist using record.load and ROLE1.
😂 1
a
yeah it can be kinda icky, I'm never sure what I actually did to get stuff like that to work and once its working how I want i just stop messing with it 😄 do you have these boxes check on the parent and child?
💯 1
j
I don’t have ‘allow child record editing’ or ‘allow delete’ ticked on the parent as those are specific to when the record is displayed as a child on a parent. Record A is not a child for any record type.
note that it works fine as Admin, and it works fine in UI. It’s just that getLineCount() = 0 when using ROLE1 even though ROLE1 can see the child records just fine in the UI.
for obvious reasons I do not want to keep this as
No Permission Required
c
You should be able to do a search most likely and get the values that way. It makes sense that they aren't available for that role in a record.load because they don't have permission to edit which you COULD do in the scripting.
You can also have the script execute at a higher permission level so the users still have their permissions but the script executes differently.. just a few options
j
I need to do a record.load to get the children in the right order
(my other question in SuiteQL)
c
its all coming full circle
j
yup
c
Yeah no missing link table that I can find either. I can't get the child record's "linenumber" field through SQL either. I did some testing and I was able to source {linenumber} into a custom field on a child record and it looks like its the sublist line of the parent. Then you can do a search and order by that custom field to avoid the record.load(...) which is gonna give you the permission issues.
On the record creation page, "Records Are Ordered" does state that records show in alphabetical order in view mode whether you check the box or not. if you do not check it, then in edit mode, child records initially display in the order they were entered and later, in the order in which you have set them through editing.
j
yeah we need to be able to specify order in this case
c
Scratch what I said the sourced field isn't coming in through searches or SQL. You're gonna have to define a custom field and order them onSave in a client script and use that. Unless i'm just braindead and there's no other way but I'm not seeing it.
j
I really appreciate all the efforts BTW. At least I’m now fairly confident I’m not overlooking something obvious.
c
np all good