Hi. Everyone. I'm trying to get all fields from It...
# suitescript
c
Hi. Everyone. I'm trying to get all fields from Item Sublist on SO. This is my current script.
Copy code
let sublistFields = newRecord.getSublistFields({ sublistId: 'item'});

    curFieldsInfo[sublistId] = [];

    for (let sublistFieldId of sublistFields) {

        curFieldsInfo[sublistId].push(sublistFieldId);

    }
But, it returns so many fields and I want to get fields that appear on SO UI. Could anyone please help me?
a
you just want the item sublist fields? this nested loop is getting all fields for all sublists remove the outer loop and just use "item" instead of sublistId
Copy code
let sublistFields = newRecord.getSublistFields({   sublistId: 'item'});

curFieldsInfo.item = [];

for (let sublistFieldId of sublistFields) {
    curFieldsInfo[sublistId].push(sublistFieldId);
}
c
Actually, I'm trying to get all sublist fields, and I just edit it only for item sublist
a
that might not be your actual issue though... you're using the record, what you need is the form from the before load UE
c
This is part of Suitelet script
a
the record instance is going to have all the fields you dont want... if you want to get an instance with just what appears in the UI then you're going to need the UI somehow, either UE before load form, or somehow in the client context... I don't see how you can do that from a suitelet... it may be possible, I'm just not sure how of the top of my head
e
Why do you want to do this?
c
Well.. I'm going to make a customized SO using suitelet
@erictgrubaugh Do you have any soluiton?
a
you're using the suitelet to just generate a custom SO form?
c
Sure
a
why? 🙂 normally we'd just make custom forms using a ... custom form?
c
There is a special requirement 😁
a
I may not have enough info, but from what you have shared it feels like this is the wrong approach somehow, its probably easier to do this some other way
c
I need to control not only SO but also other transaction records
a
and this is to display in the NS UI? and the suitelet is internal? (not available without login)