Automation Script to reset user's Start Centers
In a previous post I have explained how to force the reload of a the start center for a specific group of users.
I have now developed a useful automation script that can be invoked from the Security Group application to automatically perform this task with just one click.
Register the script as a Script with an Action Launch Point and link it to a sigoption and to a menuaction, toolbar icon or application button as described in this post or this one.
# Reset users Start Centers
Object: MAXGROUP
Resets the Start Centers for all users assigned to the selected Security Group
Should be called when all users are logged off so the start center is reloaded after the login
See: http://bportaluri.com/2012/11/how-to-reset-users-start-centers.html
from psdi.server import MXServer from psdi.util.logging import MXLoggerFactory
mxserver = MXServer.getMXServer() logger = MXLoggerFactory.getLogger(“maximo.maximodev”) logger.info(“Entering MXD_RESETSC”)
Execute delete statement
def execDelete(objectName, where):
sql = “delete from " + objectName + " where " + where
logger.debug(“Executing SQL statement: " + sql)
conKey = mxserver.getSystemUserInfo().getConnectionKey()
con = mxserver.getDBManager().getConnection(conKey)
s= con.createStatement()
s.executeUpdate(sql)
s.close()
con.commit()
mxserver.getDBManager().freeConnection(conKey)
grpname = mbo.getString(“GROUPNAME”)
where1 = “scconfigid IN (SELECT scconfigid FROM scconfig WHERE groupname=’” + grpname + “’)” where2 = “layoutid IN (SELECT layoutid FROM layout WHERE " +where1+ “)”
execDelete(“PORTLETDISPLAY”, where2) execDelete(“REPORTLISTCFG”, where2) execDelete(“RSCONFIG”, where2) execDelete(“FACONFIG”, where2) execDelete(“INBXCONFIG”, where2) execDelete(“KPILCONFIG”, where2) execDelete(“KPIGCONFIG”, where2) execDelete(“ACTIONSCFG”, where2) execDelete(“LAYOUT”, where2)
execDelete(“SCCONFIG”, where1)