Here, we'll see how to trigger events from chaincode. Using the SetEvent() method of ChaincodeStubInterface, events can be triggered by chaincode. Add the following code in the approveCertificate() method to emit the event after the certificate status is changed:
var testEventValue []byte
testEventValue=[]byte("Certificate "+cert_id+" status is changed to "+status)
stub.SetEvent("testEvent",testEventValue)