Custom Form Builder Settings-link to the flow

Hello everyone,

I'm currently working on creating a static mapping for a custom flow using the custom form builder.

I would like to know how I can link this to a specific flow? Specifically, I'm wondering if we need to include a unique identifier or ID when mapping to refer to this particular setting. Any guidance on this matter would be greatly appreciated. Thank you!

0

Comments

4 comments
Date Votes
  • Yash Kumar there are 6 different scopes/levels of settings you can use:

    • Integration
    • Connection
    • Export
    • Import
    • Flow
    • Flow group

    Depending on your use case, you would build the form where appropriate. At each level, you specify the unique field id in your form JSON using the "name" attribute.

     

    After that, you can reference the populated fields anywhere you see the settings context in the flow.

    0
  • Hi Tyler,

    Thank you very much for this! I greatly appreciate it.

    In reference to the specific use case, I would like to have my flow to utilize the general setting(Custom form builder) for the Shipping method static lookup(An example). Rather than traditionally mapping it on the import mapping on the flow, I intend to mimic the IA flows working principal here. Please advise!

    0
  • Yash Kumar you would need a script to do this. In my example here, I created a preMap script to compare my field value to the stored settings. After returning the result, you would just map the new field in mapper.

    Premap script:

    /*
    * preMapFunction stub:
    *
    * The name of the function can be changed to anything you like.
    *
    * The function will be passed one ‘options’ argument that has the following fields:
    *   ‘data’ - an array of records representing the page of data before it has been mapped.  A record can be an object {} or array [] depending on the data source.
    *   '_importId' - the _importId currently running.
    *   '_connectionId' - the _connectionId currently running.
    *   '_flowId' - the _flowId currently running.
    *   '_integrationId' - the _integrationId currently running.
    *   'settings' - all custom settings in scope for the import currently running.
    *
    * The function needs to return an array, and the length MUST match the options.data array length.
    * Each element in the array represents the actions that should be taken on the record at that index.
    * Each element in the array should have the following fields:
    *   'data' - the modified/unmodified record that should be passed along for processing.
    *   'errors' -  used to report one or more errors for the specific record.  Each error must have the following structure: {code: '', message: '', source: ‘’ }
    * Returning an empty object {} for a specific record will indicate that the record should be ignored.
    * Returning both 'data' and 'errors' for a specific record will indicate that the record should be processed but errors should also be logged.
    * Throwing an exception will fail the entire page of records.
    */
    function preMap (options) {
      return options.data.map((d) => {
        
        d.field1Mapping = lookupMapping(options.settings.integration.refreshableName,d.field1);
        
        return {
          data: d
        }
      })
    }


    function lookupMapping (arr, key) {
      let o = null;
      let found = arr.find(e => e.extract === key);
      if (found && found.generate) {
        o = found.generate;
      }
      return o;
    }

     

    Working with field1 = 1.

     

    Not working with field1 = 2 because there is no mapping for when vield1 value = 2.

     

    Field mapping with the new field:

    0
  • Thanks Tyler!

    Really appreciate this.

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post