Hello team, I have a problem, In order to filter t...
# general
i
Hello team, I have a problem, In order to filter the display of the values of a field containing the items to display only the items purchased by a customer who is previously selected upstream in a customer field of the same form, I did a search recorded as "Transaction" which returns the list of equipment sold as well as the customers to whom they were sold.
Copy code
The equivalent script is as follows:        function(search, record) {
   
	/**
	* @param search @param record
	*/
    function getInputData() {
    	return search.create({
    		   type: "transaction",
    		   filters:
    		   [
    		      ["itemsubof","anyof","2054"], 
    		      "AND", 
    		      ["status","anyof","ItemShip:C"]
    		   ],
    		   columns:
    		   [
    		      search.createColumn({name: "internalid", label: "Internal ID"}),
    		      search.createColumn({name: "item", label: "Item"}),
    		      search.createColumn({name: "entity", label: "Name"})
    		   ]
    		});

    }
However, the personalized form in which these fields are located is of type "Item" and I do not know how to make the mapping between the result of my saved search and the fields of my personalized form so that the content of my "Item" field depends of the "Customer" field and therefore only displays the items sent in the customer's stock. Can someone point me to a script that will accomplish this. Thank you
b
An Item Filter cannot be used this way
Nor does suitescript offer options to limit the select options of native fields
if you wanted to put a lot of work into it, you could make your own scripted field and add your own select options to it
disable the normal item column and make the script copy the value of your scripted field into the item column
i
can you tell me how to achieve this please
b
Use Form.addField in a beforeLoad user event script to create your scripted field
Use Field.insertSelectOption in a client script to add select options that match the results of your search
i
ok that's a good idea than you @battk