So, I need to solve a problem, and hopefully there...
# suitescript
s
So, I need to solve a problem, and hopefully there is a supported way to do it. We are using SuiteBilling, and have two custom fields on the Subscription Line record type. The problem is that those fields only show in the list under the Subscription record in View mode. In Create/Edit mode, the custom fields are not there, so we can't set them. This forces us to save the Subscription, then go into every Subscription Line individually to set those two fields. The View mode sublist can be customized using a saved search, but I see no way to customize the list in edit or create mode. Is it possible to add those fields in via a script (Client or UE) and have them saved along with the Subscription? Can sublist fields not shown by default be added at all through SuiteScript?
e
I have not tested this in your specific scenario but in a before load UE, I have been able to hide some fields from a sublist using:
context.form.getSublist('salesteam').getField('contribution').updateDisplayType({ displayType: serverWidget.FieldDisplayType.HIDDEN });
instead of using .HIDDEN, you can try using .NORMAL. Let me know if this works. I would try using this as well:
Copy code
sublist.addField
Probably if you set the internalid that already exist, it just add the desired fields as if you were adding/applying to the form,
s
Thanks. I'll try that!
👌 1
Ah, well I found out one thing.
sublist.addField
will only let me specify field ids that start with
custpage
(anything else throws an error), which means I can't specify the id of existing sublist fields. I'll try to see if I can get the fields and modify the display type instead.
and, if I use
sublist.getField('my_custom_field_id')
then try to call
.updateDisplayType({ displayType: serverWidget.FieldDisplayType.NORMAL })
, I get
ReferenceError: Empty invocation target!
e
I see, sad news. I am not familiar with SuiteBilling, could you create your own form? So, if the fields do not exist in create/edit mode, does it mean they are sourced from other record/fields in view mode?
s
They aren't sourced in, rather, Subscription records have a sublist of Lines (record type = Subscription Line). The sublist is strangely named
priceinterval
. I added two new custom fields to Subscription Line record type, but the priceinterval sublist on Subscription shows a fixed set of fields in Create/Edit mode, and new custom fields added to Subscription Line don't display there. Even trying to modify the Subscription form doesn't help, the Line sublist fields can't be changed. In view mode, you can customize the sublist, so the custom fields can be shown. Which is frustrating since as soon as the user clicks Edit, those fields disappear.
netsuite 1