# One time initialization script for a collection

**URL:** <https://community.postman.com/t/one-time-initialization-script-for-a-collection/17310>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [November 2, 2020, 1:30pm UTC](https://community.postman.com/t/one-time-initialization-script-for-a-collection/17310 "2020-11-02T13:30:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaxx](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jaxx](https://community.postman.com/u/jaxx)\
**Post date:** [November 2, 2020, 1:30pm UTC](https://community.postman.com/t/one-time-initialization-script-for-a-collection/17310/1 "2020-11-02T13:30:54Z")

</div>

Hello  
I have gathered a sequence of requests in a collection.  
is there a place where I can put initial one time initialization script, which will be run before the execution of the first request for the collection?  
(or is there a possibility to add a first empty request, only for its script in Pre-request script?)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![yusuftaymann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/yusuftaymann/32/6160_2.png) [@yusuftaymann](https://community.postman.com/u/yusuftaymann)\
**Post date:** [November 3, 2020, 11:20am UTC](https://community.postman.com/t/one-time-initialization-script-for-a-collection/17310/2 "2020-11-03T11:20:27Z")

</div>

Hello @jaxx  
You can use pre-request-script. You can get around it by testing for a variable not existing and then executing your initialization logic. Inside that logic, I set/created the variable that I was testing for. My logic is simple and included below. if ( !pm.variables.has(“XXX”) ) {  
pm.variables.set(“XXX”,0);  
console.log(“Initialize collection”);  
}
