Can I automatically schedule an appointment based on observation forms?

This can either be done asynchronously outside of the transaction or synchronously part of the same transaction. My inclination is towards aysnchronous option. For that, you can have a openmrs scheduled task that regularly reads such observations and creates corresponding appointments.

I had recently created a ‘Bahmni appointments scheduling extension’ omod to have a task to auto-checkin appointments discussed in this thread. The omod has been running fine in production for a week now. The source code can be found here. The omod still requires fine tuning in terms of removing unwanted dependencies, etc. Hopefully i will be able to do it in next week. But feel free to use it as reference if it helps. In creating appointments asynchronously a mechanism will have to be figured out to know which observations have been processed and so not to create duplicate appointments. (may be the combination of patient id, appointment date and service type can be used for that).

If there is really a need to do it synchronously as part of the same transaction then you can either create another omod like darius suggested or it can probably be done via the already existing groovy script support in Bahmni like the BahmniObsValueCalculator which gets called before transaction update by bahmni-core.