Create a Rule that assigns a specific role to a user after they have completed a form Ok, I have a customer that is wanting to have an applicant complete a specific webform and then have their user account be assigned to a specific role automatically.

My thought was to go the following route using rules:


Applicant creates their user account
They are then automatically taken to the specific webform
Once the webform is completed, then they are automatically assigned a specific role (this is the part where I'm lost as to the best option or if it's even possible)


Is this something that would even be possible using rules? Or are there other options that may work? Any assistance would be greatly appreciated!

I hope I've explained the situation enough :) Let me know if you need any further info.

Thank You!!

Nicole
Sure you can! This is a way of doing it with the Rules module.

This also requires the Webform Rules Module.

Download that, enable it, and be sure that the Rules UI module within it is enabled as well.

Step 1 - Create Rule

Start by creating a new Rule under Admin>Config>Workflow>Rules.

Name it whatever you'd like, but have it react on "After a webform has been submitted"





Step 2 - Find Webform's NID

In another tab, view your Webforms in Content>Webforms. Hover your mouse over the Edit link next to the Webform you were talking about to find its Node ID (NID). You will need this in a second.







Step 3 - Only Apply Rule to that Particular Webform

Return to the Rule you created a bit ago and click the "Add condition" link under "Conditions".



Select "Data Comparison" as your condition.

Here, you are going to select "node:nid". This is because you only want this rule to fire up when the Webform you mentioned earlier is submitted.

Below that, enter in the Node ID for the Webform





Step 4 - Add Action for Adding Role

Return to your Rule and click on the "Add Action" link in the "Actions" settings.



For your Action, you are going to select "Add user role"



Under the Data selector, you are going to choose "user"



Below that, select the Role(s) that you want the submitter to gain.

Hope this helps!