ImpulseSync™ User Manual
HomePricingContact Us
  • Introduction
    • What is Impulse?
  • Crash Course of ImpulseSync
    • Overview Of ImpulseSync
    • Step 1: Endpoints
      • Endpoint Configuration
    • Step 2: Jobs
      • Job Configuration
      • Step 2a: Content manipulators
      • Step 2b: Content mapper
    • Step 3: Syncing
  • Getting Started
    • Core Concepts
    • Creating Endpoints
    • Creating Jobs
    • Starting a Transaction
    • Transaction Reports
    • Automating Jobs with Pipelines
    • Scripting Post Sync
    • Scheduling Jobs and Pipelines
    • Dashboard
    • Managing Jobs/Pipelines
    • Content Mapper
      • Aligning Mismatched Content
      • Connector Matrix
      • Locked Fields
      • Content Aligner
      • Aligning Content Challenges
  • Reports
    • Reports Screen
    • Debug Report
    • Messages
  • Connectors
    • Common Job Options
    • All Connectors List
    • Source Connectors
      • Contentful
      • Contentstack
      • dotCMS
      • Drupal v7
      • Drupal v9
      • GitHub
      • GraphQL
      • MS Teams
      • SCP
      • Snapshot
      • Strapi v3
      • Strapi v4
    • Destination Connectors
      • Contentful
      • Contentstack
      • dotCMS
      • SCP
      • Strapi v3
      • Strapi v4
  • Content Manipulators
    • Common Manipulator Options
    • Add Replace Field
    • AI(Artificial intelligence)
    • Change ID Manipulator
    • CSV Store Manipulator
    • Dynamic Job Store Manipulator
    • File to Text
    • Folder Manipulator
    • Get and Set Field
    • Language
    • Liquid Field
      • Liquid On the Quick
      • Basics
        • Impulse Values
        • Impulse Variables
        • Operators
        • Truthy and falsy
        • Types
        • Whitespace control
      • Tags
        • Control flow
        • Impulse Content Objects
        • Iteration
        • Utility
        • Variable
      • Filters
        • abs
        • append
        • capitalize
        • ceil
        • compact
        • concat
        • date
        • date_str
        • default
        • divided_by
        • downcase
        • escape
        • escape_once
        • first
        • floor
        • getStoredValue
        • htmlQuery
        • htmlReplace
        • idMap
        • join
        • jq
        • json
        • last
        • lstrip
        • map
        • minus
        • modulo
        • newline_to_br
        • plus
        • prepend
        • remove
        • remove_first
        • replace
        • replace_first
        • reverse
        • round
        • rstrip
        • section
        • sections
        • size
        • slice
        • sort
        • sort_natural
        • split
        • str_to_date
        • strip
        • strip_html
        • strip_newlines
        • times
        • truncate
        • truncatewords
        • type
        • uniq
        • upcase
        • utl_decode
        • url_encode
      • Liquid Playground
    • Markdown
    • Regex
    • Relationship
    • Store Field
    • Tidy
  • Time Machine
    • Snapshot
    • Viewing Snapshots
    • Delivery from Snapshots
  • Cookbook Recipes
    • Adding Fields
    • Aligning Content between Endpoints
    • Avoid overriding Fields
    • Avoid syncing Content Types
    • Combing Fields
    • Default Field Value
    • File (.doc) to Structured Content
    • File (.docx) to Structured Content - Expanded
    • HTML to Structured Content
    • Language (Locale) mismatch between endpoints
    • Paths/IDs Changed
    • Reference to Value
    • Single Content Type to Multiple
    • Splitting Content with Reference
    • Syncing Content with Languages
    • Text Select to Boolean
    • Text to Reference
    • Text to Reference - liquid
    • Two Sources to One Destination
    • Changing a folder path
    • Combining data between content types
    • Converting HTML Sections
    • JSON object to reference
    • Use CSV to convert values
    • Storing fields with Store field motator
  • Troubleshooting
    • What to do if I run into a Job Problem
    • Troubleshooting via UI
    • Submitting a ticket
  • Using Impulse Headlessly
    • Getting Started with cURL
      • Creating Endpoints
      • Creating Jobs
      • Starting a Transaction
      • Transaction Reports
      • Automating Jobs with Pipelines
      • Scheduling Jobs and Pipelines
      • Aligning Mismatched Content
      • Scripting Post Sync
  • Organization Tier Restrictions
  • Content Storage Options
Powered by GitBook
On this page
  • Case
  • Solution
  • Array of relationships
  1. Cookbook Recipes

Text to Reference - liquid

PreviousText to ReferenceNextTwo Sources to One Destination

Last updated 1 year ago

Case

Assuming the content being synced has a text field that references a content at the destination. We want to take the text field, match it to a content, and create a relationship field at the destination system to that content.

In this example we have a file with a bit of text that has the name of a ship. This ship is already a content in the destination system and we want to sync this file with a relationship field to that existing ship content.

We need to be able to

  1. Get the existing ship content ID

  2. Set the ship content ID in the synced content

Solution

Configure pre-requisite job

First we will configure a pre-requisite job. This job will pickup the ship contents and store their IDs with the key being the name of the ship.

Because this job will not deliver content and only store content it does not need a destination endpoint.

The job will have a store-field manipulator configured to store the content ID in a key value pair where the key is the name of the ship and the value is the content ID.

The optional parameters Storekey and Storevalue are used to create the key and value pair to be stored. These config paramters use liquid templates to build the key and value.

Configure primary job

Once the pre-req job is configured we can then configure the primary job to make use of the stored values.

This primary job will make use of a liquid-field manipulator to retrive the stored content ID and set it into a Motation relationship field to be synced.

Because the source content is a file, we make use of the section filter to parse out the ship name exact ship name to be referenced. Other systems may simply have the name of the ship directly in a field and not need any additional parsing.

Once we have the name of the ship, we use the getStoredValue filter to retrieve a stored value based on the passed in key. In this case the passed in key is a variable called storeKey which has the value of the ship name. So we will get the stored value (content ID) for the passed in ship name.

Configure storage/pipeline

Because we're using the store-field manipulator to store data and in another job attempting to retrieve that stored data, we need to be able to store the data across jobs. Certain plans allow for data to be stored permanently. If you have that plan and want to store the data permanently, you will need to set the Storecontent job option on the endpoints for these jobs that will store and retrieve the data.

If you want to temporarily store the data for the length of these jobs, you must set them together in a pipeline. Jobs in a pipeline make use of the same temporary storage, allowing for jobs to store and retrieve data between each other in the same pipeline. All stored data in a pipeline will be deleted once the pipeline is finished.

Once the storage option is configured, run the jobs/pipeline and view the synced content.

Array of relationships

The same solution can be expanded for an array of relationships as well.

First, create a pre-req job using the same or simillar config.

Then in the primary job, the liquid template could look something like this.

Notice the additional logic to iterate through an array of text values, and properly create a Motation Relationship field object to be synced. (i.e., watch for comma placements, empty values, etc.)

And at the destination you have a relationship/reference field with multiple related content.

ImpulseSync can solve this with a couple jobs using the and (using ) manipulators.

Because we are creating a relationship field, we will also need to use the Impulsefieldvalue config option with the value ImpulseValue . This tells the manipulator to create a specific Impulse value field, rather than set the value to a default field. More details can be found in the .

store-field
liquid-field
getStoredValue filter
liquid doc