# Variable script in a module field

**URL:** https://community.make.com/t/variable-script-in-a-module-field/3954
**Category:** Beginner Questions
**Created:** [August 29, 2022, 6:41pm UTC](https://community.make.com/t/variable-script-in-a-module-field/3954 "2022-08-29T18:41:25Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 29, 2022, 6:41pm UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/1 "2022-08-29T18:41:25Z")

</div>

Hi,

First, my apologies for the newbie question 🙂  
I’ve been searching for a long time but couldn’t find the answer (might have missed something).  
Is it possible, in a module field, to include a simple script as such:  
{{ var foo=replace(“bar”;“a”;“ee”);  
foo; }}

Thanks 🙂

---

<div class="post-metadata">

### Author: ![alex.newpath](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alex.newpath/32/84_2.png) [@alex.newpath](https://community.make.com/u/alex.newpath)
#### Post date: [August 30, 2022, 7:15am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/2 "2022-08-30T07:15:58Z")

</div>

Sure use the `replace()` [function found in the string section](https://www.make.com/en/help/functions/string-functions#replace--text--search-string--replacement-string-) of the purple header box. It even supports regular expressions if you want a more complex substitution.

---

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 30, 2022, 9:32am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/3 "2022-08-30T09:32:20Z")

</div>

Hi Alex,

Thanks for your answer.

Sorry if my question wasn’t clear. In my example, the replace function is indeed used, but it’s the use of variables that doesn’t seem to work.  
Can I define a variable in a block code just for local use?

And similar question, is there a was to create a simple custom function in addition to the standard one, without having to access external services as described in other questions? (like google apps code, aws, etc.)

Thanks

---

<div class="post-metadata">

### Author: ![alex.newpath](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alex.newpath/32/84_2.png) [@alex.newpath](https://community.make.com/u/alex.newpath)
#### Post date: [August 30, 2022, 11:15am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/4 "2022-08-30T11:15:27Z")

</div>

> [@Beaver](#):
>
> Can I define a variable in a block code just for local use?

You can use the set variable or set multiple variables module. There’s no native way to create code blocks in the system. Some are working on [third party solutions](https://www.make.com/en/integrations/custom-js) but I tend to shy away from those until Make creates a standard way.

---

<div class="post-metadata">

### Author: ![alex.newpath](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alex.newpath/32/84_2.png) [@alex.newpath](https://community.make.com/u/alex.newpath)
#### Post date: [August 30, 2022, 11:17am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/5 "2022-08-30T11:17:19Z")

</div>

> [@Beaver](#):
>
> And similar question, is there a was to create a simple custom function in addition to the standard one, without having to access external services as described in other questions? (like google apps code, aws, etc.)

And again the answer is no unless you consider a scenario called by a webhook to be a custom function. Make is a no code tool and even though there are logical and functional constructs there’s no concept of a definable function like there is in other programming languages. Maybe one day.

---

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 30, 2022, 11:31am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/6 "2022-08-30T11:31:10Z")

</div>

Many hanks for your answers. That’s what I feared ☹

That’s sad, because it could be so much easier to call a function or put a little peace of code in module fields instead of building a factory to do all that.

Is there visibility somewhere on a kind of roadmap/what’s in the plans/if something will be done or not?

---

<div class="post-metadata">

### Author: ![alex.newpath](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alex.newpath/32/84_2.png) [@alex.newpath](https://community.make.com/u/alex.newpath)
#### Post date: [August 30, 2022, 11:34am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/7 "2022-08-30T11:34:23Z")

</div>

> [@Beaver](#):
>
> Is there visibility somewhere on a kind of roadmap/what’s in the plans/if something will be done or not?

There is a wishlist of sorts available called the [idea exchange.](https://www.make.com/en/platform-ideas) — you can vote and looks for ideas and app improvements or additions.

[Your idea has 115 votes.](https://www.make.com/en/platform-ideas)

---

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 30, 2022, 11:46am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/8 "2022-08-30T11:46:55Z")

</div>

Thanks 🙂  
Much appreciated

---

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 30, 2022, 11:54am UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/9 "2022-08-30T11:54:10Z")

</div>

This one relates indeed to my request:

> **[Platform ideas and improvements | Make](https://www.make.com/en/platform-ideas/p/code-javascript-python-php)**
>
> From tasks and workflows to apps and systems, Make is where you create and automate at the speed of your ideas.

---

<div class="post-metadata">

### Author: ![alex.newpath](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/alex.newpath/32/84_2.png) [@alex.newpath](https://community.make.com/u/alex.newpath)
#### Post date: [August 30, 2022, 12:16pm UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/10 "2022-08-30T12:16:53Z")

</div>

Indeed. How I miss that one? @Darin_Patterson is the product lead and he definitely has a pulse on what’s coming to make. And that it’s marked as planned is a good sign.

---

<div class="post-metadata">

### Author: ![Beaver](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Beaver](https://community.make.com/u/Beaver)
#### Post date: [August 30, 2022, 12:23pm UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/11 "2022-08-30T12:23:51Z")

</div>

Yep indeed 😃  
thanks again

---

<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: [September 7, 2023, 2:40pm UTC](https://community.make.com/t/variable-script-in-a-module-field/3954/12 "2023-09-07T14:40:31Z")

</div>


