New record when button is pushed

Hello I have table Contracts and I would like to create Offers or Invoices by clicking on button (custom button).

By clicking button I would like to popup/open new form to add data to another table (named Offers, Orders, Invoices, or whatever…)

Is there any way to do this?

Hello, Thomas,

Yes, definitely. You can create these buttons using this information from our Help Center. HERE.
If you’re still not sure how to create a button, please contact us at

With kind regards,

Hello @Thomas ,

When you are editing the table fields you can create a Button type field and write some script.

The script you need is:

So you when you create or edit a record on contracts table there will be a button called with the name you defined, and it will show another popup over the contract edit popup with another popup to create the invoice.

I hope it’s what you need.


Lets say in table “Documents” is Dropdown with two options: “Offer” and “Invoice”. Is there any way to set as default value “Offer” when I push button “Create offer” and “Invoice” when I hit “Create invoice” button?

Hello, Thomas,

I am sending you the JS to set the default value for Offer. U can use the same for the invoice.

With kind regards,

It doesn’t work… I can’t use doo.model.<[Type (DOC_type)]>.setValue("Offer"); because it’s opening form “Documents” from table “Contracts” so it says that <[Type (DOC_type)]> is undefined…

It would work if I would open same form directly in table “Documents” but this is not that case.

Sure! I’ve created a test table and defined two buttons that are going to create a “document” record.

doo.form.openForm("document", {model: {type:"invoice"}})

doo.form.openForm("document", {model: {type:"offer"}})

The openForm() function has some parmeters and there you can define the how you would like to open the popup. Here is the documentation doo.form - Tabidoo Help Center

BE CAREFULL! The field name you use inside model parameter maybe is not the same name you defined on the field name. Navigate inside “type” field definition and open “Advanced features” collapse section, in the end you should see a “Developer level” collapse section (if you didn’t see you should enable on your account settings Internal Naming Of Fields - Tabidoo Help Center) and there you can define a “Field internal name”. That one is the one you must use when you are writing scripts.

Normally the “Column name” and “Field internal name” are the same because when the field is created the “Field internal name” is initialized with the “Column name” value, but if you change the “Column name” afterwards the “Field internal name” is not updated.

Hope I helped you!

Thank you. It works well.

I just find out if I have set default value up of Type field in Documents table then the script on custom button in table Contracts doesn’t work properly - it setting still that default value although script setting value to Offer.

doo.form.openForm("Documents", {model: {DOC_type: "Offer"}});

If DOC_type default value (in table Documents) is set to “Invoice”, script on custom button does not overwrite that value and it still opening form with “Invoice” value. Is there any workaround?

Hi @Thomas !

I’ve tried your configuration and it’s true, if DOC_type has got a default value, the openForm() function does not define any value, always sets the default value.

But I will propose other configuration. What about defining the DOC_type field as required and leaving the default value empty? I’ve tried and with that configuration the script works properly. I think you wanted to define the default value in case that you add the document record directly from the table and in that case there is no way to leave it blank because is required.

Tell me if it will be ok for you and otherway we will find other solution.

Exactly. Of course I would prefer to make my daily work as easy as possible, so setting a default value would be appropriate.

I can think of entering the default value directly in the script of this table, but I haven’t found out idea yet.

I found another solution!

Instead writing a default value on the default input there is another way to do it by script and in this case we can write some conditions.

Go to “Documents” table and with the setting icon go to “Scripting” section. There we can write some code to execute on model load, on model change, before model save or after model save. I’ve wrote this code on model load section. This code sets a value (the default value) only if the field is empty.

var value=doo.model.<[type (type)]>.value
if (value==undefined) {
  doo.model.<[type (type)]>.setValue( 'other')

To sum up, the DOC_type field shouldn’t have a default value and the required property could be enabled or not. The document table is going to have the previous code on the “on model load” script. Then, in the secondary table you already have defined two buttons with their script to open the document table with a custome moedl.

Is it better?

Thank you for idea - it works well.

if (doo.model.<[Type (DOC_type)]>.value==undefined) {
	doo.model.<[Type (DOC_type)]>.setValue("Received invoice");

Is there any solution how to predefined even link? When I hit the button I want to predefined Dropdown for “Offer” (that works with previous script), but I want to predefined even link between tables Contracts (where is pushed button) and Documents (where is record created by pushing that button).

Any ideas?

In case you want to pre-fill value for lookup, use the setValue.

You can use the values from the current model… of course.