Copied to clipboard

Flag this post as spam?

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


  • Richard Read 16 posts 47 karma points c-trib
    Sep 09, 2013 @ 11:56
    Richard Read
    0

    Contour - Saving a multi-part form for later editing

    Hi,

    Please forgive me as I'm not too familiar with Contour. We have had a request to update a multi-step contour form, so the user can save their progress in step 2 of 3, and then return to the form at a later point in time to retrieve their data and submit it.

     

    Is this possible in Countour, or would it require some custom coding to allow for this? 

     

    Thanks,

    Rick

  • Comment author was deleted

    Sep 11, 2013 @ 14:40

    Yeah basicly you just need to get hold of the record id and then you can use that to turn the form into edit mode making it possible to continue progress...

  • Richard Read 16 posts 47 karma points c-trib
    Sep 11, 2013 @ 15:04
    Richard Read
    0

    Thanks Tim, that's what I ended up going with :)

  • Comment author was deleted

    Sep 11, 2013 @ 15:06

    Ok glad it's already sorted :)

  • Dan 1285 posts 3917 karma points c-trib
    Mar 20, 2014 @ 15:55
    Dan
    0

    Hi Tim/Richard,

    Could you elaborate on this? How/when can I get the record id? And how would I use this to put the form into edit mode?

    I have a multi-step form, being completed only by logged in members, so I'm hoping to be able to save their progress and allow them to resume the form afterwards.

    Many thanks for any pointers.

  • Comment author was deleted

    Mar 21, 2014 @ 10:09

    @Richard, mind sharing the solution?

    Dan take a look at the partially submitted workflow, you can use that to store the record id to the member 

    So you'll need a custom workflow type (or if Richard can share the one he did)

     

  • Dan 1285 posts 3917 karma points c-trib
    Mar 21, 2014 @ 10:21
    Dan
    0

    Ah, I don't dip into the advanced workflows very often - interesting!

    So I'll need a custom 'Partially submitted' workflow to store the record id to the member, and a second custom workflow - on 'Resumed' to pull that record id back out and populate ('hydrate'? bullshit bingo) the form?

    The first one sounds really simple as I already have a custom workflow on form completion which sets a checkbox value on the member to say they've completed the form, but the second one, I'm not sure how I'd populate the form from the record id - is there a method to load the record into a session or something? Not quite sure how data is populated whilst in a multi-step form.

    Thanks Tim!

  • Craig Cronin 304 posts 503 karma points
    Mar 21, 2014 @ 10:52
    Craig Cronin
    0

    Hi Richard,

    I'm also about to look at the same issue and would also be interested in this code, if you are willing to share it.

  • Dan 1285 posts 3917 karma points c-trib
    Mar 21, 2014 @ 19:14
    Dan
    0

    Hi Tim,

    Just looking into this now. I was initially thinking the way to resume the form would be through a custom workflow on the 'When the form has been Resumed' workflow, grabbing the record id and using it to set the current form record. I'm not sure if this is the best thing to do though (or if it's even possible - I can't see that it is). Should I just abandon the workflow and set a redirect on the page containing the form to append the record id as a querystring (e.g. http://example.com/form-page/?recordGuid=e2650e4d-3444-4dc1-9f45-d91257b4f77f)?

    This querystring approach works but I'd prefer to not have to use the querystring if possible, as the member could remove it and submit a clean form (unless I coded some logic to detect this). If it's the recommended (/only sensible) approach I'll stick with it though.

    Thanks very much.

  • Dan 1285 posts 3917 karma points c-trib
    Mar 21, 2014 @ 19:26
    Dan
    0

    @Craig, if you (or anyone else) needs a head start on this, I've just coded up a simple workflow to save the form record id to a member property. I've not tested the logging or anything, so use with caution, but the basics of it work.

    Just create a new Class using the following code, recompile and it should be available as a workflow in the Contour back office. Add the workflow to the 'When the form has been PartiallySubmitted' workflows. You'll need to create a property on the member type - in this case it has an alias of 'additionalDataFormRecordId'. Then when a member hit's the 'next' button on the form you should see a GUID logged against this property for the member.

    From here you can resume the form using a querystring on the page containing the form, as per my previous post, but I'm looking for a more robust way to do it, if there is one.

    Hope this helps anyhow...

        public class SaveFormProgressToMember : WorkflowType
        {
    
    
            /// <summary>
            /// Set up standard properties for the custom workflow
            /// </summary>
            public SaveFormProgressToMember()
            {
                this.Name = "Save progress of form to member property";
                this.Id = new Guid("97c5796d-34da-451b-a5ec-9eeb9ae216cc");
                this.Description = "Saves the current form record to a member so the form can be resumed at a later date";
            }
    
    
            /// <summary>
            /// Handle validation
            /// </summary>
            public override List<Exception> ValidateSettings()
            {
                List<Exception> exceptions = new List<Exception>();
                return exceptions;
            }
    
    
            /// <summary>
            /// Save progress of form to member property aliased 'additionalDataFormRecordId'
            /// </summary>
            public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
            {
                try
                {
    
                    // Get current member
                    var member = Member.GetCurrentMember();
    
                    // Mark additional data as complete
                    if (member != null)
                    {
                        // Get record id
                        var formRecordId = record.Id;
                        if (formRecordId != null)
                        {
                            member.getProperty("additionalDataFormRecordId").Value = formRecordId.ToString();
                            member.Save();
    
                            // Return completed status
                            return WorkflowExecutionStatus.Completed;
                        }
                    }
                    else
                    {
                        // Log problem
                        LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Member is null in SaveFormProgressToMember contour workflow.");
                    }
                }
                catch
                {
                    // Log exception
                    LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "General exception in SaveFormProgressToMember contour workflow.");
                }
                return WorkflowExecutionStatus.Failed;
            }
        }
    
  • Craig Cronin 304 posts 503 karma points
    Mar 21, 2014 @ 19:55
    Craig Cronin
    0

    I'm back on our eform project next week and this is definately something needed for some of the forms that I need to migrate over, so I've been monitoring the comments from you and Tim on the performance etc as well.

    Really big help to get me started.

    Thanks Dan/Tim 

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft