One of the more common questions we get is how a project could be created automatically from a front end form that users submit. Luckily Gravity Forms makes this pretty easy!
1. Get the Right Plugins
First you’ll want to make sure you have the following plugins installed: Project Panorama, Gravity Forms and Gravity Forms + Custom Post Types.
2. Create Your Form
Once the plugins are installed it’s time to create your first form. Within the WordPress admin go to Forms > New Form.
You can enter any title or description that you’d like. In this example I’ll be creating a form for company improvement initiatives so I’ve labeled my title and description appropriately.
Once complete you can start adding fields to the form. Now it’s important to understand some fields can easily automatically populate into Panorama and others are not so easy. You can also have fields that don’t get added to the project and are just there for reference.
Gravity Forms + Custom Post Types adds a new set of fields labeled “Post Fields” that we’ll use for adding information to our projects. Specifically we can use Title, Custom Field and Category fields.
In this example I’ll use the form to fill in the following project details:
- Project title
- Project description
- Client
- Start date
- End date
Project Title & Project Settings
To allow users to indicate a project title I’ll add the “Title” post field into my form. This is also where you can set the details of the project like should it be published by default or not.
In this case I’m going to name this field “Project Name” and set the status to “Draft” so I can review projects before they go live.
Here you will also want to select “Projects” from the Post Type dropdown.
Project Description
Most of the information saved in Panorama is saved as a “custom field” within WordPress. You don’t need to know what that does, only that to have the form populate specific project details like a description or client you’ll want to use the “custom field” field in Gravity Forms.
For the description I’ll add a custom field, name it description and switch the field type to “Paragraph Text” so my users can write out a good description.
To ensure it maps to the right place in Panorama I’ll select “New” from the custom field name and write in project_description.
Client
Client will work much like the description field. It’s another “custom field” this time using the custom field name of client. Since this will always be our own company I’m going to make it a hidden field and auto populate it with SnapOrbital.
Start & End Date
For dates we’ll again use another “custom field” and select “single line text” for the field. Unfortunately this plugin doesn’t support the date format needed to save for Panorama so we’ll need to supply instructions for the users.
For start date we’ll use start_date as the field name and end_date for the end date. I’m going to add some instructions so they know how to fill in the date using the following format yymmdd, e.g. 20170319.
3. Embed and Test
Once you’re done adding fields you can save the form and add it to your site. The easiest way to do so would be creating a new page and using the “Add Form” button to insert the form shortcode into the editor.
Publish the page and view it to see your form.
Try submitting the form, then jump back into the admin, click into projects and then view drafts and voila! We have a new project waiting for our review that we can publish if we decide to approve it.
4. Additional Mappings
You’ll notice I haven’t included any repeatable elements like documents, phases, users and tasks. This is a bit more difficult and will be covered in a later post. You can set the following additional fields using Gravity Forms however.
- Percent Complete – percent_complete (number, 0 – 100)
- Priority – _psp_priority (must be normal, low, medium or high)
- Hide from search engines – hide_from_search_engines (yes or no)
- Restrict access to specific users – restrict_access_to_specific_users (yes or no)
- Automatic progress – automatic_progress (Yes or no)
- Automatic phase progress – phases_automatic_progress (Yes or no)
- Progress type – progress_type (must be Weighting, Percentage, Hours or None)