Product/components used and version/fix level are you on:
Backend: 1015.0.278
UI: 1011.0.38
Detailed explanation of the problem:
I have inventory service in run time widget code here I have getting inventory details of device when passing hardcoded device id but now I want all device id which is register on Cumulocity so that i can pass device id dynamically one by one but i am facing issue I just want to get device id’s ,
below is i have attached screenshot of my run time widget code where i have passed device id hardcoded please check and suggest something so that i can get device id’s
and apart from this below is one more screenshot over there i have mark in red my question is from where we are getting id there is mention mo.id from where i can getting this id ?
below I am attaching one more image where i am getting device name and child device id but I want parent device how to achieve this please refer below attached image .
here is a code snipped from the tutorial application that you can use to get a list of all device on creation of a component:
// The filter object will add query parameters
// to the request which is made by the service.
private filter: object = {
fragmentType: 'c8y_IsDevice',
// paging information will be a part of the response now
withTotalPages: true,
pageSize: 10
};
constructor(private inventory: InventoryService, public stepperService: StepperService) {
// _ annotation to mark this string as translatable string.
//this.informationText = 'Ooops! It seems that there is no device to display.';
this.loadDevices();
}
// Promise-based usage of InventoryService.
async loadDevices() {
this.devices = await this.inventory.list(this.filter);
}
To avoid hardcoding the device id, you can also use the device id that is stored in the widget configuration: