Context: When creating a booking sometimes your users might need to submit multiple documents for a single booking. An example could be a booking for a large group study where each person might need to have submitted a patient form.
Suitable for: Admins with experience of working with the Bakery
Objective: Use the bakery to set up the necessary fields in order to store the attachments.
Steps:
- Go to Admin->Bakery.
- Click the + next to Biskit Def to open the Biskit Tree
- Select any Biskit.
- Press the Create button to create a new Biskit and enter edit mode. First we need to create the BiskitDef to hold the attachments.
- Update the meta-properties of the Biskit.
- Change Type to be the new BiskitDef name, in this case Project Attachment.
- In Properties Add New
- Change myProperty name to attachment
- Change Type to Biskit
- Change Biskit Def to Attachment
- Create another new property using Add New
- Change Type to Biskit.
- Change myProperty name to project
- Change Biskit Def to Project
- Change Biskit Property Type to Many To One.
- Make sure Required is ticked
- Press the Save button. There will be an error: 'ProjectAttachment: Project is manyToOne Project but no inversePropertyName set'
- Check the error by pressing Show Log. If the error is complaining about a no inversePropertyName being set go ahead and click the Save Despite Errors button.
- Select the Project BiskitDef, press the Edit button to get back into edit mode.
In Properties Add New.
Change Type to Set.
Change Name to attachments
Change Biskit Def to Project Attachment
Change Biskit Property Type to One To Many
Change Reference Deletion Option to Set Null
Change Inverse Property to project
- Press the Save button and although there will be an error you can click the Save Despite Errors button
- Select the Project Attachment BiskitDef, press the Edit button to get back into edit mode.
- Select the Project property.
- Change Inverse Property to attachments
- Press the Save button
If there are no errors the database will need to be updated:
Press Update DB Schema to implement changes in the DB, and then run the script to apply the changes
Press Validate Biskits button to check the database Biskits.
Press Reload Database Configuration, to load the new database into Calpendo
Refresh the browser