Custom Concatenate

Hi All,

I’ve looked over the custom concatenation help Open FN’s documentation provides (see below), but I’m struggling to figure out how to concatenate three values together.

I have data coming in from an ODK form with birth-year, birth-month and day and I want to concatenate that into a value that can be understood by a Salesforce date field, which would look something like birthyear/birthmonth/day.

Open FN’s custom concatenate:

field("ODK_Key__c", function (state) {
          return (
            dataValue("metaId")(state).concat(
              "(", dataValue("index")(state), ")"
            )
          )
        })

Interesting! Once you build your date string (e.g., “1997-03-21”) you’ll need to call new Date(“1997-03-21”).toISOString() to get it into the required Salesforce format. See here: http://openfn.github.io/docs/documentation/#convert-date-string-to-standard-iso-date-for-salesforce

Using that with str.concat could look like this:

field(“sf_date__c”, function(state) {
const string = dataValue(“year”)(state).concat(
“-”,
dataValue(“month”)(state),
“-”,

dataValue(“day”)(state)
)
return new Date(string).toISOString()
})

Thanks so much Taylor, very helpful!