This article explains how to use the lookup handlebar at the record level to implement static and dynamic lookups in an HTTP application import.
This lookup option occurs during import mapping, in order to perform an additional query prior to syncing records. Do not confuse this import setting with the results mapping for a lookup flow step, which retrieves records or files using an additional flow step. Import lookup settings allow you to retrieve data from a secondary resource within the import mappings of an import flow step.
If the data available in your source application is insufficient or incomplete for the purposes of your integration, but the required information can be retrieved from a secondary source, you can use a lookup to supplement source data entering an import application. You can use static and dynamic lookups at the record level for an HTTP import of JSON and XML media types. For more information, see Lookup field mapping.
Note
You must be familiar with the expected JSON or XML request body template for the HTTP import.
-
Click the mapping ( ) button in the center of the import step. The Edit mapping window opens.
-
Click the Settings ( ) button next to the field you are mapping. The Settings window opens.
-
In the Field mapping type section, click Lookup.
-
Select Dynamic search in the Options section.
-
Enter the Relative URI.
-
Select an HTTP method.
-
Enter the Resource identifier path.
-
Enter a unique value in the Name field so that you can identify this lookup later.
-
Click Save.
-
Click the mapping ( ) button in the center of the import step. The Edit mapping window opens.
-
Click the Settings ( ) button next to the field you are mapping. The Settings window opens.
-
In the Field mapping type section, click Lookup.
-
Select Static: Value to value in the Options section.
-
Enter the appropriate values for Export field value and Import field value.
-
Enter a unique name in the Name field so that you can identify this lookup later.
-
Click Save.
You can reference data retrieved from existing lookups in a flow with the following handlebars syntax.
Dynamic mapping:
{{lookup.<lookup name>}} Ex: {{lookup.typeLookup}}
Static mapping:`
{{lookup '<lookup name>' this.<Export Field Name>}} Ex: {{lookup 'vendor_status' this.ExportFieldName}}
See Handlebars helper reference for more information.
Comments
For more information on how you can use advanced lookups in tandem with response mappings, take a look at this article: Response mapping and advanced lookups.
Confirmed that the Create HTTP import mapping with static or dynamic lookup doesn't include the actual valid handlebar expression by adding single quotes on the "lookup name". The following should have the actual Lookup handlebar syntax:
{{lookup '<lookup name>' this}}
{{lookup '<lookup name>' this.<Export Field Name>}}
Just provide the <lookup name> and <Export Field Name> and that should work. The HTTP Lookup Preview might not show the correct details (i.e., "{ASYNCID$0$8$}") though this is just a Preview interpretation. Running the flow would confirm the actual results of the lookup.
Thanks Ricko Borja, I revised the article per your correction.
Tom
When I click on an HTTPS Import I don't have an import mapping icon. I've ready the beginning of this page a couple times to make sure I'm not missing something? When I click on the "+" icon on the HTTPS Import my only options are: Transformation, Output Filter and Hook.
Hi, Steve Klett. Is the import a file transfer (upload)? That would be the expected behavior, if so; the "mapping" is done in the request body. Otherwise, we need to have someone look at your flow and delve a little deeper.
Stephen Brandt, your question made me look into this and I see what's happening. The API I'm calling is terrible and uses GET requests with URL params to do everything. So although I'm creating orders in their system I need to use HTTP GET to accomplish it. This forces me to create a lookup type HTTP import which is why there isn't any mapping. If I choose an Import type HTTP node the GET method isn't available.
For what it's worth, here's a real world example with a pretty large 3PL where the IIO (integrator.io) tools don't 100% fit the requirements (i.e., import using a GET).
Thanks for the reply!
Thanks, Steve Klett, for pointing me in the right direction. I'll share your feedback and use case with mapping product management. Sorry about the extra work you're having to do.
I appreciate you taking the feedback to the crew - no need to apologize, the tool will get better and better!
Please sign in to leave a comment.