While working on a SuiteLet form, have you ever faced problem on setting the exact source ID of a List/Record field. If so, you are not alone. Most of us might have faced such situation. I personally have faced this several times.
Here is a small tip for you, so next time you won’t have to spend much time on retrieving source ID.
Here is the scenario.
Requirement: Create a SuiteLet Form which will include State, Country, Class and some other List/Record fields.
Code Sample to add fields to form:
var fldClass = form.addField({
id : ‘custpage_class’,
type : serverWidget.FieldType.SELECT,
label : ‘Class’,
source: <CLASS SOURCE ID>
});
var fldState = form.addField({
id : ‘custpage_state’,
type : serverWidget.FieldType.SELECT,
label : ‘State’,
source: <STATE SOURCE ID>
});
var fldState = form.addField({
id : ‘custpage_country’,
type : serverWidget.FieldType.SELECT,
label : ‘Country’,
source: <COUNTRY SOURCE ID>
});
Now here, what if we don’t know what’s the source ID. There is an easy way to get any of the List/Record source ID.
Step 1:
Go To Customization>List, Records & Fields > Transaction Body Field > New
On the New field record, select Type of the field as “List/Record”, and on List Record dropdown, select the desired List or record. Like here in this case, I will choose Class under List/Record dropdown as below:
nlapiGetFieldValue(“selectrecordtype”);
Once you click enter, it will return that source ID as below:
Hope this small tip will help you.
Happy Coding 🙂
Thank You
Ashabari Jena