# BPM variable scope

**URL:** <https://www.epiusers.help/t/bpm-variable-scope/57611>\
**Category:** Epicor ERP 10\
**Tags:** bpm\
**Created:** [July 9, 2019, 6:11pm UTC](https://www.epiusers.help/t/bpm-variable-scope/57611 "2019-07-09T18:11:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [July 9, 2019, 6:18pm UTC](https://www.epiusers.help/t/bpm-variable-scope/57611/2 "2019-07-09T18:18:57Z")

</div>

You are re-declaring your variables (locally) inside the code block. If you look at it from outside your current code looks like this

```auto
DateTime today;

void CodeBlock()
{
          DateTime today=DateTime.Today; // Re-declares the variable as a local variable that only has scope inside this code block
}

Console.WriteLine(today); // Today is still null here, because you haven't assigned any value to it.

```

You should not re-declare it inside the code block. Just assign it a value

```auto
void CodeBlock()
{
 today=DateTime.Today; 
}

```

---

_[View the full topic](https://www.epiusers.help/t/bpm-variable-scope/57611)._
