Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mike 56 posts 88 karma points
    May 06, 2013 @ 22:24
    Mike
    0

    Updating field value via custom workflow

    I have added a hidden field with the caption "Link" who's value I would like to adjust upon the form being submitted. It is my understanding that the below code should replace whatever form data is submitted with the value of "test", however no entry values are changed.

    Just a note that I purposely commented out my if statement for debugging purposes.

    I would be very thankful if someone pointed me in the right direction.

            public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
            {

                // update the existing record to include the link
                foreach (RecordField recordField in record.RecordFields.Values)
                {
                    //if (recordField.Field.Caption == "Link")
                    //{
                        recordField.Values.Clear();
                        recordField.Values = new List<object> { "test" };
                    //}
                }

                Umbraco.Forms.Data.Storage.RecordStorage store = new RecordStorage();
                store.UpdateRecord(record, e.Form);
                store.Dispose();

    }

  • Comment author was deleted

    May 07, 2013 @ 15:07

    Could you try placing it on the approved workflow state

  • Mike 56 posts 88 karma points
    May 07, 2013 @ 16:50
    Mike
    0

    Tim, thanks for your response. I do not want an approval process in my workflow as it would defeat the automative purpose of what I'm trying to accomplish with the form.

    I also noted your response on the similar forum topic from years ago found at http://our.umbraco.org/forum/umbraco-pro/contour/23261-Update-field-values-in-workflow-

    However, like them I either misunderstood the documentation, or it is indeed a bug. My code reference came from the official docs at http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Developer/Extending-Contour/Adding-a-Workflowtype

    Just as a side note (not directed at you), but extending Contour has been an uphill battle. No current tutorials work out of the box without modification on VS12.

  • Comment author was deleted

    May 08, 2013 @ 09:26

    Hey Mike,

    Well if you make sure the form isn't set to manual approval it should auto approve, placing it on that step will make sure it get's executed as the final thing

  • Mike 56 posts 88 karma points
    May 08, 2013 @ 16:45
    Mike
    0

    Thanks Tim, that did the trick.

Please Sign in or register to post replies

Write your reply to:

Draft