Hi @dirk_s
I am fairly sure you started me down this path a while back, I think you were looking at new workspaces and apps for new members of staff or something similar? (I am out and about, right now and don’t seem to be able to find the post i am think off). Anyway I had a play back then as I thought it had a lot of possibilities to create workspaces and apps automatically when other actions happened.
Anyway, creating a new ‘duplicate app’ is relatively simple however it becomes tricky and I hit a bit of a problem that I didn’t have the time to work through as an experiment was calculation fields, so if you are happy to deal with them manually then it is all fine
I think I even started writing it up which if I can find later I will send to you however as a rough thing to point you in a direction it looks like the following was what I was using to create the app:
const c_name = client_field_name_value;
const p_app = await tape.App.create({
"workspace_id": var_workspaceid,
"name": `${c_name} - Projects`,
"item_name": "Project",
"description": `Projects app for ${c_name} .`,
"icon": {
"id": "person",
"type": "graphic"
},
"item_icon": {
"emoji": "🧑",
"type": "emoji"
},
"fields": [
{
"field_type": "single_text",
"config": {
"label": "Project Name",
"slug": "name",
"external_id": "name",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"formatted": false
}
}
},
{
"field_type": "multi_text",
"config": {
"label": "Project Description",
"slug": "project_description",
"external_id": "project_description",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"formatted": true
}
}
},
{
"field_type": "status",
"config": {
"label": "Status",
"slug": "status",
"external_id": "status",
"show_description": false,
"required": true,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"multiple": false,
"layout": "dropdown",
"options": [
{
"id": 38905,
"text": "⚫ Pre-Approval",
"color": "CDCCC9",
"means_completed": true
},
{
"id": 38906,
"text": "🟡 On Hold",
"color": "CDCCC9",
"means_completed": true
},
{
"id": 38907,
"text": "🔴 Overdue",
"color": "FE001A",
"means_completed": false
},
{
"id": 38908,
"text": "🟠 Not started",
"color": "F45D00",
"means_completed": true
},
{
"id": 38909,
"text": "🟢 Active",
"color": "00866A",
"means_completed": false
},
{
"id": 38910,
"text": "🟣 Priority",
"color": "6724DD",
"means_completed": false
},
{
"id": 38911,
"text": "🟡 Cancelled",
"color": "0077DE",
"means_completed": true
},
{
"id": 38912,
"text": "🔵 Complete",
"color": "DEA700",
"means_completed": true
}
]
}
}
},
{
"field_type": "single_relation",
"config": {
"label": "Client",
"slug": "client",
"external_id": "client",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": true,
"settings": {
"multiple": false,
"referenced_apps": [
{
"app_id": 35028,
"app": {
"app_id": 35028,
"icon": "assignment",
"name": "Clients",
"slug": "clients",
"external_id": "clients",
"record_name": "Client",
"item_name": "Client",
"workspace_id": 11146,
"config": {
"name": "Clients",
"icon": "assignment",
"record_name": "Client",
"workspace_id": 11146
}
}
}
]
}
}
},
{
"field_type": "multi_user",
"config": {
"label": "Assign",
"slug": "assign",
"external_id": "assign",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"multiple": true
}
}
},
{
"field_type": "single_text",
"config": {
"label": "ref",
"slug": "ref",
"external_id": "ref",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false,
"settings": {
"formatted": false
}
}
},
{
"field_type": "single_text",
"config": {
"label": "url",
"slug": "url",
"external_id": "url",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false,
"settings": {
"formatted": false
}
}
},
{
"field_type": "created_on",
"config": {
"label": "Created on",
"slug": "created_on",
"external_id": "created_on",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false,
"settings": {
"show_time": true
}
}
},
{
"field_type": "created_by",
"config": {
"label": "Created by",
"slug": "created_by",
"external_id": "created_by",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false
}
},
{
"field_type": "last_modified_on",
"config": {
"label": "Last modified on",
"slug": "last_modified_on",
"external_id": "last_modified_on",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false,
"settings": {
"show_time": true
}
}
},
{
"field_type": "single_date",
"config": {
"label": "Start Date",
"slug": "start_date",
"external_id": "start_date",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"calendar": true,
"time": "disabled",
"is_due_date_of_status_field": false
}
}
},
{
"field_type": "single_date",
"config": {
"label": "Due Date",
"slug": "due_date",
"external_id": "due_date",
"show_description": false,
"required": false,
"always_hidden": false,
"hidden_if_empty": false,
"settings": {
"calendar": true,
"time": "disabled",
"is_due_date_of_status_field": true
}
}
},
{
"field_type": "unique_id",
"config": {
"label": "Unique ID",
"slug": "unique_id",
"external_id": "unique_id",
"show_description": false,
"required": false,
"always_hidden": true,
"hidden_if_empty": false,
"settings": {
"min_digits": 1
}
}
]
});
console.log(JSON.stringify(p_app.data));
var_uniqueid_field = jsonata('fields[label="Unique ID"].field_id').evaluate(p_app.data);
console.info('Unique ID Field', var_uniqueid_field);
var_createdon_field = jsonata('fields[label="Created on"].field_id').evaluate(p_app.data);
console.info('Created Date Field', var_createdon_field);
var_appid = p_app.data.app_id;
console.info('App ID', var_appid);
var_appfields = p_app.data.fields;
I am fairly sure that to get the JSON for the new app I found the easiest way was to retrieve the app details by running this:
curl https://api.tapeapp.com/v1/app/[[Enter your app number]] \
-u user_[[Replace with yours]]:
copy the result into an editor of choice and clean it up.
Calculation fields I believe then have to be added in with a separate field, which is fine however I think i then struggled writing the code to include variables in variables probably an easy fix for some
Oh I should also say that the app creation step followed a Workspace creation step in my experiment which gave me the workspace ID so if you are not creating a workspace you will need to get the workspace ID by some other means.
Let me know if it was the kind of thing you meant and when I am back at my desk I will try and find more of what I did.