I am trying to build a utility bar item that is refreshed when the user closes and reopens it. I tried implementing the onUtilityClick() function in my init method but I'm getting the error 'Error: Invalid or missing ultiityId 'false''. The documentation has the user click a button to activate the event handler which doesn't fit my use case. I also checked out Bob Buzzards post and I don't understand where in the JS he is creating that event handler http://bobbuzzard.blogspot.com/2018/05/lightning-utility-bar-click-handling-in.html
AURA
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<lightning:utilityBarAPI aura:id="utilitybar"/>
JS
doInit: function (cmp, event, helper) {
helper.registerUtilityClickHandler(cmp, event, helper);
}
JS HELPER
registerUtilityClickHandler: function(cmp, event, helper){
var utilityBarAPI = cmp.find("utilitybar");
var eventHandler = function(response){
console.log('initHandler');
};
utilityBarAPI.onUtilityClick({
eventHandler: eventHandler
}).then(function(result){
debugger;
//refresh logic will go here
console.log('refresh');
console.log(cmp.get('v.recordId'));
}).catch(function(error){
console.log(error);
});
}