I'm using a multiple value "Select options" component in my webform. I'm having trouble getting the multiple options to submit correctly the Contact Object in Salesforce. Currently the first item comes through OK and part of the second item selected comes through chopped off.
The key|value pairs in the webform component are the same and match exactly what's in Salesforce.
I'm using [submission:values:areas_of_interest:key]
as the value in the mapping.
I've try implementing hook_salesforce_webforms_push_params_alter
, but I can't figure out how to dpm
or print_r
values during the submission process.
Thanks for a great module! This is the only issue I'm having.
Comments
Comment #2
joelsteidl CreditAttribution: joelsteidl commentedComment #3
dbcollies CreditAttribution: dbcollies commentedI want to make sure I understand scenario:
What is the definition of the target field in the Contact object? Is it a picklist, text field, text area?
Comment #4
joelsteidl CreditAttribution: joelsteidl commentedSalesforce target field in the Contact object is Picklist (Multi-Select)
Webform is just a select and not a Salesforce Picklist. (I've manually made the options match the target field above).
Comment #5
dbcollies CreditAttribution: dbcollies commentedThanks for the update. I'll have to do a little digging to see if I can recreate the problem.
Out of curiosity -- is there a reason why you went with a select control rather than using the picklist control?
Comment #6
joelsteidl CreditAttribution: joelsteidl commentedThanks for your fast replies. I couldn't find the picklist in the list. Going back to look again.
Comment #7
joelsteidl CreditAttribution: joelsteidl commentedI limited available picklists to the one(s) I need.
https://www.evernote.com/l/AMmtR_kcnOREsrX0DeAV-0xQ52qxT15TOLYB/image.png
When editing my webform field, it should show up as a pre-built option list, correct?
https://www.evernote.com/l/AMl6ppNdufFKzJxVtt2x21cYuQgB7j8rhkcB/image.png
Update
Ok...sorry for wasting your time...I just found that Salesforce picklist was a component option. I had already created the webform before doing the Salesforce integration, so I wasn't aware that new component types are available.
Testing now.
Comment #8
dbcollies CreditAttribution: dbcollies commentedIt's not a waste of time at all. The code SHOULD work with the way you were doing it -- it shouldn't be required to use the picklist control.
Comment #9
joelsteidl CreditAttribution: joelsteidl commentedThe picklist is much closer. It does seem to pass the label, which I assumed I could clear up with [submission:values:areas_of_interest:key]
Is that correct?
Comment #10
dbcollies CreditAttribution: dbcollies commentedIn Salesforce picklists, the key and the label are the same, at least in the system primary language. If you translate the picklist, then the label will be the translated value, while the key will be the untranslated label. A design flaw in my opinion, but I doubt Salesforce is going to listen to me on that. ;-)
So, yes, you should use the :key form, but, unless you're doing multi-lingual, it won't appear to make any difference.
Comment #11
dbcollies CreditAttribution: dbcollies commentedI have been able to recreate the problem when using a standard select control. The way webform renders the control is not what I expected. This will take some development effort to resolve.
Thanks for pointing it out.
Comment #12
joelsteidl CreditAttribution: joelsteidl commentedNo problem!
This may quickly turn into another ticket, but the picklist values that are passed to SF seem to include the webform component field label. My token format is as follows:
[submission:values:field_name:key]
Is there another token option I should try?
Comment #13
dbcollies CreditAttribution: dbcollies commentedDid a little more digging, and I gave incorrect information earlier. That's what I get for answering without researching. You should NOT use the
:key
attribute with picklist controls - this module won't ever see it, and it apparently confuses the webform module. So, in your case, the correct syntax would be[submission:values:areas_of_interest]
The :key attribute only applies to controls of type 'select' and 'grid'. The way this module is built, it ALWAYS sends the key, and not the label. In most cases, they're the same anyway, unless the labels have been translated.
FYI, I did find a way of getting multiple select lists to work when sending to a Saleforce multi pick list, but it's very ugly. If your select list contained values something like
key1|Label 1
key2|Label 2
key3|Label 3
key4|Label 4
then the data to send to Salesforce would look like this:
[submission:values:areas_of_interest:key1];[submission:values:areas_of_interest:key2];[submission:values:areas_of_interest:key3];[submission:values:areas_of_interest:key4]
Or, if you wished to send the keys instead of the labels:
[submission:values:areas_of_interest:key1:key];[submission:values:areas_of_interest:key2:key];[submission:values:areas_of_interest:key3:key];[submission:values:areas_of_interest:key4:key]
Of course, that gets cumbersome VERY quickly as you add more options -- I'd stick with the picklist control. ;-)
Comment #14
joelsteidl CreditAttribution: joelsteidl commentedUsing the Picklist and
[submission:values:field_machine_name]
is working well now!Thanks a ton!
Comment #15
dbcollies CreditAttribution: dbcollies commentedGreat. I'm closing this as "works as designed"