How to get items in a custom list using SuiteTalk - netsuite

I want to set the value of a custom customer field. The field type is List/Record and the value must be from a custom list.
I believe I have to set the value to the internal ID value of the custom list item. The items look like this:
Am I right that I have to use the ID value? Instead could I set the customer field to the Value value?
Assuming that I have to set the customer field to the ID value, I want to load all the items into memory and then look up the ID by the Value, like this:
The problem is that I cannot work out how to download the items using SuiteTalk. I can use CustomListSearchBasic to get the custom list record:
But I can't seem to get the items in the custom list.
Please can you help? Also, I'd be delighted to know how to work this out for myself. The schema browser didn't help.

I worked it out. I needed to set searchPreferences.bodyFieldsOnly = false

Related

sorting list of items with specific field on sales order item sublist NetSuite

I like to sort the list of items in the dropdown in the standard NetSuite sublist item. Let's say items are sorted with the name when clicked on >> to open the dropdown list.
Is this possible to sort this list with any other fields, maybe a custom field on items record. let's say I add a custom field on the item record (every item), which is some numbers.
displaying that list with the order by that field.
I have seen a way around to create a custom sublist of my own requirement and then hide the standard and show the custom on a specific record by customizing the form.
I had a similar issue once, I did the following:
You can create a new body field or sublist field based on your business using userevent script(before load).
Create a search with the required order(you can do any operation to prepare your data) after that you filled the result manually to the new custom field.
Whenever the user selects a value in the custom field you set the original one to be the same as the custom one. For this one, you will need a client script.
Note: you can show your custom field and hide or disable the original field only not the whole list since the client script will be responsible to set the value to it. using this approach will not require you to add or edit any of your records which will be helpful if you have a complex process and a lot of dependencies. This approach worked for my issue I hope to be helpful to you too.

how to enable custom list internal id in Netsuite

NetSuite custom list internal id for values is disabled by default. is there a way i can add my own id for the custom list values.
i am trying to create a custom record to save expense clain details for employee. i have many list to hold datas for diffrent category. it will be better insted of 1,2,3 i can give my own Internal id.
Brett's answer gives you a method by which you can change the text ID of the list, but you cannot change the internal ID of the list's values. This id is set automatically by NetSuite (or probably the underlying database) and is needed to ensure consistency of data within the application. Instead, consider converting the list into a custom record, which will allow you to create another field to use as an external ID, which you can add/update by CSV import (you need to use the Internal ID as key when doing this).
Once converted to a record, you could also add a new field to use as a reference, depending on how you're using it.
To convert to a record, simply check the Convert to Custom Record box on the list page shown in your screenshot and click Save.
Click the “Change Id” button
Enter the new value.
Click Save
Note: Netsuite will prefix the value you enter with ‘customlist’

how to get the List/Record type script parameter's text value in netsuite

I am setting a List/Record type script parameter and Select one value (Display name: Sample Company, Id: 5) as a default. I'm using
nlapiGetContext().getSetting('SCRIPT','custscript_my_parameter');
to get the value. it returns the id(in my case 5) of the List/Record. But I need the display name(in my case Sample Company) of the List/Record. Anyone, Please advice to get it.
Thanks in advance.
Why don't you create another script parameter of type Free-Form Text and set the display value for the field to retrieve on the other side. You could use something like below
nlapiGetContext().getSetting('SCRIPT','custscript_my_parameter_text');
Otherwise if you want to get the display value with the id you have then, you probably need to load the record and get the company name(text).
Looking over the documentation of nlobjContext#getSetting, I do not see a way for you to get the text value of the select field. It looks like you will need to retrieve the ID from the script setting, then perform an nlapiLookupField on the appropriate record to retrieve the appropriate text value.

Get select options for a field in a sublist within a Netsuite client script

How does one get the select options for a dropdown in a sublist, using a client script? I'm looking to get the values of the dropdown in the screenshot.
Any help would be greatly appreciated!
Use nlapiGetField('website') (or whatever the ID of that column field is) to retrieve the nlobjField for the dropdown, then call the getSelectOptions() method on the field object, like so:
var fieldOptions = nlapiGetField('website').getSelectOptions();
I looked up the values in the DB, and set the field to the record ID I wanted. It's not ideal, but it solved my issue.

string;# in dropdownlist

I made a custom dropdownfield. I want to display the full names of my contacts. I made a calculated column because not every user filled in their full name, only first and last. If I wanna show the items in my dropdown there is always string;# before my value. Does somebody know how to remove that?
Here is the code where i fill my dropdown
SPWeb web = site.OpenWeb();
SPDataSource dataSource = new SPDataSource();
dataSource.List = web.Lists["Contacts"];
this.testing.DataSource = dataSource;
this.testing.DataTextField = "Full Name";
this.testing.DataValueField = "Full Name";
this.testing.DataBind();
thx
The field type is probably "User" (I think shows as "People" in the UI). This and other lookup fields are always stored by SharePoint in this manner. The value component is the user ID and the string component is the user name.
You could use a Regex to split the components. You can also cast the value to SPFieldUserValue which is the 'proper' way, and use the properties on that class to retrieve info.
Assuming full name is a text field, it looks like you have an error in your calculated column definition related to one of your inputs being a lookup field.
If you can't get rid of it in a cleaner way, there's always substr (or maybe right, I can never remember the syntax for excel functions)

Resources