-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathreadme.txt
1471 lines (1106 loc) · 45 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=== Brilliant Web-to-Lead for Salesforce ===
Contributors: brilliantplugins, nickciske
Tags: crm, contact form, contactform, web to lead, case to lead, salesforce.com, salesforce, salesforce crm, contact form plugin, contact form builder
Requires at least: 4.0
Requires PHP: 7.2
Tested up to: 5.4.1
Stable tag: 2.7.3.9
License: GPLv2
Donate link: https://donate.charitywater.org/donate
Brilliant Web-to-Lead for Salesforce creates a solid integration between your WordPress install(s) and your Salesforce.com account!
== Description ==
Brilliant Web-to-Lead for Salesforce creates a solid integration between your WordPress install(s) and your [Salesforce CRM](http://www.salesforce.com) account! People can enter a contact form on your site, and the lead (or case) goes straight into Salesforce CRM: no more copy pasting lead info, no more missing leads: each and every one of them is in Salesforce.com for you to follow up.
### Features
You can fully configure all the different settings for the form, and then use a shortcode to insert the form into your posts or pages, or you can use the widget that comes with the plugin and insert the form into your sidebar!
#### Previous contributors:
* [Joost de Valk](http://profiles.wordpress.org/joostdevalk/)
* [ModernTribe](http://profiles.wordpress.org/moderntribe/)
* [Daddy Donkey Labs](http://daddyanalytics.com/)
== Screenshots ==
1. An example form generated with Brilliant Web-to-Lead for Salesforce (with optional CAPTCHA) -- both post and widget forms are shown in the TwentyEleven theme
2. The backend administration for Brilliant Web-to-Lead for Salesforce
3. The new form editor (multiple forms, hidden fields, add new fields, thanks URL, lead source per form)
== Installation ==
1. Upload the `plugin` folder to the `/wp-content/plugins/` directory or install via the Add New Plugin menu
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Enter your Salesforce.com Organization ID on the plugin configuration page.
== Frequently Asked Questions ==
= Does this plugin have any hooks or filters? Is there documentation? =
Yes, quite a few.
[Hooks & Filters Documentation](https://wordpress.org/plugins/salesforce-wordpress-to-lead/other_notes/)
= I'm not seeing any errors, but the entry didn't get added to Salesforce! =
To turn on in browser debugging, add a hidden field (enabled) named `debug` and set the value to `1`.
To turn on debugging via email, add a hidden field (enabled) named `debugEmail` and set the value to `you@yourdomain.com` (your email address).
Also check for debug logs at SalesForce to see if a validation rule is the culprit: `Administration Setup | Monitoring | Debug Logs`.
= I'm not receiving new submission emails =
99% of the time the plugin is sendign these... and the issue is at the WordPress or server level.
The Give team has an excellent article on [diagnosing and troubleshooting email issues](https://givewp.com/documentation/core/settings/emails/troubleshooting-common-email-problems/).
= What are the built in field names? Not all the fields are working when I use the Field Label in the lead edit screen? =
SalesForce is inconsistent in naming built in fields, and even misreports the names of some fields (like `MobilePhone`, which is actually `mobile`) in the customize fields screen. Generating a Web to Lead form gets you the real names, but the list below should help as well.
<strong>Built in fields</strong>
**Leads**
`
Human Name API Name
- - - - - - - - - - - - - - - - - - - - - - - -
First Name first_name
Last Name last_name
Title title
Website URL
Phone phone
Mobile mobile
Fax fax
Email email
Address street
City city
State/Prov. state
Zip zip
Country country
Description description
Industry industry
Rating rating
Annual Rev. revenue
Employees employees
`
**Cases**
`
Human Name API Name
- - - - - - - - - - - - - - - - - - - - - - - -
Contact Name ** name
Email email
Phone phone
Subject subject
Description description
Company company
Type * type
Status * status
Case Reason * reason
Priority * priority
Case Origin N/A (not settable via the WebToCase API)
* = must use a value from the picklist defined in your install
** = note that this will be auto prefixed as 'sf_name" in form output and POST data
`
<strong>Other Useful Fields</strong>
`
Lead Source lead_source
Email Opt Out emailOptOut
Fax Opt Out faxOptOut
Do Not Call doNotCall
Lead Record Type recordType
Campaign Campaign_ID
Campaign Member Status member_status
`
<strong>Name may vary (these are lookup fields), generate a Web-to-Lead form with these fields included for the actual value</strong>
`
SIC Code
Product Interest
Primary
Current Generator(s)
Number of Locations
`
= How do I setup Web to Lead/Case for my SalesForce Account? =
[Setting Up Web-to-Lead](http://login.salesforce.com/help/doc/en/setting_up_web-to-lead.htm)
[Setting Up Web-to-Case](http://login.salesforce.com/help/doc/en/setting_up_web-to-case.htm)
= How do I setup a Web to Case form? =
Choose _Web to Case_ in the **Form Settings** (bottom of the form editor page).
= Where do I find my Salesforce organization ID? =
To find your Organization ID, do the following steps:
1. Log in to your SalesForce.com account
2. Go to Setup » Company Profile » Company Information
3. You'll find the Organization ID in the lower right hand corner of your screen
= How do I use a SalesForce custom field? =
1. Go to Setup » Customize » Leads » Fields
1. If your custom field does not exist yet, create it now.
1. Find the API Name for your field (e.g. Custom_Field_Example__c). If it doesn't end in "__c" it's not the API name and will not work.
1. Add a new field to your form using the form editor on the plugin admin screen
1. Enter the API Name as the field name (left most box), then fill out the other fields normally (make sure to enable the field!).
1. Save your changes -- new submissions will now post that custom field to SalesForce.
= How do I use the checkbox field? =
Like any other field. Note that it is a single checkbox, not a checkbox list (yet).
*Note:* You must provide a value for your checkbox. Generally `1` is what you want (unless you're expecting something other than true/false in SalesForce). If you don't provide a value, your checkbox will never get sent with the form data (and even if it did, it won’t "check" the box at SalesForce as "empty" = unchecked).
_Checkbox lists and radio buttons will be in a future update._
= How do I pre-check a checkbox? =
Before you do, consider if a pre-checked checkbox (opt-out) is [really what you want to do](http://sethgodin.typepad.com/seths_blog/2002/03/opt_in_matters_.html).
If you insist on proceeding anyways: see the _Pre-check a checkbox_ example in [Other Notes](https://wordpress.org/plugins/salesforce-wordpress-to-lead/other_notes/).
= How do I use the select (picklist) field? =
**Hint: Use the form importer!**
Use it like any other field -- however you'll need to specify the options (and optional values) for each field using the options box (far right). You'll also need to use the "internal name" from Salesforce as your field name (see next FAQ).
The value box for a select list is the default value (the one selected on a fresh form).
`
/* Preferred format: */
// Use same data for display and value passed to SF
one
two
three
// Use different data for display and value passed to SF, require user to select something (assuming field is required)
Select One|
name1|value1
name2|value2
// Use different data for display and value passed to SF
name1|value1
name2|value2
/* Legacy Format (does not allow the use of colons in names or values): */
//Use same data for display and value passed to SF
one|two|three
//Use different data for display and value passed to SF, require user to select something (assuming field is required)
Select One: | name1:value1 | name2:value2
//Use different data for display and value passed to SF
name1:value1 | name2:value2
`
Some useful options lists -- you can remove any line(s) you don't want/need:
_*Note:* If state and country aren't a valid combo, or the state doesn’t match the default country of your Salesforce install, your lead will likely be rejected -- so be careful with these!_
States / Provinces
`
Select One|
State|
AL|Alabama
AK|Alaska
AZ|Arizona
AR|Arkansas
CA|California
CO|Colorado
CT|Connecticut
DE|Delaware
FL|Florida
GA|Georgia
HI|Hawaii
ID|Idaho
IL|Illinois
IN|Indiana
IA|Iowa
KS|Kansas
KY|Kentucky
LA|Louisiana
ME|Maine
MD|Maryland
MA|Massachusetts
MI|Michigan
MN|Minnesota
MS|Mississippi
MO|Missouri
MT|Montana
NE|Nebraska
NV|Nevada
NH|New Hampshire
NJ|New Jersey
NM|New Mexico
NY|New York
NC|North Carolina
ND|North Dakota
OH|Ohio
OK|Oklahoma
OR|Oregon
PA|Pennsylvania
RI|Rhode Island
SC|South Carolina
SD|South Dakota
TN|Tennessee
TX|Texas
UT|Utah
VT|Vermont
VA|Virginia
WA|Washington
WV|West Virginia
WI|Wisconsin
WY|Wyoming
DC|District of Columbia
AS|American Samoa
GU|Guam
MP|Northern Mariana Islands
PR|Puerto Rico
UM|United States Minor Outlying Islands
VI|Virgin Islands, U.S.
Province|
AB|Alberta
BC|British Columbia
MB|Manitoba
NB|New Brunswick
NL|Newfoundland and Labrador
NS|Nova Scotia
NT|Northwest Territories
NU|Nunavut
ON|Ontario
PE|Prince Edward Island
QC|Quebec
SK|Saskatchewan
YT|Yukon
`
Countries
`
AF|Afghanistan
AX|Åland Islands
AL|Albania
DZ|Algeria
AS|American Samoa
AD|Andorra
AO|Angola
AI|Anguilla
AQ|Antarctica
AG|Antigua and Barbuda
AR|Argentina
AM|Armenia
AW|Aruba
AU|Australia
AT|Austria
AZ|Azerbaijan
BS|Bahamas (the)
BH|Bahrain
BD|Bangladesh
BB|Barbados
BY|Belarus
BE|Belgium
BZ|Belize
BJ|Benin
BM|Bermuda
BT|Bhutan
BO|Bolivia (Plurinational State of)
BQ|Bonaire, Sint Eustatius and Saba
BA|Bosnia and Herzegovina
BW|Botswana
BV|Bouvet Island
BR|Brazil
IO|British Indian Ocean Territory (the)
BN|Brunei Darussalam
BG|Bulgaria
BF|Burkina Faso
BI|Burundi
CV|Cabo Verde
KH|Cambodia
CM|Cameroon
CA|Canada
KY|Cayman Islands (the)
CF|Central African Republic (the)
TD|Chad
CL|Chile
CN|China
CX|Christmas Island
CC|Cocos (Keeling) Islands (the)
CO|Colombia
KM|Comoros (the)
CD|Congo (the Democratic Republic of the)
CG|Congo (the)
CK|Cook Islands (the)
CR|Costa Rica
CI|Côte d'Ivoire
HR|Croatia
CU|Cuba
CW|Curaçao
CY|Cyprus
CZ|Czech Republic (the)
DK|Denmark
DJ|Djibouti
DM|Dominica
DO|Dominican Republic (the)
EC|Ecuador
EG|Egypt
SV|El Salvador
GQ|Equatorial Guinea
ER|Eritrea
EE|Estonia
ET|Ethiopia
FK|Falkland Islands (the) [Malvinas]
FO|Faroe Islands (the)
FJ|Fiji
FI|Finland
FR|France
GF|French Guiana
PF|French Polynesia
TF|French Southern Territories (the)
GA|Gabon
GM|Gambia (the)
GE|Georgia
DE|Germany
GH|Ghana
GI|Gibraltar
GR|Greece
GL|Greenland
GD|Grenada
GP|Guadeloupe
GU|Guam
GT|Guatemala
GG|Guernsey
GN|Guinea
GW|Guinea-Bissau
GY|Guyana
HT|Haiti
HM|Heard Island and McDonald Islands
VA|Holy See (the)
HN|Honduras
HK|Hong Kong
HU|Hungary
IS|Iceland
IN|India
ID|Indonesia
IR|Iran (Islamic Republic of)
IQ|Iraq
IE|Ireland
IM|Isle of Man
IL|Israel
IT|Italy
JM|Jamaica
JP|Japan
JE|Jersey
JO|Jordan
KZ|Kazakhstan
KE|Kenya
KI|Kiribati
KP|Korea (the Democratic People's Republic of)
KR|Korea (the Republic of)
KW|Kuwait
KG|Kyrgyzstan
LA|Lao People's Democratic Republic (the)
LV|Latvia
LB|Lebanon
LS|Lesotho
LR|Liberia
LY|Libya
LI|Liechtenstein
LT|Lithuania
LU|Luxembourg
MO|Macao
MK|Macedonia (the former Yugoslav Republic of)
MG|Madagascar
MW|Malawi
MY|Malaysia
MV|Maldives
ML|Mali
MT|Malta
MH|Marshall Islands (the)
MQ|Martinique
MR|Mauritania
MU|Mauritius
YT|Mayotte
MX|Mexico
FM|Micronesia (Federated States of)
MD|Moldova (the Republic of)
MC|Monaco
MN|Mongolia
ME|Montenegro
MS|Montserrat
MA|Morocco
MZ|Mozambique
MM|Myanmar
NA|Namibia
NR|Nauru
NP|Nepal
NL|Netherlands (the)
NC|New Caledonia
NZ|New Zealand
NI|Nicaragua
NE|Niger (the)
NG|Nigeria
NU|Niue
NF|Norfolk Island
MP|Northern Mariana Islands (the)
NO|Norway
OM|Oman
PK|Pakistan
PW|Palau
PS|Palestine, State of
PA|Panama
PG|Papua New Guinea
PY|Paraguay
PE|Peru
PH|Philippines (the)
PN|Pitcairn
PL|Poland
PT|Portugal
PR|Puerto Rico
QA|Qatar
RE|Réunion
RO|Romania
RU|Russian Federation (the)
RW|Rwanda
BL|Saint Barthélemy
SH|Saint Helena, Ascension and Tristan da Cunha
KN|Saint Kitts and Nevis
LC|Saint Lucia
MF|Saint Martin (French part)
PM|Saint Pierre and Miquelon
VC|Saint Vincent and the Grenadines
WS|Samoa
SM|San Marino
ST|Sao Tome and Principe
SA|Saudi Arabia
SN|Senegal
RS|Serbia
SC|Seychelles
SL|Sierra Leone
SG|Singapore
SX|Sint Maarten (Dutch part)
SK|Slovakia
SI|Slovenia
SB|Solomon Islands
SO|Somalia
ZA|South Africa
GS|South Georgia and the South Sandwich Islands
SS|South Sudan
ES|Spain
LK|Sri Lanka
SD|Sudan (the)
SR|Suriname
SJ|Svalbard and Jan Mayen
SZ|Swaziland
SE|Sweden
CH|Switzerland
SY|Syrian Arab Republic
TW|Taiwan (Province of China)
TJ|Tajikistan
TZ|Tanzania, United Republic of
TH|Thailand
TL|Timor-Leste
TG|Togo
TK|Tokelau
TO|Tonga
TT|Trinidad and Tobago
TN|Tunisia
TR|Turkey
TM|Turkmenistan
TC|Turks and Caicos Islands (the)
TV|Tuvalu
UG|Uganda
UA|Ukraine
AE|United Arab Emirates (the)
GB|United Kingdom of Great Britain and Northern Ireland (the)
UM|United States Minor Outlying Islands (the)
US|United States of America (the)
UY|Uruguay
UZ|Uzbekistan
VU|Vanuatu
VE|Venezuela (Bolivarian Republic of)
VN|Viet Nam
VG|Virgin Islands (British)
VI|Virgin Islands (U.S.)
WF|Wallis and Futuna
EH|Western Sahara*
YE|Yemen
ZM|Zambia
ZW|Zimbabwe
`
_Note: Leading & trailing whitespace is trimmed when names and values are displayed, so feel free to use spaces to make things more readable._
= How do I use the Date field? =
Choose it from the dropdown, that's all you *have* to do.
If you want to customize the date format or display/functionality of the datepicker UI, you can set the options by entering a list of options in the Options box of the field editor, one per line.
Note that you must end each option with a comma, or you'll end up with a javascript error instead of a datepicker.
Note that any options you specify will *override* the default options.
e.g.
Default date format - Year, Month, Day
`dateFormat : 'yy-mm-dd',`
Month, Day, Year
`dateFormat : 'mm-dd-yy',`
Day, Month, Year
`dateFormat : 'dd-mm-yy',`
Day, Month, Year + Show the button panel
`
dateFormat : 'dd-mm-yy',
showButtonPanel: true,
`
More information about the datepicker options can be found here:
1. Examples: http://jqueryui.com/datepicker/
1. API Reference: http://api.jqueryui.com/datepicker/
= How do I find the "internal name" of my picklist field? =
**Hint: Use the form importer!**
Picklists in SalesForce (Web to Lead at least) are a strange beast -- you'd think you could pass the field name and SF would map it on their end... but they don't make it that easy. Instead you need to use the internal SF ID of the picklist... which looks more like: `00Nd0000007p1Ej` (this is just en example, this is not the id of your field).
Where do you find this cryptic value? You can find it in two places (that I know of):
1. Edit the field and it'll be in the URL:
e.g. `https://na14.salesforce.com/00Nd0000007p1Ej/...`
2. Generate a Web to Lead form with your field included and it'll be in the HTML
e.g. `TestPicklist: <select id="00Nd0000007p1Ej" name="00Nd0000007p1Ej" title="TestPicklist">`
Then take the "name" you get (00Nd0000007p1Ej in this example) and enter that as the *field name* in your form editor. Yes, you enter this obtuse string of digits instead of the human readable field name (i.e. MyCustomField__c).
= How do I use the HTML field? =
1. Optionally enter a label (field will display full width if a label is not entered.
2. Enter HTML code in the options box.
_Note: You cannot use the HTML box to enter a custom field, as only "known" fields are submitted to salesforce and HTML fields are not submitted (just displayed). Be careful to avoid the `<form>` or `</form>` tags in an HTML field as they will likely break your form._
= How do I use a lookup field with a picklist field in the plugin? =
**Hint: Use the form importer!**
Since it's a lookup field the value of the options has to be SalesForce's <strong>internal id</strong>, not the value you'd think it would be. Otherwise when Jane Doe gets married and becomes Jane Smith you'd break all the links to her user.
Basically, you need to generate a Web to Lead form in Salesforce and grab the option values from the HTML it generates.
e.g.
Find the lookup field. This is the bit you're looking for:
`<option value="00Nd0000007p1Ej">Joe Schmoe</option>`
`<option value="00Nd0000007p1aB">Jane Doe</option>`
...
00Nd0000007p1Ej (just an example) is the SF internal ID for that choive. Enter that as the value in your pick list field options like this:
`00Nd0000007p1Ej:Joe Schmoe|00Nd0000007p1aB:Jane Doe`
= How do I change the order of input fields? =
Right now, the only way of ordering input fields is by changing the position numbers on the right hand side of the input fields table in the admin settings. Drag and drop re-ordering is on the roadmap.
= How do I apply my own styling to the form? =
Instructions for disabling or overriding the CSS are included on the plugin settings screen (see Style Settings).
= What does "Use WPCF7 CSS integration" do? =
This option adds the WPCF7 classes to the form fields so you get the WPCF7 CSS styles applied (if that plugin is also activated).
= Is it possible to make multiple forms with this plugin? =
Yes, version 2.0 introduces this feature.
Version 2.1 allows you to duplicate forms to reduce re-entering data.
Version 2.5 allows you to import Web-to-Lead forms from Salesforce.
= How do I change the Lead Source that shows up in Salesforce? =
You can easily change this by going into the admin panel and, under form settings, changing the Lead Source for that form.
= I want to include the full URL the form is embedded on, but SF limits the lead source to 40 characters -- how would I do that? =
The lead source supports using %URL% as the lead source (which will be replaced with the form embed url), but SF inexplicably limits the lead source to 40 characters.
Here's how to route around that:
`
/*
How to use:
1. Create a custom URL field at SalesForce (or Text field that holds more than 255 characters if you desire). A URL field makes it clickable in the lead detail view(s).
2. Replace URL_CUSTOM_FIELD_NAME below with the name of the custom field you setup in SalesForce,
it will be something like EmbedUrl__c
3. Add a hidden field to each form with the same field name (e.g. "EmbedUrl__c")
4. Profit
*/
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_embedurl', 10, 3 );
function salesforce_w2l_field_embedurl( $val, $field, $form ){
// Target a specific field on all forms
if( $field == 'URL_CUSTOM_FIELD_NAME' )
$val = esc_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
return $val;
}
`
https://gist.github.com/nciske/10047552
= Can I change the submit button? =
Of course you can! Go into the admin panel and, under Form Settings, change the text from the default "Submit" to whatever you'd like it to be!
= Will I lose data if I upgrade to 2.0? Do I need to change anything? =
Nope! The plugin will migrate your existing data to the new format. Your existing form will become Form 1 and be output by the [salesforce] shortcode).
= How do I show my other forms? =
Just use `[salesforce form="X"]` (X is the form number).
Or select a form number in the widget.
= I put my campaign name in the Campaign_ID field but it's not working =
The Campaign_ID field requires the Campaign ID -- the name will not work. To find the Campaign_ID, go your the campaign page and look in the URL bar for the ID:
e.g. https://salesforce.com/621U000000IJat
In this example, 621U000000IJat is the Campaign_ID -- make sure you use the ID from the campaign you want the lead attached to and not the example ID shown here.
= Does the return/thanks URL have to be on my site? =
No, as long as it's a valid URL it will work. However it should be an absolute URL regardless of where it is located.
e.g. http://yoursite.com/thanks/ not just /thanks/
= Is there a limit to how many leads can be captured? =
While the plugin has no limits, SalesForce does limit API calls per day:
_The daily limit for Web-to-Lead requests is 500. If your organization exceeds its daily Web-to-Lead limit, the Default Lead Creator (specified in the Web-to-Lead setup page) receives an email containing the additional lead information._
See also: [How many leads can we capture from our website?](https://help.salesforce.com/apex/HTViewHelpDoc?id=faq_leads_how_many_leads.htm&language=en_US#faq_leads_how_many_leads)
= Can I hide the admin message insisting I enter my organization id? =
Yes. Be careful -- that's there to remind you that the plugin doesn't do much without one.
Add this to functions.php or a custom plugin (see other notes for more detailed instructions):
`
add_filter( 'salesforce_w2l_show_admin_nag_message', '__return_false', 10, 1 );
`
== Filters and Hooks ==
**Note:**
* These should be placed in your active theme functions.php or a functionality plugin.
* Never edit a plugin directly (unless you understand the implications of doing so).
* You can use Pluginception to create a custom plugin for these to make them independent of your theme: https://wordpress.org/plugins/pluginception/
= Filters =
**salesforce_w2l_api_url**
Change the API url the plugin posts data to. Passes the form type (lead or case)
`
add_filter( 'salesforce_w2l_api_url', 'my_w2l_api_url', 10, 2 );
function my_w2l_api_url( $url, $form_type ){
return 'https://my.custom-api-url.com/something/';
}
`
**sfwp2l_validate_field**
Provide your own validation logic for each field.
_An error array is passed in, along with the field name, submitted value, and field configuration (type, default value, required, etc)._
Here's an example of blocking common free email providers:
`
add_filter('sfwp2l_validate_field','block_non_biz_emails', 10, 4);
function block_non_biz_emails( $error, $name, $val, $field ){
if( $name == 'email' ){
$non_biz_domains = array( 'gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com' );
$domain = array_pop(explode('@', $val));
if( in_array( $domain, $non_biz_domains ) ){
$error['valid'] = false;
$error['message'] = 'Please enter a business email addresss.';
}
}
return $error;
}
`
You can add to the $non_biz_domains to block other providers as well.
**salesforce_w2l_form_html**
HTML of the form before it's returned to WordPress for display
**salesforce_w2l_cc_user_from_name**
Change from name (user confirmation)
**salesforce_w2l_cc_user_from_email**
Change from email (user confirmation)
**salesforce_w2l_cc_admin_from_name**
Change from name (admin notification)
**salesforce_w2l_cc_admin_from_email**
Change from email (admin notification)
**salesforce_w2l_cc_admin_email_list**
Adding this code to your functions.php file will add 3 emails to the list. You can add as many as you want and each will get an admin notification email.
`
add_filter('salesforce_w2l_cc_admin_email_list','salesforce_add_emails');
function salesforce_add_emails( $emails ){
//uncomment line below to remove site admin
//unset($emails[0]);
$emails[]='email@domain.com';
$emails[]='email2@domain.com';
$emails[]='email3@domain.com';
return $emails;
}
`
**salesforce_w2l_cc_user_email_content**
**salesforce_w2l_cc_admin_email_content**
Allows you to filter (append, prepend, modify) the email message content sent to the user or admin(s).
`
add_filter('salesforce_w2l_cc_user_email_content','salesforce_filter_user_message', 10, 1);
function salesforce_filter_user_message( $message ){
$message = 'Before the user message' . "\r\n\r\n" . $message . "\r\n\r\n" . 'After the user message';
return $message;
}
add_filter('salesforce_w2l_cc_admin_email_content','salesforce_filter_admin_message', 10, 1);
function salesforce_filter_admin_message( $message ){
$message = 'Before the admin message' . "\r\n\r\n" . $message . "\r\n\r\n" . 'After the admin message';
return $message;
}
`
**salesforce_w2l_cc_admin_replyto_email**
Filter the Reply-To email header (e.g. to allow replies to go to the form submitter)
**salesforce_w2l_returl**
**salesforce_w2l_returl_{Form ID}**
Allows you to filter the value of a field before it is output to dynamically populate it with a value, auto set it based on another value, etc.
Examples:
`
// Filter Return/Success URL on a specific form
// salesforce_w2l_returl_{Form ID}
add_filter( 'salesforce_w2l_returl_1_tester', 'salesforce_w2l_returl_1_tester_example', 10, 1 );
function salesforce_w2l_returl_1_tester_example( $returl ){
return 'http://123.com';
}
`
**salesforce_w2l_success_message**
**salesforce_w2l_success_message_{Form ID}**
Allows you to filter the contents of the success message before it is output to dynamically populate it with a value, auto set it based on another value, etc.
Examples:
`
// Filter Success Message on a specific form
// salesforce_w2l_success_message_{Form ID}
add_filter( 'salesforce_w2l_success_message_1_tester', 'salesforce_w2l_success_message_1_tester_example', 10, 1 );
function salesforce_w2l_success_message_1_tester_example( $success ){
return 'Testing 123';
}
`
**salesforce_w2l_field_value**
**salesforce_w2l_field_value_{Form ID}_{Field Name}**
Allows you to filter the value of a field before it is output to dynamically populate it with a value, auto set it based on another value, etc.
Note that the second filter requires you to replace {Form ID} and {Field Name} to be replaced with the relevant form id and field name.
If you need access to the field or form settings in your filter you can use:
`$field = salesforce_get_field( $field_name, $form_id );`
`$form = salesforce_get_form( $form_id );`
Examples:
`
// Pre-check a checkbox
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_precheck_example', 10, 3 );
function salesforce_w2l_field_value_precheck_example( $val, $field, $form ){
$form_id = 1; // form id to act upon
$field_name = 'checkboxfield__c'; // API Name of the field you want to auto check
if( $form == $form_id && $field_name == $field && ! $_POST )
return 1; // or whatever the value of your checkbox is
return $val;
}
`
`
// Store HTTP referrer in a field (this is not 100% reliable as the browser sends this value to the server)
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_referrer_example', 10, 3 );
function salesforce_w2l_field_value_referrer_example( $val, $field, $form ){
$form_id = 1; // form id to act upon
$field_name = 'referrer__c'; // API Name of the field you want to autofill
if( $form == $form_id && $field_name == $field ){
if( isset( $_SERVER['HTTP_REFERER'] ) ){
return $_SERVER['HTTP_REFERER'];
}
}
return $val;
}
`
`
// Autofill fields based on thew query string (using Google Analytics tracking variables in this example)
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_querystring_example', 10, 3 );
function salesforce_w2l_field_value_querystring_example( $val, $field, $form ){
$form_id = 1; // form id to act upon
$field_name = 'source__c'; // API Name of the field you want to autofill
$qs_var = 'source'; // e.g. ?source=foo
if( $form == $form_id && $field_name == $field ){
if( isset( $_GET[ $qs_var ] ) ){
return $_GET[ $qs_var ];
}
}
return $val;
}
`
`
// Autofill a user's country based on IP
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_geoip_example', 10, 3 );
function salesforce_w2l_field_value_geoip_example( $val, $field, $form ){
// Based on this plugin: https://wordpress.org/plugins/geoip-detect/
// Adjust this code to the one used by your geo detection plugin
if( !function_exists( 'geoip_detect2_get_info_from_current_ip' ) ) return;
$form_id = 1; // form id to act upon
$field_name = 'country__c'; // API Name of the field you want to autofill
if( $form == $form_id && $field_name == $field ){
$userInfo = geoip_detect2_get_info_from_current_ip();
//$val = $userInfo->country->isoCode; // e.g. US
$val = $userInfo->country->name; // e.g. United States
}
return $val;
}
`
`
// Autofill a date
// https://codex.wordpress.org/Function_Reference/current_time
// http://php.net/manual/en/function.date.php
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_date_example', 10, 3 );
function salesforce_w2l_field_value_date_example( $val, $field, $form ){
$form_id = 1; // form id to act upon
$field_name = 'mydatefield__c'; // API Name of the field you want to auto check
if( $form == $form_id && $field_name == $field && ! $_POST )
return current_time('Y-m-d'); // or whatever date format you want
return $val;
}