Sets the mode of a portlet. You can only use this function when processing a JSF action. Do not use it to call from a rendering function, such as an onConstruction or on preRender function.
This function produces an error if the portlet (or portal) does not support the specified mode, or the current user is not allowed to switch to this mode. An error can also occur if the function is called while processing a render request.
portalLib.setPortletMode(
mode PortletModeKind)
portalLib.setPortletMode(PortletModeKind.editMode);