volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

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?

Thanks!

#206068
Aug 01, 2019 18:43
Vote:

I was able to adapt Quan Tran's code from https://world.episerver.com/forum/developer-forum/episerver-forms/thread-container/2019/1/customize-multiple-choice-form-field-value-separator-/ 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;
                        }

                    }

#206123
Aug 02, 2019 18:01
error 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.