# Global functions via Collection level folder?

**URL:** <https://community.postman.com/t/global-functions-via-collection-level-folder/5927>\
**Category:** Help Hub\
**Created:** [June 16, 2019, 12:16pm UTC](https://community.postman.com/t/global-functions-via-collection-level-folder/5927 "2019-06-16T12:16:17Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![franksunnn110](https://avatars.discourse-cdn.com/v4/letter/f/b2d939/32.png) [@franksunnn110](https://community.postman.com/u/franksunnn110)\
**Post date:** [February 12, 2020, 3:41pm UTC](https://community.postman.com/t/global-functions-via-collection-level-folder/5927/6 "2020-02-12T15:41:01Z")

</div>

The problem had perplexed me for a while until I found the common way mentioned above. However, it still leaves a warning icon for each `eval` line, which indicates “eval can be harmful” in the postman interface.  
Recently, I’ve found another way and post it here:  
Users can create a prototype object with the proper function you want in the pre-request script section, like this:

```auto
Object.prototype.sayHello = function(name){
    console.log(`Hello! ${name}`);
};

```

and call that function everywhere after that. It just required a defined object, like this:

```auto
let obj = {};
obj.sayHello('Griffin');

```

Or you don’t even need the declaration of the object but use some built-in objects instead, like lodash (you pretend it has the function 😄 )

```auto
_.sayHello('Griffin');

```

It’s working on my side.

---

_[View the full topic](https://community.postman.com/t/global-functions-via-collection-level-folder/5927)._
