This guide helps Salesforce developers or admins to deploy/install and configure Web2Any Object utility. This app enables a webform to post data to any Object similar function as web2case or web2lead.
Supported in Classic and Lightning versions of UI.
This app makes use of Force.com public sites and REST API to send data from any web form. Form HTML code can be generated by this app or created manually based on the template provided later in this document.
This app has been updated to DX project and use of API version 47.0 Winter20 release.
Force.com site is required to be configured on target org, this is not part of this project and must be created manually. MyDomain must be enabled for this package.
To use this app navigate to Web 2 Any app in the app launcher. select Web2Anything tab - this is a Visual Force page that will help to generate your web form HTML code.
Here is an example of an HTML form generated by Web2AnyObject utility. User needs to replace the form action URL with target ORG site URL
<form action="https://sandbox-web2any-test2-developer-edition.cs40.force.com/services/apexrest/anyobject" method="POST">
<input type="hidden" name="otype" value="Web2Any_Sample__c" />
<input type="hidden" name="retURL" value="http://" />
<input type="hidden" name="encoding" value="UTF-8" />
<label for="Email__c">Email</label><input id="Email__c" name="Email__c" maxlength="40" size="20" type="text" /><br/>
<label for="First_Name__c">First Name</label><input id="First_Name__c" name="First_Name__c" maxlength="40" size="20" type="text" /><br/>
<label for="Last_Name__c">Last Name</label><input id="Last_Name__c" name="Last_Name__c" maxlength="40" size="20" type="text" /><br/>
<input type="submit" name="submit" />
</form>
For testing this application a sample custom object Web2Any_Sample
is provided. For a quick test user can define a form to send data to this object.
NOTES: User can choose any object available on the list to use as target for this form.
There are two ways to install Web2AnyObject App:
Set up your environment. Follow the steps in the Quick Start: Lightning Web Components Trailhead project. The steps include:
Follow these steps to setup this app in the scratch org for development. Alternatively you can use shell script from Step 3 dxorgcreate
If you haven’t already done so, authenticate with your Developer hub org and provide it with an alias, example (devhub):
sfdx force:auth:web:login -d -a devhub
Clone the salesforce-web-to-any-object repository:
git clone https://github.com/iandrosov/salesforce-web-to-any-object
cd salesforce-web-to-any-object
Create a scratch org and provide it with an alias (web2any in the command below):
sfdx force:org:create -s -f config/project-scratch-def.json -a web2any
Push the app source code to your scratch org:
sfdx force:source:push
Open the scratch org:
sfdx force:org:open
In the new scratch org navigate to Permission Sets settings and assign Web2Any to your system admin user account that grants access to the app and tabs.
sfdx force:user:permset:assign -n Web2Any
In App Launcher, select the Web 2 Any Object app.
Sign up for a Developer org or use your existing sandbox, enable My Domain, and deploy it to all users.
Click this link to install the unlocked package in your target Production or Developer org (login.nnnnn.com)
.
https://<INSTANCE.force.com>/packaging/installPackage.apexp?p0=04t3Z000001ae1EQAQ
Select Install for Admin Users
Assign your user a permission set Web2Any
This package requires Admin manual configuration
WEB_FormAnyObject_REST
to Guest User profile
If you install a package and launch the app but do not see Web Form target site, the site was not created. Solution is to follow instruction post-install and configure new Force.com site.
If your org is using several Communities you may see multiple sites to choose. Community site can be used as a gateway for Web2Any but, user needs to configure public NOT_Authenticated access for Guest User on the site.