# Javascript Code (Zapier -\> Make.com)

**URL:** <https://community.make.com/t/javascript-code-zapier-make-com/22182>\
**Category:** Questions\
**Tags:** functions\
**Created:** [December 18, 2023, 8:32pm UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182 "2023-12-18T20:32:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kreative](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/kreative/32/21503_2.png) [@Kreative](https://community.make.com/u/Kreative)\
**Post date:** [December 18, 2023, 8:32pm UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/1 "2023-12-18T20:32:57Z")

</div>

Hello,

I have a code that works in Zapier, but I’m having trouble getting it to work in [Make.com](http://Make.com) using the “0codekit” module.

My Code:

```auto
//Kitchen Countertop Dimensions, Number of Cabinets, Number of Fronts, Number of Shelves
const inputText = inputData['daten'];

const matches = inputText.match(/Length of Kitchen Countertop\s*\d*\s*:\s*(\d+(\.\d+)?)/g);
const result = matches && matches.length > 0 ? {} : "none";

if (matches) {
  matches.forEach((match, index) => {
    const [, value] = match.split(":").map(s => s.trim());
    const numValue = parseFloat(value.replace(",", "."));
    result[`Length of Kitchen Countertop ${index + 1}`] = isNaN(numValue) ? value : `${numValue} m | `;
  });
}

const korpusRegex = /Cabinets :[\n\s]*- (\d+)/i;
const match = inputText.match(korpusRegex);
const result2 = match ? `${match[1]} pcs.` : "none";

const endText = "Foil for Fronts :";
const outputText = inputText.substring(0, inputText.indexOf(endText))
                             .replace(/\d+X Shelf/g, "")
                             .replace(/\[n\]\s*/g, "\n")
                             .replace(/:.*/g, "")
                             .replace(/(?:N|U|K|F)\d+/g, "")
                             .replace(/[^\d\n+X]+/g, " ")
                             .replace(/\s+/g, function(match, offset, string) {
                                if (string[offset - 1] === "X") {
                                  return " ";
                                }
                                return "+";
                             })
                             .replace(/\++/g, "+")
                             .replace(/^\+|\+$/g, "")
                             .replace(/X/g, "*");

const result3 = eval(outputText) ? `${eval(outputText)} pcs.` : "none";

const regalMatches = inputText.matchAll(/((\d+)?X\s*)?Shelf/g);
let totalShelves = 0;

for (const regalMatch of regalMatches) {
    const multiplier = regalMatch[2] ? parseInt(regalMatch[2], 10) : 1;
    totalShelves += isNaN(multiplier) ? 0 : multiplier;
}
............. some more code .......

const plzMatch = inputText2.match(plzRegex);
const cityMatch = inputText2.match(cityRegex);
const addressMatch = inputText2.match(addressRegex);
const infoMatch = inputText2.match(infoRegex);

let outputInfo = {};

if (plzMatch) {
  const plz = plzMatch[1].trim();
  outputInfo["ZIP Code"] = plz;
}

if (cityMatch) {
  const city = cityMatch[1].trim();
  outputInfo["City"] = city;
}

if (addressMatch) {
  const address = addressMatch[1].trim();
  outputInfo["Address"] = address;
}

if (infoMatch) {
  const info = infoMatch[1].trim();
  outputInfo["Info"] = info;
}

return { 
    output1: result, 
    outputCabinets: result2, 
    outputFronts: result3, 
    outputShelf: resultShelf,
    foilFronts: output1,
    foilCabinets: output2,
    foilCountertop: output3,
    imageUrls: outputObj,
    InfoBox: outputInfo
};

```

Thank you for helping. I want to switch from Zapier to [Make.com](http://Make.com), but I am encountering issues with some Zaps while trying to integrate it on [Make.com](http://Make.com). Additionally, I find it frustrating that you can’t simply execute code like in Zapier and instead require an external module, which also comes with additional costs.

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 19, 2023, 5:44am UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/2 "2023-12-19T05:44:49Z")

</div>

Welcome to the Make community!

> [@Kreative](#):
>
> Additionally, I find it frustrating that you can’t simply execute code like in Zapier and instead require an external module, which also comes with additional costs.

That’s a great idea!

You can submit this suggestion to the [Idea exchange](https://www.make.com/en/platform-ideas), under [Platform ideas](https://www.make.com/en/platform-ideas). Don’t forget to search for it first, just in case someone already suggested it!

> [@Kreative](#):
>
> I’m having trouble getting it to work in Make.com using the “0codekit” module.

Where are you having trouble with this? Can you share any error messages, if any?

---

<div class="post-metadata">

**Author:** ![Kreative](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/kreative/32/21503_2.png) [@Kreative](https://community.make.com/u/Kreative)\
**Post date:** [December 19, 2023, 8:12pm UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/3 "2023-12-19T20:12:02Z")

</div>

![Bildschirmfoto 2023-12-19 um 21.11.49](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/5/b596e6ccec79dabe3721bbbd496af44dcaa13ec4.png)

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [December 20, 2023, 1:41am UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/4 "2023-12-20T01:41:28Z")

</div>

Welcome to the Make community!

## 1. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

 ![Screenshot_2023-08-24_230826](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/2/2ff55ee04419049c127f183db2b3eebfbbbbfc64.png)  
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

> blueprint.json (12.3 KB)

## 2. And most importantly, Input/ Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module that runs successfully, save the bundle contents in your text editor as a `bundle.json` file, and upload it here into this discussion thread.

 ![Screenshot_2023-10-06_141025](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/8/2876156ab3ea5bc9e40bbc0edfb9f025406b7c48.png)

Providing the output bundles will allow others to _replicate_ what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

---

<div class="post-metadata">

**Author:** ![Kreative](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/kreative/32/21503_2.png) [@Kreative](https://community.make.com/u/Kreative)\
**Post date:** [January 1, 2024, 9:21pm UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/5 "2024-01-01T21:21:21Z")

</div>

i got it 🙂 i use python so it works now byebye Zapier and welcome [Make.com](http://Make.com) 🙂

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [January 16, 2024, 12:57am UTC](https://community.make.com/t/javascript-code-zapier-make-com/22182/6 "2024-01-16T00:57:20Z")

</div>

This topic was automatically closed because it's resolved or inactive. Please, start a new topic.


