The CiviCRM EntityRef form element uses a Select2 select box to make lots of CiviCRM forms more awesome. A user can, for example, search for contacts to choose one. Great.
I am building an extension where I would like to take an EntityRef element from a core form and select a use javascript to select a specific entity (or multiple entities in the case of a multi-select). Is there a javascript function I can call in order to trigger such a selection (by passing in the ID of the entity, for example)?