priority-web-sdk: fieldUpdate for choose field failed - priority-web-sdk

My form contains a field with drop down values (the values came from the choose function) and when I am trying to update the field (with fieldUpdate) in the second time I always get the following error: "A record with the same value already exists in the screen", What is the correct order of actions that need to be done in order to achieve the right behaviour?
This is my attempt to achieve that:
await actions.loginTest();
const form = await actions.priority.formStart(this.formName,
this.onShowMessgeFunc, this.onUpdateFieldsFunc);
_formInstance = form;
const rows = await form.getRows(1);
console.log("parent form rows", rows);
await _formInstance.setActiveRow(1);
form.choose("CUSTNAME", '').then(options => {
let custOptions = => {return {label:x.retval + " -
" + x.string1, value: x.retval }});
}).catch((err) => {
console.log("CHOOSE ERROR", err);
When I select a value from the drop-down, those are my actions:
await _formInstance.fieldUpdate("CUSTNAME", data.value);
await _formInstance.saveRow(1);
const rows = await _formInstance.getRows(1);
console.log("rows", rows);
In the first time it work's great, but when I select a different value for the second time I get an error that say that this value already exists (it's like it think that I am trying to update the value but I don't, I just want to get the values of other fields that return as a result of the field trigger when I leave the field in Priority). I don't have any purpose to change values, just getting information on other fields and data from sub-forms.

I don't have any purpose to change values, just getting information on other fields and data from sub-forms.
In order to achieve your purpose you could choose one of the following flows, that should work:
Recommended: Use getRows() after you have setSearchFilter() in order to retrieve the row you're interested in including its fields. Then easily setActiveRow() with its index to startSubForm(). You could always use clearRows() to clear the current rows and retrieve others.
const form = await actions.priority.formStart(this.formName,
this.onShowMessgeFunc, this.onUpdateFieldsFunc);
const filter = {
field: 'CUSTNAME',
fromval: value,
op: '='
await form.setSearchFilter(filter)
const rows = await form.getRows(1);
console.log("parent form rows", rows);
await form.setActiveRow(1);
await form.startSubForm(1);
Perform the 'update' on a newRow() without calling getRows(). Then saveRow() and startSubForm() to get the information you need. Do this for each record you trying to retrieve its data.
Explanation: When calling getRows() you retrieve some rows. Then you cannot update a key field with a value that already exists in the retrieved rows otherwise you get that error.


Unable to retrieve custom list value from saved search in netsuite

Creating saved search in suitescript using nlapiSearchRecord. All the column value returns except one column which is type is custom list.
How could I get value of custom list?
To get the value I'm using code lines below.
columns[0] = new nlobjSearchColumn( 'customlist' );
var searchresults = nlapiSearchRecord( 'customrecord', null, filters, columns );
To get the column value
var listValue = searchresult.getListValue( 'customlist' );
I assume you've simplified your code in trying to be clear or confidential but there will never be fields or records with those ids.
from a search you would do:
var searchResult = searchResults[0];
searchResult.getValue(fieldId, joinName, summary)
// or in your case
searchResult.getValue('customlist'); //returns id of list value or simple result of non-list/record fields
or (and I think this is the one you want)
searchResult.getText('customlist'); // returns the display value of the list/record field.

Consuming multiple ResourceIterator objects in Java?

My question is this: how can I read multiple ResourceIterator objects coming back from a query, one "row" at a time?
I have a series of queries that return multiple columns; I'm trying to write a generic function that will handle the details of executing the Cypher queries from java, consume the result, and return it as an easy Map which maps the column name requested back to a list of results.
The trouble is that some of my ResourceIterator responses that come back from ExecutionResult appear empty, although they shouldn't be. I'm wondering if there is a need to consume multiple ResourceIterators in parallel, or some other hitch that's causing them to be exhausted before I've read them.
public Map<String,List<Object>> runQueryComplexResult(NeoProfiler parent, String query, String...columns) {
HashMap<String,List<Object>> all = new HashMap<String,List<Object>>();
ExecutionEngine engine = new ExecutionEngine(parent.getDB());
List<Object> retvals = new ArrayList<Object>();
try ( Transaction tx = parent.getDB().beginTx() ) {;
ExecutionResult result = engine.execute(query);
List<ResourceIterator<Object>> rits = new ArrayList<ResourceIterator<Object>>();
List<List<Object>> consumed = new ArrayList<List<Object>>();
for(String col : columns) {
// rits.add(result.columnAs(col));
all.put(col, IteratorUtil.asList(result.columnAs(col)));
return all;
I then call this function like this:
Map<String,List<Object>> ret = runQueryComplexResult(parent,
"match n-[r:" + type + "]->m return n as left, m as right limit 50",
"right", "left");
In this case, the column in the result labeled "right" will be read first. When it is, I get an empty list of results for the "left" column. If I switch order (and read the results from "left" first) then the reverse happens; the "right" list is empty.
It appears that you can only iterate once through the rows in an ExecutionResult. The columnAs() method iterates through all the rows, but only returns the values from a single column. A second call to columnAs() will return no values because you are already at the end of the ExecutionResult.
You will need to restructure your logic and use the iterator() method instead, processing a row at a time.
To quote the JavaDoc for iterator():
public ResourceIterator<Map<String,Object>> iterator()
Returns an iterator over the return clause of the query. The format is
a map that has as keys the names of the columns or their explicit
names (set via 'as') and the value is the calculated value. Each
iterator item is one row of the query result.
In other words, each pass through an iterator() loop provides a Map containing the columns for a result row. Each key in the Map is the name of a column, and the value for each key is that column's data.

Entity query increments field value for every query (field is not autoincremented)

I have an entity query that when I run increments the value of my field. I am using entity framework and sql server 2012. Here is my query;
public void GetLastAccountNumber(ProductLine productLine, Action completed)
EntityQuery query = WASMDomainContext.GetContactCustomerAccountsQuery()
.Where(cca => cca.ProductLineId == productLine.Id)
.OrderBy(cca => cca.AccountNumber);
WASMDomainContext.Load(query, loadOp =>
Exception error = null;
ContactCustomerAccount lastAccount = null;
if (loadOp.HasError)
error = loadOp.Error;
lastAccount = loadOp.Entities.LastOrDefault();
// Invoke completion callback
completed(lastAccount, error);
}, null);
Query should return the last account number which is an integer field for now. However it returns an incremented value. For example in my table I have an accountnumber 0 the query returns an entity with account number as 1. My account number field is not auto increament and I find this very strange. And each time the above is called the AccountNumber field value increases by one but the database value will remain 0. I just want the query to return what is in my database. Any idea why this could be happening? Any help will be appreciated. Thank you all.

Check if similar record exists in store to avoid duplicates

I have a JsonStore with the following fields:
I have a form that collects the three fields (date, time, type) and inserts a new record into the store (I save the store separately). I would like to perform a check if a record with the same combination of field values already exists in the store to avoid duplicate entries.
I have managed to check for duplicate ID's in another store like this:
find = DepartmentMemberStore.find('member_id', value_from_form);
if (find != -1) {
// popup error window
} else {
// add new record to store
I don't know how to check a store to see if multiple field values match.
I've used Store's findBy( Function fn, [Object scope], [Number startIndex] ) for this situation. The function fn is called for every record in the store, and the current record and its corresponding id are passed into the function. Thus you can use the current record's fields to compare against each form field.
Here's an example for your situation:
var recordIndex = DepartmentMemberStore.findBy(
function(record, id){
if(record.get('date') === date_from_form &&
record.get('time') === time_from_form &&
record.get('type') === type_from_form){
return true; // a record with this data exists
return false; // there is no record in the store with this data
if(recordIndex != -1){
alert("We have a duplicate, abort!");

Silverlight 4 query against DomainContext for new entry

I'm working on a silverlight application that allows users to fill out common forms.
On my mainpage.xaml I have 4 buttons that allow a user to create a new form. Ihave the following code on the click event handler
FormsDS t = new FormsDS();
Store s = new Store();
var i = (from j in t.Stores
where j.StoreManager.Contains(WebContext.Current.User.Name)
select j.ID);
form newxferform = new form
xfertype = 1,
createdate = DateTime.Now,
createdby = WebContext.Current.User.Name,
assignedto = WebContext.Current.User.Name,
Store = Int32.Parse(i.ToString()),
xferfrom = Int32.Parse(i.ToString()),
appovalstatus = 1,
ronum = "0",
hide = 0
t.SubmitChanges(createop =>
Uri target = new Uri("/views/TransferForm.xaml?FormID=" +, UriKind.Relative);
}, null);
FormsDS is my datacontext.
I would like to take the value i from the query at the top and assign it to the Store and xferfrom values in newxferform. However when I run it I get 'Input string was not in a correct format'. If I don't do the Int32.Parse I get the message 'Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to '?int'. I don't understand this at all since all of the columns in the db are not null. I've tried writing try catches to handle the null values but I can't figure out why the value is coming back as null, the username matches the storemanager column exactly. I should be getting a result.
I've tried several different ways and I can't seem to get it.
I just need to take the ID field from a table called stores where the colum StoreManager equals the currently logged in user and assign it to the store and xferfrom field in a table called forms when I create the form.
What I think is making this harder than i would like is that I don't have a DataContext defined anyhere in the xaml on the page. This is just a nav page. The data is handled in the pages that are loaded in the Navigation Frame.
Any help would be greatly appreciated.
The problem is that the LINQ query above produces an IEnumerable<int> rather than a single int.
To solve this, replace i declaration with the following:
var i =
.FirstOrDefault(j => j.StoreManager.Contains(WebContext.Current.User.Name))
Or if you like the LINQ way:
var i = (from j in t.Stores
where j.StoreManager.Contains(WebContext.Current.User.Name)
select j.ID)
(You should replace FirstOrDefault with Single if exactly 1 item is expected or with SingleOrDefault if 0 or 1 items is expected.