Question: Is it possible to execute the callback function only when a condition met inside the caller function?

As example I want to achieve this:

```
function DoThings( callback_func) {
   if( condition is true)
      execute callback_func;
   else
      return 0;
}

function callback_func() {
   echo 'condition met';
}

```

**Note:** I can not move the condition to `callback_func` due it can be from another source, and it's implementation is subject to change frequently.

Answer: 
I located my custom Javascript-files within my project as follows:

```
src/main/webapp/scripts/test.js

```

In my embedded form I then import my script:

```html
<form>
    //Your form elements
    <script src="../../../../name-of-war-folder/scripts/test.js"></script>
</form>

```

Then I am able to call my custom functions.

I think this is because the embedded forms are included from somewhere within the tasklist folder of the camunda application 
`apache-tomcat\webapps\camunda\app\tasklist`

An alternative would be to put the custom Javascript-files into the 
`apache-tomcat\webapps\camunda\app\tasklist\scripts` folder and import it with:

```html
<script src="../scripts/test.js"></script>

```

Unfortunately I have not found an easier way yet to include the scripts, but at least this works for now.

**Edit:** I found out an easier way to include the scripts which are located under:

```
src/main/webapp/scripts/test.js

```

Simply using the tag:

```html
<script src="/name-of-war-folder/scripts/test.js"></script>

```
It seems there's no way to load javascript files from the embedded forms, so I ended up copying and pasting the needed code to all of them.

Cheers,

**Edit**: @marketmi's answer works perfectly.