Want to create a Workflow from Process using Documentum Rest API or DQLs.

Options

I am using documentum Rest APIs and DQLs for my NodeJs application. I want to start/create workflow of documentum from a process using Rest APIs or DQLs. Following is the implementation in Java which needs to be migrated into NodeJs application. Since NodeJs does not has any library for documentum so I am using Rest APIs and DQLs for uploading documents etc.

                    IDfSysObject dfSysObject = (IDfSysObject) sess.getObject(objectId);
        dfSysObject.setString("ecm_attr_audited_by", null);
        dfSysObject.setTime("ecm_attr_audited_date", null);
        dfSysObject.save();

        IDfList objList = new DfList();
        objList.append(objectId);

        String query = "select object_name, r_object_id from dm_process " + "where object_name='ImportAuditWorkflow' " + "enable(DB2('with ur'))";
        // execute the DQL query
        DfExSimpleQuery exSimpleQuery = new DfExSimpleQuery();
        col = exSimpleQuery.execQuery(sess, query);

        if (col.next())
        {
            workFlowName = col.getString("object_name");
        }
        col.close();
        IDfProcess idfprocess = (IDfProcess) sess.getObjectByQualification("dm_process where object_name = '" + workFlowName + "'");

        if (idfprocess == null)
        {
            LOGGER.error("No valid processes to start");
        }

        // get the instance of IDfActivity for the start activity
        IDfActivity idfactivity = (IDfActivity) sess.getObject(idfprocess.getActivityDefId(0));
        LOGGER.debug(" Package Name : " + idfactivity.getPackageName(0));

        // create the workflow builder instance for the workflow.
        IDfWorkflowBuilder wfBldrObj = sess.newWorkflowBuilder(idfprocess.getObjectId());

        // get the start activity name
        IDfList actNames = wfBldrObj.getStartActivityNames();
        String strActName = actNames.getString(0);

        // get the input port name and package name for the activity
        strPortName = idfactivity.getPortName(0);
        strPackageName = idfactivity.getPackageName(0);
        strPackageType = idfactivity.getPackageType(0);
        LOGGER.debug("Package name" + strPackageName);

        LOGGER.debug("packageName=" + strPackageName + "  activityName=" + strActName + " portName=" + strPortName);

        // initiate the workflow
        IDfId wfId1 = wfBldrObj.initWorkflow();
        IDfId wfId2 = wfBldrObj.runWorkflow();

        // get the workflow object from the Workflow Builder
        wf = wfBldrObj.getWorkflow();

        IDfId wfwid = (IDfId) wfBldrObj.addPackage(strActName, strPortName, strPackageName, strPackageType, null, true, objList);