Copied to clipboard

Flag this post as spam?

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


  • Clair 36 posts 86 karma points
    Aug 18, 2011 @ 21:58
    Clair
    0

    Update field values in workflow

    I've read the Contour developer docs, but I still can't get this to work. All I'm trying to do is update 3 hidden fields on my form when its submitted (or opened, either one would work).

    When I debug, I can see my values are updated in the Record object, but it isn't saving. 

    public override Umbraco.Forms.Core.Enums.WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)

            {

                foreach (RecordField recordField in record.RecordFields.Values)

                {

                    if (recordField.Field.Id == new Guid(this.ReferringToField))

                    {

                        recordField.Values.Clear();

                        recordField.Values.Add(umbraco.library.RequestCookies(Constants.Cookies.ReferringToClinicInfo));

                    }

                    else if (recordField.Field.Id.ToString() == this.ReferringFromField)

                    {

                        recordField.Values.Clear();

                        recordField.Values.Add(umbraco.library.RequestCookies(Constants.Cookies.ReferringClinicInfo));

                    }

                    else if (recordField.Field.Id.ToString() == this.ReferringProviderField)

                    {

                        recordField.Values.Clear();

                        recordField.Values.Add(umbraco.library.RequestCookies(Constants.Cookies.ReferringProvider));

                    }

                }

     

                RecordStorage rs = new RecordStorage();

                rs.UpdateRecord(record, e.Form);

                rs.UpdateRecordXml(record, e.Form);

                rs.Dispose();

     

                return Umbraco.Forms.Core.Enums.WorkflowExecutionStatus.Completed;

            }

  • Comment author was deleted

    Aug 19, 2011 @ 11:06

    Could you try setting this on the approved state and let me know what happens there?

  • Clair 36 posts 86 karma points
    Aug 22, 2011 @ 15:05
    Clair
    0

    I set this on the approved state and now it works. The only problem is this will need have a manual approval, so it will need to work on submitted. Any idea why it would work on one, and not the other?

  • Comment author was deleted

    Aug 22, 2011 @ 15:08

    Think it's because the values get overwritten if you place them before approval

  • Asif Malik 203 posts 339 karma points
    Mar 04, 2012 @ 17:21
    Asif Malik
    0

    Hi, i know this is an old post. but am trying to update some fields using a workflow which is triggered on the Resumed state (want it to also trigger on the PartialSubmit state but that trigger doesnt seem to be working).

    I am having the similiar problem in that when the workflow is triggered the fields do not have the new data, it seems as thoguh the workflow is triggered before the actual saving of the data?

    Is my understanding correct? and is this a bug? ie surely the workflow should be triggered after the save?

    Hope you managed to find a solution if so let me know

  • Lewis 36 posts 116 karma points
    Dec 06, 2013 @ 11:31
    Lewis
    0

    Think I am having a similar problem trying to update values on RecordService.RecordPartiallySubmitted

    record.RecordFields[field.Id].Values[0] = value;
    recordStorage.UpdateRecord(record, form);

    But upon viewing the entry in Contour the values are not saved.

    Any ideas? 

  • Janusz Stabik 15 posts 35 karma points
    Mar 24, 2014 @ 17:29
    Janusz Stabik
    0

    Is there any news on this - I'm trying to update a record in RecordService.RecordApproved += RecordService_RecordApproved;

    When I view the entry in the Contour UI the value has not been saved?

     

  • Charles Afford 1163 posts 1709 karma points
    Mar 24, 2014 @ 21:11
    Charles Afford
    0

    Sorry wrong thread

  • Charles Afford 1163 posts 1709 karma points
    Mar 24, 2014 @ 21:32
    Charles Afford
    0

    Just as a though though.  If this is for approved state.  Could you:

    Make the changes i approved state

    Save the form and records

    Change the state to partial-submitted

    Save the form and records?

     

Please Sign in or register to post replies

Write your reply to:

Draft