Get selected object's ID on custom dialog in D2

prg_ab_ch
edited August 4, 2014 in Documentum #1

Hi,

How can i get the selected object's ID on a custom created dialog (using plugin). When i right click on the object and choose a custom menu option like "Modify", I want an action to be called that would popup the dialog having the selected object's ID.

Thanks and Regards,

Abhishek

Tagged:

Comments

  • stbu
    edited March 11, 2014 #2

    Hi.

    Did you find a solution to your requirement? I have a similar requirement and would be glad for some help.

    Best Regards,

    Stefan

  • prg_ab_ch
    edited March 11, 2014 #3

    Hi Stefan,

    I trying the same. If i am trying to do it, i will let you know.

  • vijaysince89
    edited May 13, 2014 #4

    Hi All,

               I'm in need of such same requirement. Please some one post an answer with sample code and snapshot.

    Thanks in advance.

  • shreya1687
    edited June 25, 2014 #5

    Hi All,

    I also have the similar requirement.If any one of you found a solution ,please share.

    Thanks in advance

  • gamidi_gamidi
    edited August 4, 2014 #6

    Hi,

    You will get selected object Id in your custom dialog plugin from D2fsContext context parameter in follwoing method

    public XmlNode buildDialog(D2fsContext context, List<Attribute> attributes).

    see below code snippet:

    public XmlNode buildDialog(D2fsContext context, List<Attribute> attributes){

        IDfPersistentObject persistentObject = context.getFirstObject();  

        if ((persistentObject != null) || ((persistentObject instanceof IDfSysObject)))

        {

          IDfSysObject sysObject = (IDfSysObject)persistentObject;

            IdfId selected_Id =  sysObject.getObjectId();

    }

  • But D2fsContext context parameter always have one object in it even when the dialog is triggered from multi document selection. Any solution to get the context of all selected documents in custom Dialog?

  • D2fsContext contains all selected documents. Code for getting all objects:

    ArrayList<IDfPersistentObject> objList = new ArrayList<IDfPersistentObject>();
            for (int i = 0; i < d2fsContext.getObjectCount(); ++i) {
                objList.add(d2fsContext.getObject(i));
    }
    

    Hope it helps someone.
    PL