You are viewing limited content. For full access, please sign in.

Question

Question

Conditional Insert vs Update from a Form Table into a Lookup Table (Laserfiche Cloud 12)

asked on February 9

Hi everyone,

I am working in Laserfiche Cloud 12 and would appreciate guidance on how to conditionally insert or update records in a lookup table based on values entered in a form table within a Business Process.

Current Setup

1. Form Table (Business Process Form)

I have a form table with the following columns:

  • Item Name

  • Quantity as Qty

  • Unit Cost

  • Total (Qty multiplied by Unit Cost)

  • Balance

Each row represents a single stock item entered by the user.

2. Master Inventory Lookup Table

I have created a Master Inventory lookup table with the following fields:

  • Item Name

  • Balance at Hand

  • Last Restock Date

This table represents the current stock inventory.

3. Select Rule on the Form Table

A Select rule is applied to the Item Name field in the form table:

  • When a user enters or selects an Item Name, the rule checks the Master Inventory lookup table

  • If a match is found:

    • The Balance field in the form table is auto-populated using Balance at Hand

  • If no match is found:

    • The Balance field remains blank

4. Lookup Table Queries

I have already created two lookup table queries:

  • Insert query – for adding new items

  • Update query – for modifying existing items

5. Workflow Design

In my workflow, I currently have three Run Rule activities:

  1. A Run Rule that inserts data from the form table into the Master Inventory lookup table

  2. A Run Rule that updates the Master Inventory lookup table using values from the form table

  3. A Run Rule that inserts data from the form table into a Stock In Table. This table displays all items that have been stocked into the inventory. It will be used to create Stock In Reports

 

The Problem

I want the workflow to execute conditionally for each row in the form table, depending on whether the item already exists in the Master Inventory lookup table.

Required logic:

  • If the item is new
    (i.e., no match in the Master Inventory lookup table and the Balance field is blank)
    → Insert the item into the lookup table

  • If the item already exists
    (i.e., the Balance field is populated from the Master Inventory)
    → Update the existing record
    → Specifically update Balance at Hand using the value from the Balance field in the form table

What I Need Help With

  • How can this conditional logic be implemented correctly in Laserfiche Cloud 12 workflows?

  • What is the recommended way to evaluate this condition per form table row?

  • When using Run Rule activities, how do I decide whether to execute the Insert query or the Update query for each row?

Any Laserfiche Cloud 12–specific guidance, best practices, or examples would be greatly appreciated.

Thank you in advance for your help.

 

0 0

Replies

replied on February 9
0 0
replied on February 10 Show version history
  1. Add a hidden ID or (_key from the lookup table), to the table on your form
  2. In Workflow - For each row  
    1. Check if an ID exists, i.e., not blank or empty string
      1. If no ID -> insert
    2. Check if a row with that ID exists in the lookup table
      1. If no row exists -> Insert
      2. If a row exists
        1. Check if a column was updated, i.e., not equal to a column from that row
        2. If changes were made -> Update

 

For anyone new reading this, you can access columns for each row of a form table in a foreach as shown here

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.