Custom object select field in Salesforce web-to-lead form - salesforce

I have a custom object in salesforce called Classes and I am using the Leads object for storing student information. I have a web-to-lead form for capturing student registrations, but I would like to have the students select which class they are registering for, from a dropdown select field.
Is that possible using the web-to-lead form, or do I have to create a custom one with SQL queries?
Thanks in advance.

What's the relation between the two? Simple lookup from Lead to Class? In theory it should be many-to-many, with junction object.
From what I remember custom lookups from lead aren't available in the W2L form. Only Campaign is. And it renders to similar HTML:
<label for="Campaign_ID">Campaign</label><select id="Campaign_ID" name="Campaign_ID"><option value="">--None--</option><option value="701700000005lMn">International Electrical Engineers Association Trade Show - Mar 4-5, 2002</option>
<option value="701700000005lMl">User Conference - Jun 17-19, 2002</option>
<option value="701700000005lMk">GC Product Webinar - Jan 7, 2002</option>
<option value="701700000005lMm">DM Campaign to Top Customers - Nov 12-23, 2001</option>
</select><br>
So perhaps you could fake it, hand-craft similar HTML, point to your custom field, put right record ids in the options... Messy. Or consider displaying Campaigns & Campaign member stuff and then have something else (process builder? trigger?) that maps it from campaign to class.
If you have many-to-many or don't really like such workarounds - yup, looks like some code needed. Perhaps expose a Visualforce page as Site for signing up. Or - for non-technical people - Site.com might be tempting. https://salesforce.stackexchange.com/questions/23252/difference-between-force-com-site-and-site-com

Related

Salesforce Email logging on custom object

could really use some serious help on this. Below is the current business case:
We have the standard accounts, contacts, and opportunities objects. We've also created a custom object, and let's call it 'Customers.'
As of now, 'customers' are related to accounts.
Our users have einstein activity capture on, so all the email interactions get logged to the 'Account' level that the contact is related to, which makes sense.
The problem is that I want those emails tracked on the 'Customer' activity feed too, not just the 'Account' or 'Contact' activity feed.
Will creating a junction object between contacts and customers allow this activity to be shown in the 'customer' field? Or is there a simpler way to do this? Thank you in advance as this is a major roadblock I am facing right now.
I haven't worked with Einstein Activity Capture yet. What does it save stuff as? EmailMessage? Task? Either allows adding custom fields so you could add lookup to your Customer__c. With Task it's even simpler, it has that mutant lookup thing, Customer should appear as available option if it has "Allow Activities" ticked in setup.
Assuming that gives you something - next step would be to maybe make a custom quick action with some fields prepopulated, maybe a trigger to go "up" to Account and then to Customer(s)... Because out of the box
https://help.salesforce.com/articleView?id=aac_limitations.htm&type=5
Custom objects aren’t supported. When emails are sent from a custom
object, the email is logged on the activity timeline of the associated
contact.
You can upvote an idea: https://trailblazer.salesforce.com/ideaView?id=0873A000000EAIiQAO

symfony3 sonata-admin 3.10 - how to reuse the default list, show, and edit admin features in custom template or in other admin classes

I am currently working in a sales tracking project - where I am constantly getting into situation where I have to duplicate code about listing, showing or editing models.
I have 3 models, Lead, Customer, and Sales Activity. with 1:1 relations between Lead and Customer and 1:M relation between Lead and Sales Activity.
What I want is that when I SHOW a Lead, I should be able to reuse the show function of customer admin class, and I don't have to redo it in the show function of the Lead admin class.
Similarly, I want to be able add the LIST and CREATE function of the Sales Activity class into the Lead SHOW function without having to recode that which is already present. I could use render(controller()) in a custom template - but that includes the base template as well of the target controller, and it just messes the whole layout
I appreciate any input on the matter. thanks for your time.
Basic answer would be Admin class inheritance.
Another one would be to make a trait with your configureShowFields and use this trait in all of your admin classes.
If you are open to trying out a new bundle you can check : https://github.com/blast-project/CoreBundle
This bundle allows configuration of you admins in Yaml
And one of the features would suit your use case it would look like:
all:
Sonata\AdminBundle\Show\ShowMapper:
add:
name:
type: text
address:
type: textarea
...
It will let you configure your mappers for all your admins

Adding fields to a Junction Object from one of the Master-Detail relationships

In a Salesforce Junction object can I reference fields from the two Master-Detail relationships in formulas and/or the User Interface or am I going to have to switch to Apex code? I can write the apex, but I try to use the built in tools as much as possible :).
To use the examples from the Trailhead tutorials I have
1. A Job Position Object (Project Mananger, Sr Developer, etc).
2. A Posting Website Object (Monster.com, Dice.com, etc).
3. A "Job Posting" Junction Object to link the two.
Let's say I add a field to the Job Position Object called "Close Date" to keep track of the date the position closes. Can I display this field on the layout page of the Job Posting Junction object without using Apex code and/or a custom VisualForce page?
Thanks!
You can definitely do that. You can use a formula field and just reference the relationship name of the object and the field name (so for example something like Job_Position__r.Close_Date__c), or if you prefer you can use the "Insert Field" button when creating the formula which will allow you to select the object/field you want through the UI.

Summer camp event registration with Drupal 7

I'm building a site for a summer camp using Drupal 7, and I'd like for it to allow parents to register their kid(s) for week(s) at camp and then pay for it.
Creating an "event" for purchase in Ubercart, and using the pay per node module is the best way i can find to make this happen, a la the great tutorial series done by Pete Yaworski. Unfortunately, this means that parents have to fill out the fields for each week of camp purchased for each kid making this a multi-step process as many parents have 2 or more kids that they register for 2 or more weeks of camp.
I tried thinking about this in in terms of the Organic Groups and Profile 2 modules, where parents can create "kids" as nodes or sub-users, and I also tried the Field Attributes module to incorporate fields as product options, but I failed to come up with any useful implementation.
I think the best option is to allow Parents enter information about their kids (ie. name, age), possibly by entering each kid as a node. Ultimately, I'd like them to be able to purchase individual camp weeks and check a checkbox to indicate which kids are associated with each week, and have it all go into one cart for one purchase.
I'm just brainstorming at this point because I've just hit upon a lot of dead ends. Thanks for your help!
Well, it's been a while and i thought i might share what i've learned. Just to note, i switched to Drupal Commerce, which i think is much better equipped to handle this type of business.
The site is more focused on one user registering multiple people (kids) for multiple events, so having to fill out a registration form for each person specifically for each event that person is being registered for is a bit annoying, and bad UX. Instead, i allow registered users to complete a form (name, address, contact, etc..). Upon completion of the form, they are given a new user role via Rules which allow them to create content of type "kid". This is really sort of an extra step for the specific summer camp site; we expect the kids to have the same address/phone/etc.. as their parents. The parents can create "kid" nodes filling in field like "allergies" "health concerns" "age" and "name". These nodes are passed through a View with a Contextual Filter based on the User viewing the View; the View shows only content created by the User, and only shows field "name". This is then given as an entity reference to a Line Item Type using a checkbox/radio widget. Events can then be created as Products and given that Line Item Type. When a User is viewing the products he/she will see the "Name"s of the "Kids" they have created as choice next to the "add to cart" button. Conveniently, everything in Drupal Commerce from Products to Orders can be interpreted though views, so as long as the "kid" is attached as a line item, it's easy to organize the info about who registered who for what event when, and retrieve further details about all of that.
So, Parents are able to register with the site, fill out basic information, enter in information for each kid they want to register, then select which kid they want to register for which event. More useful, on the backend, the admin can see which kids are registered for which event, as well as who their parents are, how to contact them, and any important info specific to that kid.
Hope this helps anyone doing a similar project. :-)

Show Opportunity related Contacts in Custom Object Field

I have the next issue.
I have a custom object called 'Application', and I have this requirement:
"Show all Contacts related to an Application. Create a field on Application object, must be read only".
I solve it with apex code. 'Application' has a lookup to Opportunity, Opportunity to Account, and all my contacts have AccountId, so this way, I get all the contacts using apex code in a trigger.
But, I've been ask to change this to a Formula field in Application object.
So, my issue is next. I'm not able to get all contacts with advance formula editor, because they're not part of any object. I have no master-detail relationship.
Does any one know how can I achieve this using configuration? I should not use apex code for this req.
Thank in advance guys.
I don't think you can do it.
In formulas / merge fields syntax there's no way to go "up, up then down" (Application -> Opportunity -> Account -> down to Contacts related list). There's also nothing that would let you loop through Contacts (and display what? Ids? Names? Emails?). Roughly speaking you can only go up through dots.
You might want to explore path of "cross object workflow" rules but I imagine that when I add a new Contact to Account it should somehow "spread itself" to all related Applications? There's no straight way to fire a workflow on delete too - so you'd eventually end up with inaccurate list.
I'd say trigger was a good solution. Maybe it ws unoptimized but if it has to be in a field - tough.
There might be a fairly simple way of achieving that by embedding a visualforce page within Application page layout.
This should be doable with pure Visualforce (so technically there will be no Apex code ;))
Something as simple as
<apex:relatedList list="Contacts" subject="Application__c.Opportunity__r.AccountId" />
would be a good start (if you want your own layout and not a rel. list - you should be still able to pull it off with <apex:repeat> or <apex:pageBlockTable>.
There's one BUT here: it's not a field, just a display trick. Forget about using it in reports, mobile applications etc.
Another way - would it be acceptable to be 1 click away from these contacts? You could make a report "Account with Contacts", filter it by Id of one Account and later use "URL hacking" to change the filter depending on from which Application you'll click it. This link could be either a formula field or a real custom button/link. Technically - it's pure config, no apex & VF.
You can read more about URL hacking at Ray Dehler's excellent post and specifically about dynamic Reports here or here.

Resources