Hi sure I can share the solution, but this is only my second flow built in Make so I am sure there could be a better way and Iâd be glad of any pointersâŚ
It connects with an App in Knack which is very limited in its processing functions hence I needed to use something outside.
As background this is part of an on-boarding process for new staff members. There are different âtypesâ of staff. They can be home carers or service providers etc⌠When they join they need to complete a number of forms and training. These in some cases expire and need to be renewed.
In the Knack solution there is the Staff table which includes the type of staff and they can be one or more types.
There is then a form type table. Each form type can be assigned to one or more staff types. The form type holds the meta data for the period the staff has to compete the form or training and the period it has until expiry.
Then there is the form table itself and these are created when the staff member joins depending on their type.
Step 1.
Watch the staff table for new records
Step 2.
Read and iterate the staff types
Step 3.
The staff types have some html so mark this down.
Step 4.
Search for all the form types which include the staff type.
Step 5.
Iterate the Form types
Step 6.
Create the form record and link to the Staff record
Step 7.
Here is where I started to have issues because I couldnât find a way for a variable to reference itself and therefore add new values to an array.
So here I get the staff record again and read what forms it has.
Step 8.
Take the form IDs already in the staff record and add the new form IDâŚ
add(map(existing forms (raw)[]; âidâ); newform.id)
I found the Make documentation on this very poor. Actually quite poor in general.
One bit I still need to add here is a check to see if the form has already been added because a staff can have many types and different staff types will have some of the same forms.
Step 9.
Set the forms array field in the staff record to the variable in step 8.
It then iterates around and reads the forms out of the staff record again and adds the new one.
This isnât very efficient and Iâd like to think there is a better wayâŚ