Search Results for

    Show / Hide Table of Contents

    Create delete-object workflow

    Introduction

    In this tutorial, you will learn how to create a workflow to delete books from your bookstore database.

    Guide

    • Step 1. In Casewhere Admin site, navigate to Workflow Definition

    • Step 2. Click Create button

    The Create New Workflow definition dialog will appear

    • Step 3. Config General Setting tab as below
    Field name Actions
    Name Fill in "Delete Book"
    Display Name Fill in "Delete book"
    Used For Creating New Cases Make sure this field is uncheck ☐
    Accept Input ☑
    Require Input ☑
    Window Size Select Small

    image-20211112115412061

    • Step 4. Switch to Data classes tab

    Click Select data classes drop-down, and select "CwBook"

    image-20211104145552710

    Tip: The data classes you just select is the one you made in Create a data class step

    Click Save

    • Step 5. Edit Workflow Definition: Delete book dialog will display

    Drag and drop Form activity definitions from Add Activity Definitions panel to Step 1 container

    image-20211112115707331

    • Step 6: Create Activity Definition: Form will show up.
    Field name Actions
    Name Fill in "Delete book"
    Display Name Fill in "Delete book"

    image-20211110171356473

    • Step 7. Navigate to the Toolbox tab

    Drag and drop Label activity definitions from Toolbox panel to Form1 canvas

    image-20211112120030482

    • Step 8. In the Properties window, looking for Text property
    Field name Actions
    Text Fill in "Are you sure you want to delete this item?"

    image-20211112120132330

    Click Save & Close

    • Step 9. Switch to Navigation tab
    Field name Actions
    'Back' button label ☑
    'Forward' button label ☑
    'Reset' button label ☑
    'Save' button label ☑
    'SaveAndClose' button label Change the string to "Yes"

    image-20211112120221507

    Click Save & Close

    • Step 10. Drag and drop Scripted activity definitions from Add Activity Definitions panel to the step container

    image-20211112120333315

    • Step 11. The Create Activity Defintion: Scripted will open
    Field name Actions
    Name Fill in "Delete Book Script"

    In General Settings, copy and paste the following code

    var dataApi = ctx.Use<IDataApi>(); 
    
    var book= ctx.Input; 
    
    dataApi.Delete(book["Id"]);
    

    image-20211110174353792

    Click on Save & Close

    Now your Edit Workflow Definition: Delete book window should contains two activities in Step 1 panel as show below

    image-20211112121704458

    Good job! You are ready to use this workflow definition in your next step - Create "Delete Book" button.

    • Step 12. Create a button to trigger the workflow

    Follow this guide to create and test a button to make "Delete book" button

    image-20211112121758013

    • Step 13. Reload your page to see the button on-live

    image-20211112121825720

    Good job!

    You are ready to move to the next step

    In This Article
    Back to top Generated by DocFX