I'm setting up Jobs app and I'm trying to use Bookings sections to create and edit bookings for each Job.
I already have a silent booking script and it's selected in my booking section, however, after I click on "+ ADD" button, I still don't see the booking created in the Job.
Is there something that I'm missing?
Additionally, how can I configure a script for the Edit action?
Hi Bruno,
So in order to link a booking to a job you will need to complete the following steps.
Script Parameters
Your script will need 4 script parameters.
1. JobID - This will be the id of the job that you want to link the booking to.
2. BookingManagerID - This will be the DataMinerID/ElementID of the BookingManager that you linked in the booking section.
3. BookingIDs - This will be an array of booking IDs that you want to execute an action on.
4. Command - This will be 1 of 3 possible values (Add/Edit/Delete)
The command will allow you to differentiate which action the booking script should execute inside the script.
Script
Gather all the Script Parameters and check the value of the Command parameter to determine which action you want to execute.
You should have a method that does creation, updating and deleting of a booking in this script.
Example Create
1. Create the booking
2. Fetch the job with the JobID
3. Check if there already is a booking section on the job (otherwise create one)
4. Fetch the SectionDefinition from the Section via the SectionDefinitionID.
5. Find the ReservationFieldDescriptor on the SectionDefinition.
6. Link the bookingID to the section by using the following line of code.
Replace [A] with the booking section of the job from step 3
Replace [B] with the ReservationFieldDescriptor from step 5
Replace [C] with the ID of the booking (This has to be a Guid)