In my use case, need to work on different company code on transaction based. So whenever transaction get in progress I’m assigning that transaction company code to previous_CC variable in end of process transaction and checking wheather in coming company code equals to previous_CC but unfortunately I’m getting null value for previous_cc varibale.
I’m not understanding why it’s happening. Please suggest or give workaround
you need to add it as an argument with in/out …or save that in the variable in main.xaml and then pass it into the process.xaml always…you cna save after the process.xaml is completed in same try catch…or save and use it as in/out argument…but remember when transaction fails arguments will not be passed out and again it becomes null…either save the argument to differnet variable and check null before saving in main.xaml or write data to asset so that you can retrieve when needed
It depends on the scope of the variable. A variable only exists for the entire process if it is scope to the highest level container. If it is scoped to a lower level container, then it gets created from scratch when that container is processed, and destroyed when it gets to the end of that container. Here is a way you can see this.
Add a Sequence, name it Top. Add another Sequence, name it Second. With Second highlighted, create a variable. You will see that its scope is Second. If you now highlight Top, you won’t see the variable. If you create a variable with Top highlighted, it will be scoped to Top and you’ll also see it in Second because Second is inside Top.
Variables do not get re-initialized due to exception. The only thing that controls reinitialization is scoping, or intentionally reinitialized with an Assign (ie Assign myDT = New System.Data.DataTable will reinitialize the myDT variable)