Maximo Open Forum

 View Only
  • 1.  OSIN script Issue

    Posted 7 days ago
    Hi,
    My requirement is to assign security group to the user profile in maximo which is created from the external system as inbound transaction based on the role of the person of the external system.I have mapped external fields in json mapping, am storing the security groups (groupname) in description of domain of maximo. below code is not working for me when the request is sent to external system from postman and getting error  BMXAA7874E - Users cannot be removed from the EVERYONE group because it is specified as the group for all as a response. can you please suggest if my code is correct or not?
     
    def beforeMboData(ctx):
        mbo   =   ctx.getMbo()  # The PERSON MBO being processed
        if not mbo:
            return
     
                    struc  =  ctx.getData()
            print(struc)
            child  =  struc.getChildrenData("MAXGROUP")
            print("child is-------------"+child);
            role  = child.getCurrentData("GROUPNAME")
            print("role is"+role);
                    if not role:
                return
     
                           user_info   =   mbo.getUserInfo()
                person_id   =   mbo.getString("PERSONID")
     
                domainset   =   MXServer.getMXServer().getMboSet("ALNDOMAIN", user_info)
                domainset.setWhere("VALUE  =  'role'")
                domainset.reset()
                if domainset.isEmpty()  ==  False:
                    domainMbo  =  domainset.getMbo(0)
                    if domainMbo is not None:
                        domainMboSecGroup  =  domainMbo.getString("DESCRIPTION")
     
                        mbo.putData("GROUPNAME",domainMboSecGroup)

    #MaximoApplicationSuite

    ------------------------------
    chidambar shastry
    GE
    ------------------------------


  • 2.  RE: OSIN script Issue

    Posted 7 days ago

    Hi Chidambar,

    Can you provide more details on your object structure and JSON mapping? Ideally, you should have MAXUSER and GROUPUSER in your object structure, as the group is mapped to the user, and not the person object.

    That said, your script should look like the one below, but it also depends on your mapping.

    If you have all the details for PERSON, USER, and GROUP in the income payload, I'd say you don't need the script and could resolve it only with JSON Mapping.

    def beforeMboData(ctx):
        mbo = ctx.getMbo()
        if not mbo:
            return
        
        struc = ctx.getData()
        user_info = mbo.getUserInfo()
        
        # Get the role from your incoming data
        # Adjust this based on your actual JSON structure
        role = struc.getString("YOUR_ROLE_FIELD")
        
        if not role:
            return
        
        # Look up the security group from ALNDOMAIN
        domainset = MXServer.getMXServer().getMboSet("ALNDOMAIN", user_info)
        domainset.setWhere("DOMAINID='YOUR_DOMAIN' AND VALUE='" + role + "'")
        domainset.reset()
        
        if not domainset.isEmpty():
            domainMbo = domainset.getMbo(0)
            secGroup = domainMbo.getString("DESCRIPTION")
            
            # Add to MAXUSER/GROUPUSER child structure
            maxuserData = struc.getChildrenData("MAXUSER")
            if maxuserData:
                maxgroupData = maxuserData.getChildrenData("GROUPUSER")
                maxgroupData.addNew()
                maxgroupData.getCurrentData("GROUPNAME").setValue(secGroup)
        
        domainset.close()
    


    ------------------------------
    Maycon Belfort
    Naviam
    IBM Champion 2025
    ------------------------------