I have added the lightning web component into utility bar and after the save button it should be able to auto close the utility bar.
I have searched through the web but haven't got an answer on how to do that. Any thoughts?
It is not supported yet in LWC.
Bring modern, blazing-fast Lightning web components (LWC) into the utility bar by adding the lightning__UtilityBar target to your LWC‘s meta configuration. LWC utilities don’t yet support APIs or being used as background utility items.
In the Aura components, there is an API for it.
HTML
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:utilityBarAPI aura:id="utilitybar" />
<lightning:button label="Minimize Utility" onclick="{! c.minimizeUtility }" />
</aura:component>
Controller
({
minimizeUtility : function(component, event, helper) {
var utilityAPI = component.find("utilitybar");
utilityAPI.minimizeUtility();
}
})
One possible solution I can think of is wrapping the Lightning web component in the Aura component.
It is supported now. Check this https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lwc_minimize.htm