newRecord() questions

The docs for foundset.newRecord say that it allows you to add a record WITHOUT it showing up in the UI. I’m finding that it DOES show up in the UI. Example:

foundset.newRecord();
address='test3';
billing_freq=0;
contact_first_name='first3';
contact_last_name='last3';
contact_salutation='Mr.'
name='name3';
payment_terms='terms3';
controller.saveData();

After this code executes, I see this new record in my form. I’ve tried every combination of true & false for the function’s two parameters [add on top] and [change selection] and it makes no difference - I still see the record. Am I missing something?

amcgilly:
The docs for foundset.newRecord say that it allows you to add a record WITHOUT it showing up in the UI. I’m finding that it DOES show up in the UI. Example:

foundset.newRecord();

address=‘test3’;
billing_freq=0;
contact_first_name=‘first3’;
contact_last_name=‘last3’;
contact_salutation=‘Mr.’
name=‘name3’;
payment_terms=‘terms3’;
controller.saveData();




After this code executes, I see this new record in my form. I've tried every combination of true & false for the function's two parameters [add on top] and [change selection] and it makes no difference - I still see the record. Am I missing something?

I think you are overwriting your current record, not the new one that is being inserted in top or end (depending on call parameters of your foundset… you can try with:

var record = foundset.getRecord(foundset.newRecord(false,false));
record.name= "enrico";
record.billing_freq=0;
etc etc

it should work…

Hi,

When I don’t wan’t things to show up I create a special form called something like tablename + ‘_processing’. I check the “Use separate found set” box so any work I do via this form will not affect the selection any of my other forms.

Hope this helps,

I think you are overwriting your current record, not the new one that is being inserted in top or end (depending on call parameters of your foundset… you can try with:

var record = foundset.getRecord(foundset.newRecord(false,false));

record.name= “enrico”;
record.billing_freq=0;
etc etc

You were right, I WAS overwriting my current record, and the code above does solve the problem nicely. Thank you.