Delete several records

Delete several records sample flow.

Summary

In this example, we illustrate an action that attempts to delete all companies located in Colorado. In the event that an error is encountered during the deletion of any company, the action diligently logs the error for further analysis. This example showcases a robust workflow for systematically managing the deletion of companies, with error handling to ensure smooth operation.

Delete several records

Step: start

Inputs

No configuration required.

Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action

Step: Find companies

Inputs
LabelValueDescription
CompaniesAllFinds all the companies
Outputs
NameTypeDescription
companiesresultSetPuts the company in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet

Step: Delete all Colorado companies

Inputs

No configuration required.

Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet

Step: For each

Inputs
LabelTypeDescription
CompaniesresultSetIterates the companies.
Outputs
NameTypeDescription
companyrecordPuts the iterated company in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet
- company: record

Step: If CO

Inputs
LabelTypeValueDescription
Conditionconditioncontext.company.field(‘address.state’).val() === ‘CO’;Filter companies from Colorado.
Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet
- company: record

Step: Delete company

Inputs
LabelTypeValue
Recordrecordcompany
Outputs
NameTypeDescription
deletedRecordrecordDeletes the company and does not put it in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet
- company: record

Step: Log error

Inputs
LabelValueDescription
MessageError while deleting companyLogs a message too inform that the delete of the company faild.
Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet
- company: record

Step: end

LabelTypeDescription
Return resultbooleanIf true it will return the final result of the flow.
Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- companies: ResultSet
- company: record