cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

I'm pretty sure I don't have access to the central settings and I don't think it's turned on.  Is there any way that I can log variable values to the workflow history?

0 Kudos
Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

Hi Henning

Ok, here's some telling information.

In the For Each loop I added an action to change the value of (a test field I created) Test2 to be varIndex.  Then at least I can see if the loop is processing and what varIndex was when the workflow finished.

Here's the action.

So.. when I view the field properties after the workflow has completed Test2 is blank.  I would think that it means the For Each loop is not even starting. 

Your thoughts?

Best Regards,

Andy

0 Kudos
Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

Henning, this is big.  Ok, on a hunch I tried this.  I've been thinking that the {{Common:WorkflowInstanceID}} is not working and the CAML is not returning anything.  So I changed this;

<FieldRef Name="WorkflowInstance" />
<Value Type="Text">{{Common:WorkflowInstanceID}}</Value> 

to this;

<FieldRef Name="WorkflowInstance" />
<Value Type="Text">{50681acf-532c-4cf2-aa05-1222364521d7}</Value>

The {50681acf-532c-4cf2-aa05-1222364521d7} is the Workflow Context, Workflow Instance ID of another approved document in the library. The result is I get data in my fields.  It's data from another document but it proves that the code works.  You can see in the picture below that for the Travel Approval document, the Approval Details field and the Test2 field have data (that are getting data from the Chargeback document).



So... how do I get this working with the Workflow Instance ID of the current document?  Weird, huh?

Best Regards,

Andy

0 Kudos
Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

That sounds great!

Just a question: the workflow, that is retrieving the history - is this workflow also creating workflow-history entries or are we talking about two different workflows? I was under the impression, that you would have just one worklow, where these actions are the lasts steps in the workflow.

If we're talking just one workflow - you might have to make sure that all workflow-history entries are actually written to the list. You can achieve this, by adding a "commit pending changes" action to the workflow. I would insert this actions just before you start querying the history-list.

Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

that's a little unfortunate. But as a workaround you could write values to the history for debugging purpose. You just will have to remember to remove those actions prior to going production with your workflow.

0 Kudos
Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

Yes, it's just one workflow and these actions to put the workflow approval history into a field is added onto the end of the workflow. 

Ok so I added the Commit Pending Changes action to the workflow just before the query history action... and... I get the same result with no data. 

The weird thing is I have a Set Field Value action just before the query history action and the field is populated with the correct workflow instance ID.  Yet, the next action it seems that there is nothing in the Workflow Instance ID or I'm doing the syntax wrong in the query.

0 Kudos
Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

Henning!!  Wait, wait, wait.  I put the Commit Pending Changes in the wrong spot.  I moved it to the right spot and it all works now!!!   OMG, what a nightmare that was!

Thank you ever so much for your patience and extensive help on this issue.


Best Regards,

Andy

Reply
Workflow Hero

Re: How To Save Workflow History To Document Properties?

Jump to solution

No problem! Maybe you want to mark the reply (replies) as helpful/correct to help others as well.

0 Kudos
Reply