I'd do a reflection on the package code using DotPeek or similar. You may find that the actor used for pushing to Salesforce has method that would allow you to override the format but that's a guess.
Great. Thanks for idea and help Scott. Will take a look and update the ticket with some findings.
Hi Bogdan,
You can create a custom ActorsExecutingService(class in EpiServer.Forms package) service to modify submission data before pushing data to connectors (e.g Salesforce in your case). Don't forget to register new dependency.
I make a quick test with Campaign Connector and it works
using EPiServer.Forms.Core.Models;
using EPiServer.Forms.Core.PostSubmissionActor;
using EPiServer.Forms.Helpers.Internal;
using EPiServer.Forms.Implementation.Elements;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class CustomActorsExecutingService : ActorsExecutingService
{
public override IEnumerable<IPostSubmissionActor> GetFormSubmissionActors(Submission submission, FormContainerBlock formContainer, FormIdentity formIden, HttpRequestBase request, HttpResponseBase response, bool isFormFinalizedSubmission)
{
var allActors = base.GetFormSubmissionActors(submission, formContainer, formIden, request, response, isFormFinalizedSubmission);
var returnActors = new List<IPostSubmissionActor>();
foreach (var actor in allActors)
{
// if not Marketing Automation actor, add to returnActors list and ignore
if (!(actor is MarketingConnectorActor))
{
returnActors.Add(actor);
continue;
}
var allFormElements = formContainer.Form.Steps.SelectMany(st => st.Elements);
var choiceAndSelectionElements = allFormElements.Where(x => x.SourceContent is ChoiceElementBlock || x.SourceContent is SelectionElementBlock);
var marketingActor = actor as MarketingConnectorActor;
foreach (var element in choiceAndSelectionElements)
{
var fieldName = element.SourceContent.GetElementName();
//if (element.SourceContent is SelectionElementBlock)
//{
//}
// get the selected value from submission data
var selectedValue = marketingActor.SubmissionData.Data[fieldName]?.ToString();
if (!string.IsNullOrWhiteSpace(selectedValue))
{
// replace comma with semicolon
marketingActor.SubmissionData.Data[fieldName] = selectedValue.Replace(",", ";");
}
}
returnActors.Add(marketingActor);
}
return returnActors;
}
}
The data is sent to Campaign Connector system
Hope this help !
Works like charm. Thanks a lot Quan!
Worth to mention that MarketingActor resides in separate nuget package (EPiServer.Marketing.Automation.Forms).
It is about a form containing multiple choice fields. When you submit the form - multiple choice values are saved as string separated by comma. I am trying to utilize Marketing Automation package and send form submissions to Salesforce. SF itself use semicolon as multifield value separator. Therefore integration failed in case form submission contains multi field values.
Do we have any option to customize field value separator on Episerver side and specify alternative character?