# Change XML contents during transfer

**URL:** <https://connective.celigo.com/t/change-xml-contents-during-transfer/720>\
**Category:** Integrator.io\
**Tags:** hooks, ftp, transformation, file-transfer, xml\
**Created:** [July 6, 2022, 7:36pm UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720 "2022-07-06T19:36:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepaksharma](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@deepaksharma](https://connective.celigo.com/u/deepaksharma)\
**Post date:** [July 6, 2022, 7:36pm UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/1 "2022-07-06T19:36:34Z")

</div>

Hello everyone,

I am trying to transfer set of XML files from one FTP location to another. Before the transfer I want to change the contents of the XML file, specifically I am looking to change the value of one node . The new value need to be picked up from a separate mapping file which will be updated occasionally.

I managed to transfer the files and change the node value, though I just hardcoded the new value, using presave hook. How can I use a separate mapping file to change the value of that node. My mapping file looks like this.

**Old Code -\> New Code**  
_TESTD03 -\> ON-015_  
_TESTD05 -\> BC-013_  
_TESTD06 -\> BC-010_  
_TESTD07 -\> BC-009_  
_TESTD08 -\> BC-008_  
_TESTD09 -\> BC-007_

The XML file format is as below

\<?xml version="1.0" encoding="utf-8"?\>  
  
c859514.pdf  
CREDIT  
TESTSup01  
TESTD06  
859514  
60  
2022-03-29  
  
CAD  
TESTD06

I'll appreciate any help or suggestion.

Thanks

---

<div class="post-metadata">

**Author:** ![scotthenderson](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/scotthenderson/32/6780_2.png) [@scotthenderson](https://connective.celigo.com/u/scotthenderson)\
**Post date:** [July 11, 2022, 11:16pm UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/2 "2022-07-11T23:16:06Z")

</div>

Can the separate "old code -\> new code" mappings be stored/managed directly in a field mapping in integrator.io? If so, please see pic below for guidance on how to set this up. Or, if you do really need the separate mappings to be managed completely from the external file on the FTP site, then it is also possible to build a separate flow to export the contents of the file, and update the main flow with the mappings. Everything that you do in the integrator.io UI can also be done via the integrator.io API, which means you can use flows to automate setting fields within other flows, etc... Office hours and/or support can help explain these options further.

 ![5301043caa20740200000001-6ddb8eea1c65492b84a7ee0458c0223d.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/2/2fc17e091271d07a73a176f5b5f0a4b3be03c2a8.png)

---

<div class="post-metadata">

**Author:** ![deepaksharma](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@deepaksharma](https://connective.celigo.com/u/deepaksharma)\
**Post date:** [July 22, 2022, 3:42am UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/3 "2022-07-22T03:42:05Z")

</div>

Thanks for the response @scotthenderson. Apologies for the delayed reply, I was out on holidays. It seems I could use field mapping to achieve the desired results but I am stuck on the very first step. When I go and try to create mappings I am getting the following message.

```
The flow "Octacom cXML Invoices - TEST", contains no imports.
```

The "Import flow" does exists in the integration. Is there anything I am missing altogether?

Thanks

---

<div class="post-metadata">

**Author:** ![scotthenderson](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/scotthenderson/32/6780_2.png) [@scotthenderson](https://connective.celigo.com/u/scotthenderson)\
**Post date:** [July 22, 2022, 6:23am UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/4 "2022-07-22T06:23:07Z")

</div>

Can you send a screenshot of your flow, and can you send a screenshot of the error you are getting (with the full page in view) so we can see what you are clicking and seeing, etc...? Please send any other screenshots that you think might help.

---

<div class="post-metadata">

**Author:** ![deepaksharma](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@deepaksharma](https://connective.celigo.com/u/deepaksharma)\
**Post date:** [July 22, 2022, 7:43pm UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/5 "2022-07-22T19:43:48Z")

</div>

Hi Scott,

I just realized I am using "FTP Transfer" in my flow hence the "mapping" is not available. What should be the next step in my scenario? Your technical team has access to our flows and has helped me with the same flow in the past with a different issue. We have until end of next week to make it work and any help will be greatly appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![scotthenderson](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/scotthenderson/32/6780_2.png) [@scotthenderson](https://connective.celigo.com/u/scotthenderson)\
**Post date:** [July 26, 2022, 12:07am UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/6 "2022-07-26T00:07:16Z")

</div>

Can you please read [this](https://connective.celigo.com/t/ftp-to-ftp-xml-document-question/756) community post to see if it helps? It is very hard to help you here without seeing lots of screenshots of your flow, and all the bubble drawers within your flow, etc... I recommend working with support at this point.

---

<div class="post-metadata">

**Author:** ![kathyanaqueeman](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/kathyanaqueeman/32/9122_2.png) [@kathyanaqueeman](https://connective.celigo.com/u/kathyanaqueeman)\
**Post date:** [August 18, 2022, 2:36pm UTC](https://connective.celigo.com/t/change-xml-contents-during-transfer/720/7 "2022-08-18T14:36:57Z")

</div>

Hello @deepaksharma,

Here are the possible solutions provided by our Support staff in your support ticket. I've added these here if anyone else runs across the same issue.

**Option 1** : This is the most straightforward solution. Use the [#compare](https://docs.celigo.com/hc/en-us/articles/360039326071-Handlebars-helper-reference#compare) handlebar.

 ![5301043caa20740200000001-576d14d17f65497a9e1eb15587b8ed7f.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/d/de1e0da4e973153a4dc38c0ca82bfbd712e51ad8.png)

 ![5301043caa20740200000001-f2c661f7405b4793b2414eea1b80db05.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/e/e35ef894f8bcfdc8ac3f759863cb62810902773b.png)

 ![5301043caa20740200000001-8627cc72fb474b3aad86a2680440b6b0.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/a/a9005389128dd28105d55fa6351a1097168037e8.png)

**Option 2:** Use a [presave page hook](https://docs.celigo.com/hc/en-us/articles/360039655111-Export-hooks#preSavePageHook) to match the source data with the new values using a switch statement.   
Example:

```
for (let i = 0; i < options.folder.length; i++) { let result = ""; switch(true){ case (options.folder[i].id === "TESTD03"): result = "ON-015"; break; case (options.folder[i].id === "TESTD05"): result = "BC-013"; break; case (options.folder[i].id === "TESTD06"): result = "BC-010"; break; default: result = "No Code" console.log(result); } options.folder[i].newfield = result }
```

**Option 3:** Have a dedicated lookup step that retrieves the correct code from a database before importing it into FTP, we gave google sheets a try while on a call, but it seems like we cannot reference the values in our sheet. We are only able to reference the specific cell.

 ![5301043caa20740200000001-708dd1adebc645aea3a097aca9125e38.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/2/2042c059cb526e2ec331d599e19e96ed591295ce.png)

**Option 4:** Import the source data as a CSV file first, since when you import as a CSV file using FTP, you get the option to use the mapper and use the static lookup table. Then re-export the CSV file so it can be imported as an XML file with the new node value included.

 ![5301043caa20740200000001-3e1c30992fd349e88035fee320aebe9f.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/3/3f80999235b6932f8307f3480bd4856758c9d2e6.png)
