Create records in a variable app

I would like to create records in a specific variable app.

An App A should have records which includes a pointer to an App X.
An Automation should cycle through App A and create records in the specific App X, mentioned in the record of App A.

I see this can be done via API. Am I right, there is currently no way to do this within Tape Automations?

Probably I can call the Tape API via an Automation? :wink:

If I understand what you’re going for here, it would be accomplished via automation by doing a get referenced, then various If statements.

So when your action triggers in App A, then do a get referenced item from App X. If there is an App X item ID found, then create a record in App X as needed.

My understanding here is that your looking also if the App A is referencing different apps instead of App X, so in another statement, try getting a referenced item in App Y, if there is an App Y item ID found, then create a record in App Y as needed (instead of App X now) etc.

Hope that helps. If I misunderstood the need here my apologies.

3 Likes

Not sure if I completely understand your approach.

The example is - I want to generate daily entries for each employee.

  1. Table A has all employees.
  2. Each Employee (E1, E2, E3, E4 …) has his own app in her own workspace.
  3. Automation should pick up all “active” employees from Table A.
  4. Now loop through each employee (E1, E2, E3, E4 …) and create the new daily records in the employees own App (E1, E2, E3, E4 …).

I could find out the App ID for E1, E2, E3, E4 … and store it in the employees record in Table A. But not sure if there is any way to use it for the automation (step 4)?

(Its an xy-problem by the way - https://xyproblem.info/ - I wouldn’t need to have E1 - Ex apps, if I could automatically set access to single records in one App E, which is not supported (yet?)=

@dirk_s

If you have the app ID then you can:

This will then give you the created record ID of the newly created record, hopefully giving you enough to build out from there.

Let me know if it doesn’t or if I have missed the point. :slight_smile:

3 Likes

I should also have said that you can fill out fields as you create the records by changing the create line:

const response = await tape.Record.create(app,{fields:{name:"Test Alpha" number_one:2 number_two:4}});
1 Like

Ahh, @Jason that sounds promising! So I can create a record in a defined app (not related to App A), get back the created record ID and e.g. link it. That should work solving problem Y :wink:

Thanks a lot!

1 Like

Yep as long as you have that appID now if you automated the creation of the app from App A say when adding a new member of staff then that would return you the new App’s ID to add to the record. Doesn’t really sit within the ‘no code’ bracket but it would minimise human touch.

Don’t like fixing the ‘y’ but sometimes you have to :wink:

1 Like

Actually, that brings up an idea to kind of auto setup some Apps and automations if an automation / app can find out about its own App ID:

  1. which app ID am I?
  2. lookup my connection in a settings app to get other app IDs
  3. get data from this looked up other app or record IDs

:wink:

1 Like

Well you can:

tape.App.getAllApps

Which gives you apps with id’s and names. Then if you know the name you can use JSONata to find the name and retrieve the AppID of course if you have multiple apps called the same thing that would complicate things.

I have not given this much thought so could well be an easier way

2 Likes

In my test it looks like addressing the field by the name doesn’t work - could it be I really need the field ID?

Oh no, I just need to write the field name correctly :smiley:

@Tim is there a direct way to identify the current recordID and appID of the current record via some “tape.” syntax in a script or automation?

@Tim your input would be heavily be appreciated :wink:

Hi @dirk_s

I am sure Tim may have a better way but to keep you going before he gets back to you:

console.log('current record ID', current_record_id);

current_record_id is available for the current record. The app ID is slightly harder but is included in things like collections or the record details so you can get it from there:

const rec = await tape.Record.get(current_record_id);
const appID = jsonata(`data.app_id`).evaluate(rec);
console.info('app ID', appID);
2 Likes

Nice, will try that. @Jason