# Extending the Javascript with custom functionality in script tasks

**URL:** <https://forum.camunda.io/t/extending-the-javascript-with-custom-functionality-in-script-tasks/48485>\
**Category:** Camunda 7 Topics\
**Created:** [October 30, 2023, 9:52am UTC](https://forum.camunda.io/t/extending-the-javascript-with-custom-functionality-in-script-tasks/48485 "2023-10-30T09:52:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeppe9821](https://forum.camunda.io/user_avatar/forum.camunda.io/jeppe9821/32/27323_2.png) [@jeppe9821](https://forum.camunda.io/u/jeppe9821)\
**Post date:** [October 30, 2023, 9:52am UTC](https://forum.camunda.io/t/extending-the-javascript-with-custom-functionality-in-script-tasks/48485/1 "2023-10-30T09:52:08Z")

</div>

Hello everyone! I would like to do something a bit strange. Essentially I want to call a javascript function from outside the script task and pass data through the function parameters. Example:

```auto
function foo(json) {
   if(json.people[0].name === 'Steve') {
         return 55;
    } 
}

```

I then want this return value to be returned to wherever the function was called. If this is possible through API calls it’d be optimal, but I understand if it’s not possible due to the niche nature of it

Thanks!

---

<div class="post-metadata">

**Author:** ![WilliamR.Alves](https://forum.camunda.io/user_avatar/forum.camunda.io/williamr.alves/32/27412_2.png) [@WilliamR.Alves](https://forum.camunda.io/u/WilliamR.Alves)\
**Post date:** [October 30, 2023, 2:53pm UTC](https://forum.camunda.io/t/extending-the-javascript-with-custom-functionality-in-script-tasks/48485/2 "2023-10-30T14:53:12Z")

</div>

Hello my friend! Welcome to Camunda Community \o/  
Sorry, but I don’t think I quite understand what you need.

Could you give a better example, perhaps illustrating it with a BPMN?

Where is this function you want to call implemented?  
You said it’s “outside your script task”, but where exactly is it?

**William Robert Alves**
