425-882-1032 info@3sharp.com

Thanks to everyone who attended my Form Solution End-to-End Walkthrough instructor-led lab sessions yesterday at TechReady3. Many of you asked great questions, and I received a lot of quality feedback after each session.

During one of the sessions, an attendee asked if it were possible to use variables in a Microsoft Office SharePoint Designer 2007 workflow. That same question had been asked previously by a customer hoping to resolve localization and maintenance issues related to string values.

The answer to the question is yes. SharePoint Designer allows the developer to initialize local variables that are used at runtime. To create such variables, click the Initiation button at the bottom of the Workflow Designer. Within the Workflow Parameters dialog box, you can then add as many variables as are needed during workflow execution. When adding a variable, you provide the name, data type, and default value. In the following figure, a StatusApproved string variable is created for a workflow. The default value “Approved” is set on the second page of the Add Field wizard.

Once the variables are initialized, they can be referenced in the conditions and actions within your step logic. When performing a workflow lookup, select Workflow Data from the Source list and then choose the appropriate variable from the Field list.

You can also set workflow variable values in your step logic. From the Actions list, just select More Actions and choose the Set Workflow Variable action.