I want to change the attribute “Nr” of Current User using a custom action on a widget (by click on marker).
I tried to configure this code:
let attributeService = widgetContext.$injector.get(widgetContext.servicesMap.get('attributeService'));
let attributes = [{
"key": "Nr",
"value": Nr
}];
attributeService.saveEntityAttributes(entityId, 'SERVER_SCOPE', attributes).
subscribe(
() => {
console.log('Saved!');
},
error => {
console.log('Error');
}
);
but if I insert another Entity-Id manually instead of “entityId”, I get the error “No enum constant org.thingsboard.server.common.data.EntityType.undefined” when I use the action.
I also do not know the Entity-Id of Current User (I think there is none?).
Do you know how I could solve this problem?
Thanks!
Context: I have a dashboard with a map with buildings on the left side and detail-widgets of the buildings on the right side. When I click on the buildings on the map, I want to filter the details, so that just the details of that clicked building remain. My idea is to build in a dynamic filter with the Key name “Nr” from Current User. If you click on the marker of a building, the attribute “Nr” of current user would change to the number of the clicked building and the widgets on the right would only show the information of the clicked building.
If I use the “New Update Multiple Attributes” Widget to change the attribute “Nr” everything works fine, but I want to use the map to filter the detail-Widgets.