cancel
Showing results for 
Search instead for 
Did you mean: 

When a user creates an RFx from a template or duplicates an existing RFx then triggers a script to pull collaborators (and assoc access rights) from the user's/document owner's user profile.

Former Member
0 Kudos

Hi All

We have tried to add a group in collaborator which we are able to get the email, role, type, rule everything except the name of the group. We also are able to get the name of the collaborator Group but not in the section of collaborator.Please help how to pull the group name. Here is the code which we have used and I have also attached the screenshot which we are getting.

import com.sap.eso.api.contracts.AgreementIBeanIfc;

import com.sap.eso.api.contracts.ContractIBeanIfc;

import com.sap.eso.api.projects.ProjectIBeanIfc;

import com.sap.eso.api.rfx.RfxDocIBeanIfc;

import com.sap.eso.odp.runtime.dynenum.DocLinkDirectionTypeEnum;

import com.sap.odp.api.common.exception.ApplicationException;

import com.sap.odp.api.common.log.LogMessageIfc;

import com.sap.odp.api.common.log.Logger;

import com.sap.odp.api.common.platform.IapiSessionContextIfc;

import com.sap.odp.api.common.types.LocalizedObjectReferenceIfc;

import com.sap.odp.api.common.types.ObjectReferenceIfc;

import com.sap.odp.api.doc.DocLinkDefinitionTypeEnumType;

import com.sap.odp.api.doc.DocumentLinkIBeanIfc;

import com.sap.odp.api.doc.collaboration.CollaboratorApprovalRuleType;

import com.sap.odp.api.doc.collaboration.CollaboratorIBeanIfc;

import com.sap.odp.api.doc.collaboration.CollaboratorRoleIBeanHomeIfc;

import com.sap.odp.api.doccommon.masterdata.DocumentLinkDefinitionIBeanIfc;

import com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanHomeIfc;

import com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanIfc;

import com.sap.odp.api.ibean.CollectionIfc;

import com.sap.odp.api.ibean.ExtensionFieldIfc;

import com.sap.odp.api.ibean.IBeanHomeLocator;

import com.sap.odp.api.ibean.IBeanIfc;

import com.sap.odp.api.ibean.OrderedSubordinateCollectionIfc;

  

    InternalCatIBeanHomeIfc IntCatObj = (InternalCatIBeanHomeIfc)IBeanHomeLocator.lookup(session, doc.getInternalCatObjRef());

    InternalCatIBeanIfc IntCatBeanObj = (InternalCatIBeanIfc)IntCatObj.find(doc.getInternalCatObjRef());

    ExtensionFieldIfc OrgUnit = IntCatBeanObj.getExtensionField("PURCH_SECTOR") ;

    ObjectReferenceIfc grpOR=(ObjectReferenceIfc) OrgUnit.get();

    //doc.setDocumentDescription( "grpOR.getObjectId() -- " + grpOR.getObjectId() + " --getDisplayName()- " + grpOR.getDisplayName() + " --getClassId()- " + grpOR.getClassId() );

    BusinessUnitIBeanHomeIfc orgUnitDBObj = (BusinessUnitIBeanHomeIfc)IBeanHomeLocator.lookup(session, BusinessUnitIBeanHomeIfc.sHOME_NAME);

        String whereClause=("OBJECTID= " + grpOR.getObjectId());

        if( orgUnitDBObj == null )

                      {

        doc.setDocumentDescription("null");

                      }

        else

                     {

        doc.setDocumentDescription("orgUnitDBObj "+grpOR.getObjectId() );     //returns orgUnitObj object id

                      }

    //chekd till here

    List orgUnitLists = orgUnitDBObj.findWhere(whereClause);

        BusinessUnitIBeanIfc orgUnitBeanObj = null;

        if (orgUnitLists != null)

                          {

            orgUnitBeanObj = (BusinessUnitIBeanIfc)orgUnitLists.get(0);

            doc.setDocumentDescription("orgUnitBeanObj"+" "+orgUnitBeanObj.getDisplayName());

                          }

        else

        {

            doc.setDocumentDescription("orgUnitLists"+" "+"Null");

        }

    //tested till here

    LocalizedObjectReferenceIfc grpType = (LocalizedObjectReferenceIfc)doc.getExtensionField("TYPE_GSB").get();

        String grpTypeName = grpType.getDisplayName();

    OrderedSubordinateCollectionIfc rColCol=(OrderedSubordinateCollectionIfc) doc.getCollaborators();

CollaboratorIBeanIfc cNM=(CollaboratorIBeanIfc)rColCol.create();

CollaboratorRoleIBeanHomeIfc cRole=(CollaboratorRoleIBeanHomeIfc)IBeanHomeLocator.lookup(session, CollaboratorRoleIBeanHomeIfc.sHOME_NAME);

        if (grpTypeName.equals("A"))

               {

                doc.setDocumentDescription("Type of GSB" + grpTypeName);

               ExtensionFieldIfc SectGrpXtn = (ExtensionFieldIfc)orgUnitBeanObj.getExtensionField("SECT_GSB_ADMIN");

               String str1= SectGrpXtn.get().toString();

               doc.setDocumentDescription("Collaborators" + str1);

              

        cNM.setApprovalRule(new CollaboratorApprovalRuleType(CollaboratorApprovalRuleType.ANY));

            cNM.setCollaboratorEmail("lopita.dash@");

            cNM.setDisplayName("Group");

                        //CollaboratorRoleIBeanIfc aCB=(CollaboratorRoleIBeanIfc)cRole.getPrincipal();

//cNM.getCollaboratorRole().set(aCB.getObjectReference());cNM.setLockRole(true);

rColCol.add(cNM);

    }

       

        else if(grpTypeName.equals("B"))

                {

    doc.setDocumentDescription("Type of GSB" + grpTypeName);

                 ExtensionFieldIfc CorpGrpXtn = (ExtensionFieldIfc)orgUnitBeanObj.getExtensionField("CORP_GSB_ADMIN");

    String str2= CorpGrpXtn.get().toString();

                 doc.setDocumentDescription("Collaborators" + str2);

                        cNM.setApprovalRule(new CollaboratorApprovalRuleType(CollaboratorApprovalRuleType.ANY));

            cNM.setCollaboratorEmail("lopita.dash@");;

            cNM.setDisplayName("Group");

            //CollaboratorRoleIBeanIfc aCB=(CollaboratorRoleIBeanIfc)cRole.findUniqueByName("Corporate GSB Admin");

//cNM.getCollaboratorRole().set(aCB.getObjectReference());

cNM.setLockRole(true);

            rColCol.add(cNM);

                }

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Resolved!

Answers (0)