cancel
Showing results for 
Search instead for 
Did you mean: 

Check if record is in a workflow (Java API)

Former Member
0 Kudos

Hello

I am writing a short Java application that deletes records in MDM. But I get an error message when the record I try to delete is in a workflow. So, since this record is in a workflow, I do NOT want to delete it. Is it an easy way to check if a record is in a workflow (I do not check out records in the workflow)?

Regards, Anders

Accepted Solutions (1)

Accepted Solutions (1)

namrata_d
Active Participant
0 Kudos

Hi Anders,

You can first fetch all the Worflows for that particular user using RetrieveWorkflowTasksCommand.

Then iterate through the retrieved workflowTask object.

And by using the objWFTask.getJob().getRecords()[0] compare the RecordID of the Record that

are deleting with this RecordID. If it exists ur record is part of some another workflow.

Hope this helps you.

Thanks

Namrata

Former Member
0 Kudos

Hi..

Thanks for your replays. The status of the record is set to NOT_LOCKED even if the record is in the workflow. So I had to loop through all active workflows to check if the record I wanted to delet was in on of the active workflow. So, I found a sollution. But, if there are too many active workflows, I get a java-out of memory exception... Have to handle this to...

So, thanks for your answers, my problem is solved.

Regards, Anders

Answers (2)

Answers (2)

Former Member
0 Kudos

oops got it , so you are not checking the record out.

Try using this one, my guestimate, atleast the record should be locked out if not checked out !

public class RecordLockingResult

extends java.lang.Object

A container class indicating the locking/unlocking result.

Field Summary

static int LOCK_BY_CURRENT_SESSION

static int LOCK_BY_OTHER_SESSION

static int LOCK_FAILURE

static int NOT_LOCK

Former Member
0 Kudos

use this

public static interface Record.CheckoutStatus

Constants for Check-out Status of Record

Field Summary

static int MEMBER

The record is checked out and the user is a member of the checked out record.

static int NON_MEMBER

The record is checked out and the user is not a member of the checked out record.

static int NONE

The record is not check out.

static int ORIGINAL

The record is checked out and this is the original record.

static int OWNER

The record is checked out and the user is the owner of the checked out record.

static int UNDEFINED

Undefined check out status.

http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/data/Record.CheckoutStatus.html