Mohammad, I'm not sure the context from which you would like to read the variable. There is a Workflow SDK The Nintex Workflow 2013 SDK is (initially) released! You can create custom actions within workflows using c#. Please provide more information on what you are trying to do so we can help.
Sorry, I still have no context here. I don't see how a workflow will communicate with your code. Is your code a solution in SharePoint or is it hosted elsewhere? Does the code run from a dll in the server farm? How will the code get in context with the workflow since the workflow is stateless with the database and running in either the Application Pool or through the OWStimer through the SharePoint Foundation Workflow Timer? So the workflow can be in multiple places depending on several variables. Do you need to get the variable value while in flight or after it is complete?
The most simplest way you can do this is to have the workflow variable stored into a SharePoint list using the Set Field, Update Item, Update Multiple Items, or Create Item action. Then the value of the workflow variable will have a state and you can get that value using the server API or CSOM api to fetch the value, or even use PowerShell as you can uase c# code in PowerShell.
Please provide a little more guidance and I'm sure we can find a solution for you.
As far as I know the workflow variables are dynamic entities and are in existence only during the run time of the workflow. As Andrew mentioned above, the most easy way in which you can do this is by storing the value of this variable in list and then calling the stored value from the C# code.
I agree with Andrew here. I would create a Nintex variable and set that variable in a SharePoint column. But I would use the SharePoint API C# code to access the value.
I believe I have a similar question. I am creating multiple custom actions/activities and need to access a variable from the first action in an action that would be placed downstream in the workflow. I set the value of the variable in my c# code, for the first custom action. How do I access this value from the second custom action?
In the 2007 SDK, it appears there used to be an object called "CurrentWorkflowVariableValues". This does not exist in the 2013 SDK.
NWContext ctx = new NWContext(
Based on the name, it would seem like this would have provided the necessary information, however, I do not know as it isn't in the 2013 SDK. It would be great if anyone has an idea on how to access a variable that was set in the Activity class of a previous custom action.
In your second custom action, could you create a value that needs to be configured, but use the variable within the configuration? There are many benefits to using the variable as a configuration instead of hardcoding the reference.
Thanks for the response. I'm not certain I understand. Probably my inexperience with Nintex, but let me clarify my issue a bit to see if your answer is still the same.
In my first custom action, I make a REST call in my execute code of my activity. I need to pass this value through to the next action to use as part of its functionality without the end user (person setting up the workflow) ever having to specify a variable for this.
Thank you again for any suggestions!