I implemented a custom activity based on the Nintex Workflow 2013 SDK. This activity updates a field in the SharePoint list item and it works properly. Then the workflow continues and tries to use the previously changed field in a condition. Unfortunately, this step fails because the workflow doesn't see the new value.
This thing only happens when I use custom actions or web service calls. I assume that the workflow caches the list item and only updates it if it's necessary. It seems that my custom code doesn't trigger this logic.
How can I force the workflow to re-read the list item values? Does the activity have a method for this?
It was a good idea because the item history displayed the System user. I created a custom action and used the Run as workflow owner option. Unfortunately, it didn't solve the workflow problem. The workflow still sees the old field values.
Can you shed more light on what you are attempting to do and why are you using a custom action? I'm not suggesting what you are doing is incorrect, just trying to understand what you are attempting to achieve and where it may be causing an error.
As for custom development, manipulating the SP Object would require knowledge around how items are locked for editing and updating and ensuring that one action is performed before another action can be performed on the same item. In your case if you update an item, and then attempt to grab the previous value, it should fail because the value has been changed and their is no caching of that during a runtime function for SharePoint. A way around that would be to capture the previous value and store that as a variable before you make changes, or target the previous version of the item and read that value.
As I type this it out, unless you have something drastically unique that you are attempting to do, I would suggest just trying to use Nintex actions as they are and not creating a custom one. But again, answering the first question may help.
now let me get it right, the workflow will runs, and then you have a custom action to update a field in SharePoint, then another step needs to read the new value from SharePoint.
I have a couple of questions
1) how about you use a Nintex Action to update the SharePoint Field. or is there anything special to use the Custom Action?
2) can you please try to read the value explicitly from the SharePoin after you update it from the list. just to make sure that the value is acually updated.
The point is, once the workflow stats, then it uses the current item and it will keep like a copy of that item, so when updating the item, Nintex actions makes sure to update the item and keep the history in case a roll back is needed.
another thing is that you need to make sure that the SharePoint changes are commited, other than that, SharePoint will give you the old value. like when you check out an item, the changes are not commited untill the check in, and any reads in between will show the old values.
Did you try to to use the "Commit Pending Changes" before reading the value. just to make sure that all the changes have been commited to SharePoint.