Skip to Content
author's profile photo Former Member
Former Member

Check if record is in a workflow (Java API)

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Sep 19, 2008 at 12:21 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 03:15 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 03:12 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.