I want to create a platform event dynamically using any programming language. But I didn't find any API. Can you please tell me I can make platform event dynamically?

  • When you say you want to create - do you mean that you want to create a platform event record or you want to create the platform event object/fields altogether? – Jayant Das Mar 5 '19 at 15:10
  • new platform object so to listen on that. – Sagar Rana Magar Mar 6 '19 at 10:29
  • 2
    Why would you need to create the metadata dynamically? What is your use case? Seems you just want to create the object first in Salesforce and then subscribe to it. – Jayant Das Mar 6 '19 at 13:15
  • actually i want to make a connector for various organisation. We have partner with salesforce also. – Sagar Rana Magar Mar 6 '19 at 16:49

Platform events are migrated the same as normal Custom Objects. See Migrate Platform Event Definitions with Metadata API for specific details. Basically, you use the Metadata API, and you retrieve and deploy them the same as other CustomObject metadata objects, which also includes Custom Settings.

  • i'm new to it. Migration meaning we define a code and dynamically define platform event using java code also? – Sagar Rana Magar Mar 5 '19 at 9:59
  • @SagarRanaMagar Yes, you can do so with the Metadata API. – sfdcfox Mar 5 '19 at 10:01
  • Thank you for your response. Can you tell me how to use with metadata API? – Sagar Rana Magar Mar 5 '19 at 10:04
  • 1
    @SagarRanaMagar It's all in the documentation. What have you tried so far? – sfdcfox Mar 5 '19 at 10:07
  • I try to create platform event using meta data api. But I don't know how to use. I am good in REST API. But I never seen these type of API to work with java. – Sagar Rana Magar Mar 5 '19 at 10:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.