How to submit a form element as boolean instead of string?


Our client is asking for some help with form fields that are submitting to Salesforce via the connector. Everything seems to be passed as a string. "5" instead of 5 for a number and no way to pass a choice as true instead of "true". 

Am I missing something obvious?


Aug 01, 2019 18:43

I was able to adapt Quan Tran's code from and switch the string to boolean. Still waiting for the client to confirm that Salesforce looks correct but this seems to do what they want.

                    // get the selected value from submission data
                    var selectedValue = marketingActor.SubmissionData.Data[fieldName]?.ToString();
                    if (!string.IsNullOrWhiteSpace(selectedValue))
                        //replace string with boolean
                        if (selectedValue.ToLower() == "true")
                            marketingActor.SubmissionData.Data[fieldName] = true;

                        if (selectedValue.ToLower() == "false")
                            marketingActor.SubmissionData.Data[fieldName] = false;


Aug 02, 2019 18:01
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.