How to get Device Id associate with my Application label

I want to get my device ID when I am creating device level widget and when I creating Application level widget then I want to get all associated device Id from this Application Level.

Thanks
Rahul

Hi Rahul,

please mention the version of Cumulocity (backend & frontend) that you are using when creating a ticket.

I’m not really sure what you mean by :

Could you elaborate a bit more on that?

In general:
You can use dependency injection to inject the ContextDashboardComponent instance into your widget component. The context (Web SDK documentation) property should be set to the managedObject of the group or device in case you are on a group or device dashboard. In case you need to know the children of a device or group you would have to make the appropriate API call for that, but you can use the parents id from context.

You can also use the isDeviceTypeDashboard getter (Web SDK documentation) in case you want to check if the dashboard is a device type dashboard.

In case you need to know the context while being in the widgets configuration component, you can use dependency injection to inject the WidgetConfigComponent, which also offers a context property (Web SDK documentation).

Regards,
Tristan

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.