The CreatorCon Call for Content is officially open! Get started here.

Trasfering data using flow designer

PALAVALASAB
Tera Contributor

Hi All,
I need to trigger a flow when a new datasource is created. The data should be transferred to the target table using the Flow Designer. How can I achieve this?

6 REPLIES 6

BhanuchandeG
Mega Contributor
1. Create a Trigger
Go to Flow Designer.
Click New Flow.
Set the Trigger to something like: 
Record Created (if the datasource is a record in a table).
Choose the Datasource Table as the trigger source.
2. Add Conditions (Optional)
Add a condition to ensure the flow only runs for specific types of datasources if needed.
3. Add Action: Transform Data
Use an action like Script, Data Transformation, or Integration depending on your platform.
Map the fields from the datasource to the target table.
4. Add Action: Insert into Target Table
Use the Create Record or Insert Row action.
Select the Target Table.
Map the transformed data fields to the target table fields.
5. Test the Flow
Create a new datasource record.
Verify that the flow triggers and the data is correctly inserted into the target table.
Example in ServiceNow Flow Designer:
Trigger: When a record is created in u_datasource.
Action 1: Transform data (e.g., via Script or Data Pill Mapping).
Action 2: Create record in u_target_table.

vignesh parthib
Tera Guru

Hi @PALAVALASAB 

Create a New Flow in Flow Designer

Steps:

  1. Trigger:
    • Click Add Trigger
    • Table: Data Source [sys_data_source]
    • Trigger: Created
  2. Step-by-Step: Using Script Action in Flow Designer
    • After the Trigger, click + to add an Action
    • Select Script (you may need the Script step enabled)
    • Paste the following script:

var importSetRunner = new GlideImportSetLoader();

    var importSetRec = importSetRunner.getImportSetTableName(current.sys_id);

 

    if (importSetRec) {

        var importSetId = importSetRunner.createImportSet(current.sys_id);

       

        var transformer = new GlideImportSetTransformer();

        transformer.setImportSetID(importSetId);

        transformer.transformAllMaps();

       

        gs.info("Data Source imported successfully. Import Set ID: " + importSetId);

    } else {

        gs.error("Failed to get import set table for data source: " + current.name);

    }

   

 

Thank you

if my response is helpful please mark as helpful and accept the solution