# Best way to simulate action specific variables like XML / FileSet

**URL:** https://www.finalbuilder.com/forums/t/best-way-to-simulate-action-specific-variables-like-xml-fileset/1432
**Category:** Discussion
**Created:** [February 1, 2010, 5:20am UTC](https://www.finalbuilder.com/forums/t/best-way-to-simulate-action-specific-variables-like-xml-fileset/1432 "2010-02-01T05:20:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 1, 2010, 5:20am UTC](https://www.finalbuilder.com/forums/t/best-way-to-simulate-action-specific-variables-like-xml-fileset/1432/1 "2010-02-01T05:20:48Z")

</div>

I&nbsp;wrote some actions to parse JSON&nbsp;documents.&nbsp; I&nbsp;want to have the actions behave in a maner similar to XML&nbsp;and FileSet variables, in that the variable gets defined and then subsequent actions manipulate the variable.&nbsp; The solution that I used (and I&nbsp;would guess isn't quite right)&nbsp;is to create a hidden Option Property.

I&nbsp;tried using JavaScript variables, but scripts don't seem to persist.

Should I&nbsp;have used Context.SetVariable()?&nbsp;Is there a specific format or convention to prevent interference with project / user variables?

Would using Context.SetVariable in the OnValidate script work (since OnLoaded&nbsp;comments seem to indicate it shouldn't be used)?

Thanks

---

<div class="post-metadata">

### Author: ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)
#### Post date: [February 1, 2010, 11:13am UTC](https://www.finalbuilder.com/forums/t/best-way-to-simulate-action-specific-variables-like-xml-fileset/1432/2 "2010-02-01T11:13:48Z")

</div>

&nbsp;Hi John,

&nbsp;

What you're wanting to use is a 'project object', basically an object that is kept around longer then the execution of a single action, this is what the FileSet, XML, FTP, etc actions use. In the current version of FinalBuilder you can only create actions that define project objects by creating them as custom .NET actions. Attached is an example action + source of how to use a project object, please let us know if you have questions.

&nbsp;

Regards,

Paul.
[ProjectObject.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/8/8aeaeafd2d4e8e762f244b1e194da5adf8180218.zip) (12.378 KB)

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 17, 2010, 8:32am UTC](https://www.finalbuilder.com/forums/t/best-way-to-simulate-action-specific-variables-like-xml-fileset/1432/3 "2010-02-17T08:32:42Z")

</div>

Thanks, I&nbsp;was able to transcode my previous attempt into a working set of actions using the code provided as an example.
