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 support@tabidoo.cloud.
The script you need is: doo.form.openForm("invoice")
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.
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?
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.
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.
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.
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?
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.
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 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).