Action Script to delete a data list row

Hi, I would like to delete a row from a data list using an action script. The row is selected base on two fields (Tracking No and user id). The script must be able to delete the matching row on the Submit action.

If you have any script example to acomplish this I will be grateful.

Regards,

Mauricio.

Method 1: You can implement it through a process, refer to: Configure Set Content List Action – Yeeflow Help Center
Method 2: You can implement it through custom code or API, refer to Public REST API – Yeeflow Help Center
Custom Code Control – Yeeflow Help Center

The data list you mentioned, is it a sublist on form or Data list in Application? For Data list in application, you can also use workflow node Set Data List to delete data by condition.

Thanks Jason & Frank. It is a Data List. Let me explain how it works. You can enter values in certain fields (Tracking No and user) to select a specific row from the list. Once you have filtered the row you want to delete, simply click the “delete” button to remove it. Please note that this action does not involve passing the data list to the next step by clicking “submit”."

@mauro.roa I don’t quite understand your idea yet. Can you put in some hand drawn drawings to describe it? This would be more understandable. Based on my current understanding, your idea is to directly select multiple items in the Data List, then delete the data, and finally submit it?

Hi Mauricio,

Here’s a code sample to remove last row from a Sub list on form. Hope it helps.

import { LIST_ROW_DELETE, MODULE_COMMON } from "./constants";

export class CodeInApplication implements CodeInComp {
    execute(context: CodeInContext, fieldsValues: any) {
        return new Promise((resolve, reject) => {
            const params = context.params;
            const fieldId = params["varId"];
            if (!fieldId) {
                alert("Please configure input parameter: varId");
                resolve(false);
            }

            let list = fieldsValues[fieldId];

            if (list && list.length > 0) {
                //delete last row from list
                list[list.length - 1][LIST_ROW_DELETE] = true;
                context.setFieldValue(fieldId, [...list]);
            }

            resolve(true);
        });
    }

    requiredFields(params) {
        return [params["varId"]];
    }

    requiredModules() {
        return [];
    }

    description() {
        return "Delete last row of a list";
    }

    inputParameters() {
        return [{
            id: "varId",
            type: "string",
            desc: "Varaible ID of the list"
        }] as InputParameter[];
    }
}

Regards,
Frank

Finally, I found that using an HTTP DELETE request as an action step solves the problem: I was able to delete a data list row based on certain filters and by pressing a button. I was trying to implement the data list deletion using code, but without success. Thanks, Frank.