Requirement # 1:
How can we delete all persons from a list of PersonGroups except Group Default at once?
Requirement #2:
How can we delete a specific person from all the listed person groups?
Solution:
- Create an Action Launch Point Script (let's say. DEL_PGTEAM)
- Open PERSONGR in application designer:
- Create a Signature Option: DEL_PGTEAM., and choose "This is an action that must be invoked by the user in the UI" in the advance section
- Create Action with type Option with the same name as the signature option in step 1.
- Grant newly created signature option for specific Security Group.
Action Launch Point Script Details:
- Name: DEL_PGTEAM
- Object: PERSONGROUPTEAM
- Launch Point Type: ACTION
- Script body:
from psdi.server import MXServerfrom psdi.mbo import MboConstantsfrom psdi.common.context import UIContextmxServer = MXServer.getMXServer()userInfo = mxServer.getUserInfo("maxadmin")wclause = service.webclientsession().getCurrentApp().getResultsBean().getMboSet().getUserAndQbeWhere()pgWhere = wclausepgSet = mxServer.getMboSet('PERSONGROUP', userInfo)pgSet.setWhere(pgWhere)pg = pgSet.moveFirst()while pg: # Loop through the persongroups of list view one by onepersonGroupTeamSet = pg.getMboSet('ALLPERSONGROUPTEAM')personGroupTeam = personGroupTeamSet.moveFirst()while personGroupTeam: # Loop each person in a groupif personGroupTeam.getBoolean("GROUPDEFAULT") == False:#uncomment below line and enter personid, if you want to delete specific person (requirement 2)#if personGroupTeam.getString("resppartygroup") in ('171061'):personGroupTeam.delete()personGroupTeam = personGroupTeamSet.moveNext()pgSet.save()pg = pgSet.moveNext()service.error(":)","You are Done.")
No comments:
Post a Comment