Does anyone know if there is a way to break down t...
# general
k
Does anyone know if there is a way to break down the items field in NetSuite so that the two broken down fields are depenedent now? So, for example, right now my items fields has items like Mcdonalds Burger, Mcdonalds Nuggets, Mcdonalds Coffee, Burger King Fries, Burger King Sandwich, Burger King Soda. This Items list is enormous. What I would like to do is when users select items, they first select Mcdonalds or Burger King from the first drop down field, then based on what they selected, the second drop down would only show items related to the first drop down item. The base price, description, etc. will be linked with the item from the second drop down. I am not sure if I made it clear to you. NetSuite seems to be very restriced to what they allow to do you with the Items list/field.
🍟 2
👀 1
j
Here’s how I would achieve this. You will need to add two custom Transaction Line Fields. One will be your main drop-down, in my example I will make it type “List/Record -> Class” and call it “Testing Master Class”. The second will be type “List/Record -> Item” and will be called “Testing Item”. When setting up this field, you will need to add a filter to ensure that the Class matches what’s selected in the first custom field you added:
😁 1
message has been deleted
Then, customise your Transaction Form and move these two fields to the left hand side of the Items Sublist. You’ll then need a Custom Form script (client script) that will have a FieldChanged function to make the built-in “Item” field automatically update when your custom “Testing Item” field changes. Here is some sample code (not tested but you get the idea):
Copy code
// SS1.0:


function FieldChanged(type, name) {

	if(name == 'custcol_testing_item') {

		nlapiSetCurrentLineItemValue('item', 'item', nlapiGetCurrentLineItemValue('item', 'custcol_testing_item'));

	}

}

// SS2.0:

function FieldChanged(context) {
    	
	var rec = context.currentRecord;

    	var field = context.fieldId;

	if(field == 'custcol_testing_item') {

		rec.setCurrentSublistValue({sublistId: 'item', fieldId: 'item', value: rec.getCurrentSublistValue({sublistId: 'item', fieldId: field})});

	}

}
message has been deleted
I’m not sure how exactly you are definining “based on what they selected, the second drop down would only show items related to the first drop down item”
so you will need to tweak the filter[s] on the custom field set up accordingly
k
Thank you @jen, this is exactly what I was looking for 😄