Update several records

Update several records sample flow.

Summary

In this example, we present an action that performs a comprehensive search for all companies located in Arizona. For each company found, it updates the rating value to 5, logs the updated company details, and saves the changes to the database. In the event of an error occurring during the company update process, the error is also diligently logged for future reference. This example illustrates how to efficiently manage and update multiple records within a specific context while handling potential errors gracefully.

Update several records

Step: start

Inputs

No configuration required.

Outputs

No configuration required.

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

Step: Find companies of Arizona

Inputs
LabelValueDescription
CompaniesState equals ArizonaFind companies of Arizona
Outputs
NameTypeDescription
arizonaCompaniesresultSetThe founded companies are put in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet

Step: For Each

Inputs
LabelDescription
arizonaCompaniesIterates the companies.
Outputs
NameTypeDescription
arizonaCompanyrecordPuts the iterated company in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record

Step: Update Rating

Inputs
LabelValueDescription
arizonaCompanyRating Set 5The rating of the company is set to 5.
Outputs
NameTypeDescription
updatedCompanyrecordThe edited company is put in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record
- updatedCompany: Record

Step: Log success message

Inputs
LabelValueDescription
messageSuccessfully updated companyLogs a message too inform that the company was updated successfully.
Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record
- updatedCompany: Record

Step: Log error message

Inputs
LabelValueDescription
messageError while updating companyLogs a message too inform that the update of the company failed.
Outputs

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record
- updatedCompany: Record

Step: Save company

Inputs
LabelDescription
updatedCompanyThe record instance to be saved into the database after applying changes.
Outputs
NameTypeDescription
savedCompanyrecordThe saved company is put in the context.
Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record
- updatedCompany: Record
- savedCompany: Record

Step: end

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

No configuration required.

Context
- record: Record
- oldRecord: Record
- action: Action
- arizonaCompanies: ResultSet
- arizonaCompany: Record
- updatedCompany: Record
- savedCompany: Record