14 Replies Latest reply: Jun 24, 2014 12:19 PM by scottdouglas999 RSS

    Web form dropdown to trigger action

    wretcdes Community Member

      Hi

       

      Does anyone know how to make a selected value in a webform dropdown trigger an action?

       

      Essentially I have a contact form that serves 6 different business locations. Each location has it's own email address, so I want the form on submition to be sent to the location specific email address based on the user of the form picking a location from the dropdown menu.

       

      Thanks in advance

       

      Ken

        • 1. Re: Web form dropdown to trigger action
          thetrickster888 Community Member

          Hey Ken,

           

          Sorry so late... just saw your post.  The solution is dependant on your hosting plan.  Does your hosting plan include workflows?  If not, this might not be possible without exposing the email addresses in your code which could lead them open to spam since they can be scraped by spammers.  If you DO NOT have workflows then you'll need to whip up some javascript to change the email "from" address on a basic BC form-to-email solution.

           

          If you DO have worfkflows you should use them instead.  You'll need to first setup a separate workflow for each location.  Each workflow during setup should include notifying that location via email.  Your best bet is to just name them the location name so if you have a location in St. Louis, call the workflow "St. Louis".

           

          Then, take a look at this page: http://helpx.adobe.com/business-catalyst/partner/create-workflow-notification.html

           

          You'll notice toward the bottom they give you instructions on how to update your webform to have them choose a workflow from a SELECT box.  Read and follow those directions, but essentially, if you add an input in a form like a SELECT input and give it a name="WorkflowList" and fill it with options using the IDs or your workflows you can trigger which workflow is used based on user selection.

           

          Good luck. Let me know if you need any more help... it's a bit more complicated if you don't have a plan that includes workflows.

          • 2. Re: Web form dropdown to trigger action
            wretcdes Community Member

            Hi. Thanks for the reply. We do have workflows, so I'll give that a try. Thanks for the help

             

            Ken

            • 3. Re: Web form dropdown to trigger action
              Cedric Canete Community Member

              following on this functionality - if we change the value="" of the option to the workflow ID's it also changes the actual value thats needed for that field causing our workflow's to not show what was really selected on the dropdown.

               

              Question is, how will we be able to still pass through the value on the dropdown field that the customer selected?

               

              Thanks

              • 4. Re: Web form dropdown to trigger action
                thetrickster888 Community Member

                I don't think you can get the value of the workflow dropdown to display in the case that's created.. it's solely used to trigger the selected workflow when the form is submitted.  You might have to workup another select dropdown or input that, when selected, via javascript selects your appropriate workflow id. 

                 

                Also, it doesn't necessarily have to be a dropdown... it could be any input type in the form. You could have a hidden text field with the name="WorkflowList" and use some javascript to populate that input with the ID of the appropriate workflow.  I don't know your exact use case but you could setup something like:

                 

                <select name="Department">

                  <option value="Accounting" data-workflow-id="1234">Accounting</option>

                  <option value="Customer Service" data-workflow-id="1235">Customer Service</option>

                </select>

                 

                <input type="hidden" name="WorkflowList"/>

                 

                And then, use some jQuery to fill the hidden field with the correct workflow id:

                 

                (function($){

                var select = $("select[name='Department']");

                var targetInput = $("input[name='WorkflowList']");

                  

                  select.change(function() {

                      var workflowId = $(this).find("option:selected").data("workflowId");

                      targetInput.val(workflowId);     

                  });

                 

                 

                })(jQuery);

                 

                Here's my fiddle of it in action: http://jsfiddle.net/thetrickster/L7sVJ/  But I changed the input to a regular text field so you can see it in action, for your live version just change it to a hidden input.

                • 5. Re: Web form dropdown to trigger action
                  thetrickster888 Community Member

                  Also-- in my example, to be sure the "Departmenr" field is collected in the case that's created with the workflow, be sure to include the "Department" field in your BC web form when you create it-- then edit the markup to add the "data-workflow-id" attributes to the option child elements.

                  • 6. Re: Web form dropdown to trigger action
                    thetrickster888 Community Member

                    I updated my fiddle since it only worked when the select element was changed so I added a "Please Select" option to the select element so that it wasn't already starting on the "Accounting" option which would not update the hidden input with the right workflow id.

                    • 7. Re: Web form dropdown to trigger action
                      Cedric Canete Community Member

                      Awesome! helpful as always trickster thanks!

                      • 8. Re: Web form dropdown to trigger action
                        Digital Fuel Web Community Member

                        Hi trickster

                         

                        I saw your post re changing case workflow from in the form.

                         

                        Can you tell me. Can you change the Case Status or Case Assigned to I have tried below but no luck. Any help would be great.

                         

                        <select name="assignedTo">

                        <option value="-1">Not Assigned</option>

                        <option selected="selected" value="705285">Work Admin</option>

                        <option value="776372">Deidre</option>

                        <option value="777371">Meisha</option>

                        <option value="653664">Monique</option>

                        <option value="646691">Racquel</option>

                        <option value="323404">digitalfuel</option>

                        </select>

                        Or

                        <select name="Status">

                        <option value="3">Closed</option>

                        <option value="5">Escalated</option>

                        <option selected="selected" value="1">New</option>

                        <option value="2">Open</option>

                        <option value="4">Re-Opened</option>

                          </select>

                         

                        Cheers Daniel

                        • 9. Re: Web form dropdown to trigger action
                          Liam Dilley CommunityMVP

                          Hi Daniel,

                          You can only change the workflow on the front end, not the case at this time.

                          • 10. Re: Web form dropdown to trigger action
                            Digital Fuel Web Community Member

                            Hi Liam,

                             

                            This functionality would be very helpful. I have a client that uses the CRM extensively. And the use the status of cases and assign them to users manually. But this is becoming a nightmare as the cases for Newsletters and other forms that do not need attending get in the road and I want to be able to close these automatically which I could do if we had access to the Status from the form. Also they need to assign diffenent users to a case from the same form which is determined by a field populated in a webform now this could also be done if we had access to the AssignTo in the Case. Allowing this would let the clients view only cases that were open and were assingn to them. The workflow idea does not help in this instance that I can see. When a website starts getting more traffic and Newsletter signups increase the CRM cases become hard to manage. Now I am going to setup the CST for the client but it still does not take care of the Newsletter signup without interaction and to assign a case to a user based on a forms data would require me to do something like create multiple forms the same and then use java to replace the form id's based on customers needs to submit the correct form details and use the associated worklow related to the CST.

                             

                            Not sure if this make much sense. But do you have any suggestion here. Am I see all the options?

                            • 11. Re: Web form dropdown to trigger action
                              scottdouglas999 Community Member

                              I want to set this up on a site I'm building, I think I'll use the Javascript version but it seems that I loose the Mandatory Option when I change the select name to Workflow list... any suggestions?

                              • 12. Re: Web form dropdown to trigger action
                                scottdouglas999 Community Member

                                I'm trying to implement this into a webform and I'm having some trouble. I'm wondering if someone could have a look at the code and maybe trouble shoot it. The page is here: HTML Samples. Any help would be greatly appreciated!!!

                                • 13. Re: Web form dropdown to trigger action
                                  Digital Fuel Web Community Member

                                  Not sure if this helps but with your js validation you are using try.

                                  <option value=" ">--- Please Select ---</option>

                                  • 14. Re: Web form dropdown to trigger action
                                    scottdouglas999 Community Member

                                    Thanks but that didn't help....