Extra Arguments with Lifecycle Entry Condition Custom Method check D2


I wrote a custom method to check certain attributes and prerequisites and I'm giving couple of arguments with values but when I submit the documents through this Lifecycle, method does trigger but it's not able to read these arguments which I'm passing.

I cleared JMS cache, D2 app server cache and restarted docbase with no luck.

Is there anything that I'm missing ? Is it so that during the entry validation checks arguments with $value(r_object_id) is not passed ?

Hope to find some answers.

D2 version is 4.5 running on 7.3 CS.


  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM
    edited December 5, 2018

    In the D2 Lifecycle action, you can set the 'Extra arguments' to pass parameters - for example:

    -id $value(r_object_id) -login_user "$USER"

    It is possible then to read it in the JMS Method class with code similar to:

    public class ABC_MyMethod implements IDfModule, ID2Method
        private IDfId objectId = null;
        private String userName = null;
        public D2methodBean execute(IDfSession idfSession, IDfSysObject idfSysobject, Locale locale,
            ArgumentParser argumentParser) throws Exception
               // Read the JMS Method parameters set on the Lifecycle action
               this.objectId = argumentParser.getIdArgument("-d", null);
               this.userName = argumentParser.getStringArgument("-login_user", null);

    Pedro Maia
    Senior Consultant

  • Hi Pedro!

    Thanks for the input!

    This is something new to me and it'd be great if you let me know which libraries are necessary for ID2Method to implement ?

    I was implementing it this way:

    public class MyClass extends DfSingleDocbaseModule implements IDfMethod {
        private IDfClientX clientX = null;
        private IDfClient client = null;
        private IDfSession initializeSession() throws DfException {
            if (this.clientX == null)
                this.clientX = new DfClientX();
            if (this.client == null)
                this.client = clientX.getLocalClient();
            return getSession();
        public int execute(Map parameters, PrintWriter out) throws Exception {
            // TODO Auto-generated method stub
            LOG.info("Executing Pre Digital Delivery Check Execute Method");
            int result = 0;
            IDfSession session = initializeSession();
            String docID = getParameterValue(parameters,"id");
            String AttributeName = getParameterValue(parameters,"AttrName");
  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM

    To be able to compile the JMS Method which extends ID2Method you need:

    • DFC
    • D2 Jars (found in the Application Server at 'webapps\D2\WEB-INF\lib')

    Pedro Maia
    Senior Consultant

  • Update:
    I found the d2-API.jar which is necessary for it.

    I'm having problems with ArgumentParser though :(

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM

    'ArgumentParser' is in 'C6-Common-4.7.0.jar', which is located at 'webapps\D2\WEB-INF\lib' as stated above.

    Pedro Maia
    Senior Consultant

  • Got it!

    Thank you!

    I'll try implementing it and let you know :smile:

  • By the way, what is the return value that's expected from this method ?

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM
    edited December 5, 2018

    On success return:

    D2methodBean methodResult = new D2methodBean(D2Method.RETURN_SUCCESS_STR, null);

    On failure return something like:

    methodResult = new D2methodBean(D2Method.RETURN_FATAL_STR, e.getMessage());

    Pedro Maia
    Senior Consultant

  • Thank you, Pedro!

    I implemented this method and deployed it for the lifecycle.

    Even though the transition seem to be carried forward, I don't see any messages that I had written as system.out.println in the method in JMS log.

    And even though the condition is not met, I don't see the failed message.

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM

    Some quick notes:

    • You should not be using System.out.println() to send messages to the logs - try using the DfLogger class
    • You need to deploy the ID2Method in Composer with:
    method_verb = com.emc.d2.api.methods.D2Method -class_name my.package.MyConditionMethod
    • You should remote debug the code to see if it is being executed and working as expected.

    Pedro Maia
    Senior Consultant

  • Alright!

    I just quickly wanted to check by using println statements and I know that it's a bad practice :neutral:

    Yeah, I've added Id2Method in Composer and then deployed it. I'll try adding DfLogger statements to see if i can see these statements in JMS logs

  • Update: Even with DfLogger statements I couldn't see any output to JMS log :(

    I tried to run this method through DA and I could at least see these messages in JMS:

    ERROR [default task-18] com.documentum.mthdservlet.DoMethod - Exception invoking com.emc.d2.api.methods.D2Method.
    2018-12-05 15:13:27,666 ERROR [io.undertow.request] (default task-18) UT005023: Exception handling request to /DmMethods/servlet/DoMethod: javax.servlet.ServletException:

    But nothing when initiating this method through lifecycle

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM

    I know nothing of the setup in your environment, but check if the D2 JAR files are placed in the JMS server at:

    Regarding the logs, I'm afraid it is not a simple subject - take at these articles which might help you:

    Pedro Maia
    Senior Consultant

  • I'm able to see all the necessary D2 libraries under that location:

    I'm now doubting the way I deployed this method using Composer, as when I add this JAR definition and necessary module, when I tried to add the class name it complained about missing D2 API interface, as such I had to add D2-API to the JAR definition as well to be able to pick the class name. Is there a different procedure to deploy this kind of D2 methods ?

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM

    As I explained above, this is the correct way of adding your D2 Method in Composer:

    Pedro Maia
    Senior Consultant

  • Thanks Pedro!

    But I always have deployed my methods in Module format and this is something new. I've done something like this and I used Eclipse (not composer) to develop method and I exported my method class in the form of JAR and then added it under JAR definition.

    By following your way, is it so that I've to write code right into Composer Class and then deploy it ?

  • PedroMaiaPedroMaia Senior Consultant (OpenText) EM
    edited December 6, 2018

    It is correct to create the JAR in Eclipse and then use Composer to create the DAR (I do the same). The problem is that creating the JMS Method with command com.emc.d2.api.methods.D2Method doesn't allow to deploy the Method as a Module. You have to deploy the JAR manually in the JMS Server at:
    If you manage to deploy as a Module, let me know as I couldn't make it work either.

    Pedro Maia
    Senior Consultant

  • Hi Pedro!

    It doesn't work if its module. I had to copy that JAR file to > ../jboss7.1.1/server/DctmServer_MethodServer/deployments/ServerApps.ear/lib

    It'd have been good if these can be deployed as Modules as it'll reduce the dependency on the libraries to be copied on the CS :neutral:

    Anyway, thank you for all the help and if you happen to find any way around for making it a module in future, please let me know.

Sign In or Register to comment.