Copied to clipboard

Flag this post as spam?

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


  • Jorge 37 posts 119 karma points
    Feb 27, 2017 @ 21:19
    Jorge
    0

    Unable to load form when saving

    Strange happening when I tried to save settings.

    This only happens sometimes maybe 1 out of 15 saves so its hard to replicate

    enter image description here

    A file was being deleted when I saved and it returns "Unable to load form" error.

    I am using latest Umbraco Forms 4.4.0 and latest Umbraco version hosted in UAAS.

    Anyone experienced this before???

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Feb 28, 2017 @ 18:21
    Dennis Aaen
    0

    Hi Jorge,

    Yes unfortunately we have seen this for some projects on Cloud. If you could send me an email with a link to your project at dennis (at) umbraco dot com, then I have a look at the issue so this can be fixed.

    Sorry for the inconvenience.

    Best,

    -Dennis

  • Jorge 37 posts 119 karma points
    Mar 02, 2017 @ 15:30
    Jorge
    0

    Hi Dennis,

    I believe only few can encounter this error because only few is using UAAS and Umbraco Forms custom workflow at the same time.

    And yes, we are using Custom workflow for umbraco forms because we are saving the data to mailchimp.

    I'm not sure if that was the issue but if you see on this screenshot enter image description here its pointing to the workflow folder.

    Now if you want to peek at my custom work flow code here it is.

    public class ContactFormWorkflow : WorkflowType
        {
            public ContactFormWorkflow()
            {
                this.Id = new Guid("11117EB2-8D61-483C-A3DA-7850FCE05996"); // this is a custom id.
                this.Name = "Mailchimp - Contact Form";
                this.Description = "This workflow is currently exlusive for Contact form only, this will send data to mailchimp and will save into db.";
                this.Icon = "icon-message";
    
            }
    
            public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
            {
                var records = record.RecordFields.Values
                    .Where(x => !(x.Field.Condition.Enabled && string.IsNullOrWhiteSpace((string)x.Values.FirstOrDefault())))
                    .ToList();
    
                var formCategory = records.FirstOrDefault(x => x.Alias.ToLower().Contains("enquiry"));
                var formName = records.FirstOrDefault(x => x.Alias.ToLower() == "name");
                var formTitle = records.FirstOrDefault(x => x.Alias.ToLower() == "title");
                var formPhone = records.FirstOrDefault(x => x.Alias.ToLower() == "phone");
                var formMail = records.FirstOrDefault(x => x.Alias.ToLower() == "email");
                var formMessage = records.FirstOrDefault(x => x.Alias.ToLower().Contains("message"));
                var formAddress = records.FirstOrDefault(x => x.Alias.ToLower() == "address");
    
                var formCheckBox = records.FirstOrDefault(x => x.Field.FieldType.ToString().Contains("CheckBox"));
                bool parsedValue;
                var isCheckboxCheck = Boolean.TryParse(formCheckBox != null ? formCheckBox.Values.FirstOrDefault().ToString() : "",
                    out parsedValue) && parsedValue;
                var formCheckBoxVal = formCheckBox != null && isCheckboxCheck ? formCheckBox.Field.Caption.StripHtml() : "";
    
                const string defaultVal = "";
                var category = formCategory != null ? formCategory.Values.FirstOrDefault().ToString() : defaultVal;
                var name = formName != null ? formName.Values.FirstOrDefault().ToString() : defaultVal;
                var title = formTitle != null ? formTitle.Values.FirstOrDefault().ToString() : defaultVal;
                var phone = formPhone != null ? formPhone.Values.FirstOrDefault().ToString() : defaultVal;
                var mail = formMail != null ? formMail.Values.FirstOrDefault().ToString() : defaultVal;
                var message = formMessage != null ? formMessage.Values.FirstOrDefault().ToString() : defaultVal;
                var address = formAddress != null ? formAddress.Values.FirstOrDefault().ToString() : defaultVal;
    
    
                var db = ApplicationContext.Current.DatabaseContext.Database;
                var ipAddress = HttpContext.Current.Request.UserHostAddress;
                var pageUrl = HttpContext.Current.Request.UrlReferrer != null ? HttpContext.Current.Request.UrlReferrer.AbsoluteUri : "";
    
                // Save to db
                var contact = new Contact
                {
                    Category = category,
                    Name = name,
                    Title = title,
                    Phone = phone,
                    Mail = mail,
                    Message = message,
                    Address = address,
                    IpAddress = ipAddress,
                    CreatedDate = DateTime.Now,
                    PageUrl = pageUrl
                };
    
                db.Insert(contact);
    
                // send to mailchimp
                MailchimpHelper.ContactFormSubscribe(mail, category, name, title, phone, message,
                    address, formCheckBoxVal, ipAddress, pageUrl);
    
                if (isCheckboxCheck)
                    MailchimpHelper.NewsletterFormSubscribe(mail, name, "", "", "", "", ipAddress, pageUrl);
    
                return WorkflowExecutionStatus.Completed;
            }
    
            public override List<Exception> ValidateSettings()
            {
                return new List<Exception>();
            }
        }
    

    Thanks

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Mar 02, 2017 @ 17:58
    Dennis Aaen
    0

    Hi Jorge,

    Thanks for the your reply. I would be fantastic if you could provide the steps, that you have done, so we can try to see if we can reproduce the same.

    Did you do the save quickly (one after another), the reason for asking this is if you do, then the second save may lock it up.

    Could you try to waits a longer time before hitting save again then it may not lock up the workflow.

    Let me know how it´s goes.

    /Dennis

  • Jorge 37 posts 119 karma points
    Mar 03, 2017 @ 10:28
    Jorge
    0

    Hi Dennis,

    Looks like your theory is correct.

    I managed to replicate it by pressing Ctrl + S repeatedly. It then popup an error message, plus it also deleted my workflow inside workflows folder.

    That was tested in my local, so I believe this error can happen on dev and live site in only second of interval when saving.

    I think I cant tell our content editors that they must "wait seconds" before saving again.

    Please share me your thoughts. Thanks

Please Sign in or register to post replies

Write your reply to:

Draft