Hi,
Yes, you can use the new JS APIs to get the objectId and targets.
The API is called getContextObjects() and it returns a list of objects related to the current context. If you are in an action dialog, the API will return the action targets. If you are in a monitor view (for example), the API will return the context object.
Regards,
Denis