cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain start and end time of each step

Former Member
0 Kudos

I want to obtain the start time and end time of each step in a job (defined in Workflow). Is there any possible way of getting this information

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This is how you can see the details:

1. Go to the "Workflows" tab in the lower part of the data manager

2. Right-click on a particular workflow

3. Select "Show History". This will tell you when what step was kicked off etc.

Regards,

Sayontan.

Former Member
0 Kudos

Hi Sayontan,

Is there any provision in the Java API so that i can obtain the same information which ' Show History ' is displaying regarding the MDM workflow?

Regards,

Sarah

Former Member
0 Kudos

Hi Sarah,

In the MDM4J APIs there is a class called a2i.workflow.SimpleTask that has methods to get the times (the methods are called GetStartTime(), GetEndTime(), GetArrivalTime() etc.). Here is how you can leverage the APIs (code extracted from <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/771f1a61-0e01-0010-daa9-93a52905da09">Integrating Universal Worklist in SAP Master Data Management</a>):


    // how to get the WF Jobs/Tasks of a user already connected to catalog
    tasks = catalog.GetWorkflowTasks(Task.ALL);
    for (int i = 0; i < tasks.length; i++) {
        // process a task
        Task task = tasks<i>;
        TaskCommand tc = catalog.GetTaskCommands(task);
        if (task.GetType() == Task.JOB_TASK_TYPE) {
            // task is an MDM WF Job, and the allowed
            // operations on this Job are in tc
        }
        else if (task.GetType() == Task.SIMPLE_TASK_TYPE) {
            // task is an MDM WF Task, and the allowed
            // operations on this Task are in tc
        }
    }

Hope this helps.

Sayontan.

Former Member
0 Kudos

Hello Sayontan,

Thanks for your reply. I suppose that this works for only those tasks which are currently active. Is there any provision that i can also obtain the time for a task that has been completed.

Thanks

Sarah

Former Member
0 Kudos

Hi,

The Task.ALL parameter brings all jobs and tasks over - completed or otherwise. Also, if you look at the code snippet it says Task.JOB_TASK_TYPE and Task.SIMPLE_TASK_TYPE. The Job task type is the entire workflow job and the Simple Task Type is a single task within the workflow. You can modify the code segment that I gave you:


    // how to get the WF Jobs/Tasks of a user already connected to catalog
    tasks = catalog.GetWorkflowTasks(Task.ALL);
    for (int i = 0; i < tasks.length; i++) {
        // process a task
        Task task = tasks<i>;
        TaskCommand tc = catalog.GetTaskCommands(task);
        if (task.GetType() == Task.JOB_TASK_TYPE) {
            // task is an MDM WF Job, and the allowed
            // operations on this Job are in tc
        }
        else if (task.GetType() == Task.SIMPLE_TASK_TYPE) {
            // task is an MDM WF Task, and the allowed
            // operations on this Task are in tc
            SimpleTask simpleTask = (SimpleTask) task;
            int taskStatus = simpleTask.GetStatus();
            // taskStatus gives you the status of the task. 
            // If it is Task.COMPLETED then you have identified a completed task.
            // You can get the completion time etc. from this. 
            // If you want to identify the workflow job, the job id etc. associated, use this:
            simpleTask.GetJob().GetID();
        }
    }

You could also modify the "if" part of the loop and identify completed jobs based on that.

Similar code is built into the out-of-the-box MdmUwlConnector that is provided for UWL integration for MDM.

Sayontan.

Answers (1)

Answers (1)

Former Member
0 Kudos

This is quite interesting.

May I know why do want to know the time taken by each process in the work flow?

Thanks,

ArunPrabhu S