2

Closed

Token values from a CustomForm are emtpy in workflow

description

In lack of a "submitted" event I used the "content created" block for triggering my workflow when a custom form of mine gets submitted. Saving the form after submission is enabled.

The content created event triggers an email task where I use some Tokens of my custom form, though it seems the values are empty or don't get passed.

file attachments

Closed Aug 14, 2013 at 1:58 AM by sebastienros
Fixed in 1.x.

comments

Piedone wrote Jul 19, 2013 at 3:16 PM

Workaround: add a timer and send the e-mail e.g. one minute later.

2LM wrote Aug 4, 2013 at 8:21 AM

I am having the same issue and the proposed timer event doesn't provide a workaround. On the contrary, it seems that with the timer event, the mail doesn't even get sent. When removing the timer, I receive an email again, but indeed without any custom form fields filled in.

At this moment this breaks the simplest of flows for my site, like sending an email to me when someone fills out a contact form on my website. Can this be looked into asap please? The workflow functionality is awesome, but I really need this to be working, otherwise it's useless.

2LM wrote Aug 6, 2013 at 5:44 AM

Feedback, anyone? This is kind of a deal breaker for Orchard 1.7 for me...

jao28 wrote Aug 6, 2013 at 12:18 PM

Hi 2LM, I have used the timer to send a delayed email and it works well for me. I am guessing you are accessing the form fields by trying to grab the values using the forms token. If that is the case, I can almost guarantee it won't work with the timer because the context of the form is no longer in effect. You need to use the token to grab the data right from the content part. Here is the token I use for the Body part of my Send Email (you would need to update yours with your names of course):
{Content.Fields.ContactForm.Name} has submitted a form. 
<p>Here is the information provided on the form:</p>
<p>
Name: {Content.Fields.ContactForm.Name}<br />
Email: {Content.Fields.ContactForm.Email}<br />
Phone: {Content.Fields.ContactForm.Phone}<br />
Inquiry: {Content.Fields.ContactForm.Inquiry}<br />
</p>
As an alternative, even though I have upgraded my websites, I kept the Rules module going and am having it send out all my emails until I have time to properly transition to Workflow - you might consider this also. Hope some of this helps.

2LM wrote Aug 6, 2013 at 1:29 PM

Hi jao28,

Thanks for your feedback. Problem is that I use it in the same way as you do. I have attached an image that shows the workflow setup and the config per activity. I have tested 2 scenarios, and neither of them work.

1) with timer activity (see attachment) > no email is sent
2) without timer activity, so the notify activity is directly linked to the email activity > in this case the email is sent, but without field data.

jao28 wrote Aug 6, 2013 at 2:13 PM

Your setup looks like mine, except I don't have the notify in place. The custom form has it's own built in notifier and, while I don't think this would cause the issue, it is probably worth removing that piece to test it. After that it looks exactly like mine.

In regards to "without time activity", if you go that route you cannot use the tokens I have above. You have to use tokens similar to:
{Request.Form:Name}
Where "Name" is the name of the field (or ID, can't remember) off your form. This is the only way I could get it to return values without the timer as, unfortunately, the context is not yet set to retrieve it through the Parts token. Look forward to hearing back.

2LM wrote Aug 6, 2013 at 2:41 PM

Hm, I was actually very hopeful, as I seemed to have overlooked the option of the notification via the contact form. Alas, even when removing the notify activity, Orchard doesn't seem to send any emails when using a timer event. I have also checked the logs, but I haven't received any errors. On top of the fields issue, there also seems to be an issue with the timer event then?

2LM wrote Aug 6, 2013 at 2:47 PM

I have just tried the "without time activity" route and was able to get it working with the following email body tokens:
<ul>
<li><strong>Naam</strong>: {Request.Form:ContactForm.Name.Value}</li>
<li><strong>Email</strong>: {Request.Form:ContactForm.Email.Value}</li>
<li><strong>Bericht</strong>: {Request.Form:ContactForm.Message.Text}</li>
</ul>
Thanks a lot for your help jao28!

Even though I look very much forward to the issues with workflow being resolved, I can now use Orchard 1.7 perfectly for my current needs.

jao28 wrote Aug 6, 2013 at 3:22 PM

Excellent, I am glad the Request.Form worked for you. I am not sure why your particular instance with the timer isn't working. To confirm, I just set up a new website and ran through everything and it worked here. Very strange, will be interesting to see if anyone else can assist further.

Xceno wrote Aug 6, 2013 at 3:36 PM

Your last try, 2LM, looks interesting indeed.
Gonna try that one, thanks!

2LM wrote Aug 6, 2013 at 4:13 PM

Well, I must add that the website I am trying it on is one that I upgraded from 1.6.
I haven't been able to create a new website with Orchard 1.7, neither via WebMatrix nor via Orchard.Web.1.7.zip, see https://orchard.codeplex.com/workitem/19977 for more details.

I am running Windows 8.1 Preview and I'm starting to wonder if that might bring some issues to the table...

Xceno wrote Aug 7, 2013 at 8:41 AM

I have a fresh checkout of 1.7 running on win8 in vs2012 and have the same issues.
So i think your win8.1 shouldn't be the problem in this case.

2LM wrote Aug 7, 2013 at 9:40 AM

Oh ok, that's good to know. Maybe you can package your orchard instance and add it as an attachment for the orchard developers, so they have something to try and reproduce the issue with?

I'd do it with my environment, but it's an upgraded customer site and so far I was unable to start a new Orchard instance based on 1.7.

Yarx wrote Aug 13, 2013 at 10:45 PM

I'm encountering the same problem. I have a 1.6 site that I upgraded to 1.7, reproduced the same logic I used to have as a Rule, as a new Workflow and the email that is triggered when my custom form is submitted never has any data in the token values for the custom form. I've replaced my email with a Notify event containing the value of a single field while I test it and I can never get the Notify to contain the field value.

I've tried all the variations I can think of so far...
First Name: {Content.Fields.ContactUsForm.FirstName}
First Name: {Content.Fields.ContactUsForm.FirstName.Text}
First Name: {Content.Fields.ContactUsForm.FirstName.Value}
First Name: {Request.Form:ContactUsForm.FirstName}
First Name: {Request.Form:ContactUsForm.FirstName.Text}
First Name: {Request.Form:ContactUsForm.FirstName.Value}
First Name: {Request.Form:FirstName}
First Name: {Request.Form:FirstName.Text}
First Name: {Request.Form:FirstName.Value}

None of these ever yield a value. Is there a fix for this yet or a known cause? Is it because it's an upgraded 1.6 site?

Yarx wrote Aug 13, 2013 at 10:49 PM

Correction, I did get it to work with {Request.Form:ContactUsForm.FirstName.Text}, though I am not sure why I can't use {Content.*} any more?

Piedone wrote Aug 13, 2013 at 11:25 PM

Check out the recording of today's meeting, Sebastien rolled out something fixing this.