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

Different ways to delele an instance of a custom BO?

Dear experts,

how many choices do we have in order to delete an instance of a customer BO?

e.g.

businessobject MyCustomBO {

[AlternativeKey ] element ID : ID;

element e1 : aType;

...

}

Right now I only know 1 way which is using a stackpanel in OWL --> eventhandler --> list --> remove row --> bind to data list

In the documentation, there is a short paragraph: but it does not delete the BO in the root level but the node beneath it.

@Fred K has suggest another workaround in the comment of the post How Queries and DefaultSets work on OWL but it does not work for me.

Much appreciate your help.

Best regards

Linh

7.2.4.19 Delete Instance (Business Logic)
Syntax <this | NodeInstanceVar>.Delete();
Description The Delete operation, which uses the inverse semantics of the Create operation, can only be called in the
instance-based variant and must be applied to business object nodes. The reason is that the instance to
be deleted must be identified by the preceding member path expression. The Delete operation can also be
applied to collections of business object nodes.
Example foreach (var BO in TestBO.QueryByElements.Execute()) {
if (BO.Name == "delete") {
BO.Delete();
}
}
Deletion of a collection of nodes:
TestBO.QueryByElements.Execute().Delete()


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Sep 14, 2015 at 12:14 AM

    Hi Linh,

    Have you tried with BOOperation READ?

    It actually works for me. 😊 And I think that is a good way.

    1. Bind Root with Custom BO

    2. Bind DataList with Custom Query

    3. Bind a data field under Datalist with the NodeID from Custom Query.

    4. Create an event handler.

    5. Add BOOperation READ and read Custom BO using NodeID

    6. Add delete BOAction with instance binding to ROOT.

    Dont forget to check "Save After Execution".

    The delete BOAction should only include (this.Delete() ).

    I recommend to recreate the UIs and test. 😊

    Good luck,

    Fred

    Add a comment
    10|10000 characters needed characters exceeded

    • I know this thread is 4 years old now, but I stumbled across it after hitting the same problem where the delete action gets called in an infinite loop. It turns out naming the action Action-Delete.absl (as per latest screenshot) results in the call to this.Delete() getting rerouted to that action - so the action ends up just calling itself over and over again. After changing the name to something else like Action-DeleteInstance.absl it then calls the normal Delete() function which removes the instance, and no more infinite loop!

      BR,
      Simon

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.