Update several records sample flow

Summary

This example is an action that searches for all the companies in Arizona. For each company updates the rating value to 5. Logs the updated company and saves it on the database. In case of an error while updating a company, it will be logged.

Update several records sample

Step: Start

Inputs

No configuration is needed.

Outputs

No configuration is needed.

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

Step: Find companies of Arizona

Inputs
Label Type Value Description

Companies

State equals Arizona

Searches for all the companies in Arizona.

Outputs
Name Type Description

arizonaCompanies

resultSet

The founded companies are put in the context.

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

Step: For Each

Inputs
Label Type Value Description

arizonaCompanies

Iterates the companies.

Outputs
Name Type Description

arizonaCompany

record

Puts the iterated company in the context.

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

Step: Update Rating

Inputs
Label Type Value Description

arizonaCompany

Rating Set 5

The rating of the company is set to 5.

Outputs
Name Type Description

updatedCompany

record

The 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
Label Type Value Description

Message

Successfully updated company

Logs a message too inform that the company was updated successfully.

Outputs

No configuration is needed.

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

Step: Log error message

Inputs
Label Type Value Description

Message

Error while updating company

Logs a message too inform that the update of the company faild.

Outputs

No configuration is needed.

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

Step: Save Company

Inputs
Label Type Value Description

updatedCompany

The record instance to be saved into the database after applying changes.

Outputs
Name Type Description

savedCompany

record

The 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
Label Type Value Description

Return result

boolean

If true it will return the final result of the flow.

Outputs

No configuration is needed.

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