Requirement
This requirement is raised by customer. They have extended a new field “Opportunity id” in My Appointment creation page. During appointment creation, customer choose an opportunity from this extension field via value help, and they would like to automatically generate a document history which links the created appointment with this manually chosen opportunity.
Implementation
create one BAdI implementation on spot CRM_APPT_ODATA_ENH with following source code:

Archievement
Appointment 成功创建之后,代码里hard code的opportunity guid对应的opportunity就会出现在Appointment的Transaction History area里: