I'm working with a company that has a lovely little Marketing Cloud CloudPage set up at https://cloudpages.example.com/preferencecenter?SenderKey=XYZZY&EmailAddress={{Recipient.Email}}
to serve as an "unsubscribe / resubscribe" link.
The unsubscribe button works well on the backend when using this link -- [email protected]
gets added into appropriate Salesforce tables that serve as the "subscription preferences source of truth" in a way that's joined to the concept of sender "XYZZY
" without issue.
However, the "Thanks for unsubscribing" HTML rendered after the unsubscribe-button link gets clicked has this sort of error showing to the end user in their web browser at the top of the page (it seems to be just a bunch of unformatted text right inside <body>
before the first <meta>
):
{"message":"The function expression is invalid. See inner exception for detail.\r\n Script: InsertData("ENT.SubscriptionCenter_Log",\r\n "EmailAddress", @EmailAddress,\r\n "Sender", @SenderId,\r\n "CommunicationPreferenceId", @CommunicationPreferenceId,\r\n "SubscriberKey", @SubscriberKey,\r\n "OptedOut", @OptedOutOfSender,\r\n "Language", @Language,\r\n "EmailName", @EmailName,\r\n "MID", @MID,\r\n "JobId", @JobId,\r\n "ListId", @ListId,\r\n "BatchId", @BatchId,\r\n "DateSubmitted", @DateSubmitted,\r\n "BusinessUnit", @BusinessUnitId\r\n )\r\n Index: INDEX_NUMBER_CENSORED\r\n ListID: 0\r\n","description":"ExactTarget.OMM.InvalidScriptException: The function expression is invalid. See inner exception for detail.\r\n Script: InsertData("ENT.SubscriptionCenter_Log",\r\n "EmailAddress", @EmailAddress,\r\n "Sender", @SenderId,\r\n "CommunicationPreferenceId", @CommunicationPreferenceId,\r\n "SubscriberKey", @SubscriberKey,\r\n "OptedOut", @OptedOutOfSender,\r\n "Language", @Language,\r\n "EmailName", @EmailName,\r\n "MID", @MID,\r\n "JobId", @JobId,\r\n "ListId", @ListId,\r\n "BatchId", @BatchId,\r\n "DateSubmitted", @DateSubmitted,\r\n "BusinessUnit", @BusinessUnitId\r\n )\r\n Index: INDEX_NUMBER_CENSORED\r\n ListID: 0\r\n Error Code: OMM_FUNC_EXPR_INVALID\r\n - from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nExactTarget.OMM.FunctionExecutionException: **
An error occurred when attempting to execute an InsertData function call. See inner exception for details.**
\r\n Error Code: OMM_FUNC_EXEC_ERROR\r\n - from OMMCommon --> \r\n\r\n --- inner exception 2---\r\n\r\nExactTarget.OMM.OMMException: An error occurred when attempting to execute an update of the database. See inner exception for details.\r\n\r\n StackID: 7\r\n EnterpriseID: ID_NUMBER_FOR_ENTERPRISE_CENSORED\r\n ClientID: ID_NUMBER_FOR_ENTERPRISE_CENSORED\r\n Client Database ID: 718\r\n Account Type: ENTERPRISE_2\r\n JobID: 0\r\n MachineName: MACHINE_NAME_CENSORED\r\n\r\nSql Text:\r\nINSERT INTO[CID_NUMBER_FOR_ENTERPRISE_CENSORED].[SubscriptionCenter_Log]
([EmailAddress],[Sender],[CommunicationPreferenceId],[SubscriberKey],[OptedOut],[Language],[EmailName],[MID],[JobId],[ListId],[BatchId],[DateSubmitted],[BusinessUnit])\r\n VALUES (@p0_0,@p0_1,@p0_2,@p0_3,@p0_4,@p0_5,@p0_6,@p0_7,@p0_8,@p0_9,@p0_10,@p0_11,@p0_12);\r\n\r\nSql Parameters:\r\n 0: [NVarChar] @p0_0 =EMAIL_ADDRESS_ATTEMPTED_TO_UNSUBSCRIBE
\r\n 1: [NVarChar] @p0_1 =SALESFORCE_18_DIGIT_ID_FOR_PREF_CENTER_SENDER_CUSTOM_OBJECT_RECORD_MATCHING_XYZZY_THAT_IS_PART_OF_BUSINESS_UNIT_ABCCA
\r\n 2: [NVarChar] @p0_2 =SALESFORCE_18_DIGIT_ID_FOR_PREF_CENTER_PREFERENCE_CUSTOM_OBJECT_RECORD_MATCHING_EMAIL_ADDRESS_UNSUBSCRIBING_FROM_XYZZY
\r\n 3: [NVarChar] @p0_3 = \r\n 4: [Bit] @p0_4 = True\r\n 5: [NVarChar] @p0_5 = en_US\r\n 6: [NVarChar] @p0_6 = \r\n 7: [NVarChar] @p0_7 = UNSURE_WHAT_NUMBER_THIS_WAS_BUT_CENSORED\r\n 8: [Int] @p0_8 = NULL\r\n 9: [Int] @p0_9 = NULL\r\n 10: [Int] @p0_10 = NULL\r\n 11: [DateTime] @p0_11 = 9/14/2022 3:15:29 AM\r\n 12: [NVarChar] @p0_12 =SALESFORCE_18_DIGIT_ID_FOR_MARKETING_CLOUD_BUSINESS_UNIT_ABCCA
\r\n\r\n Error Code: OMM_SQL_UPDATE_ERR\r\n - from OMMCommon --> \r\n\r\n --- inner exception 3---\r\n\r\nSystem.Data.SqlClient.SqlException: \r\n\r\nError[0]: -- Number: 515 Class: 16 State: 2 Source: .Net SqlClient Data Provider Server: SERVER_NAME_CENSORED.XT.LoCaL\I05,10001 Line: 1\r\n Message:Cannot insert the value NULL into column 'JobId'
, table'ExactTarget718.CID_NUMBER_FOR_ENTERPRISE_CENSORED.SubscriptionCenter_Log'
; column does not allow nulls. INSERT fails. \r\n\r\nError[1]: -- Number: 3621 Class: 0 State: 0 Source: .Net SqlClient Data Provider Server: SERVER_NAME_CENSORED.XT.LoCaL\I05,10001 Line: 1\r\n Message: The statement has been terminated.\r\n\r\n HelpLink.ProdName: Microsoft SQL Server\r\n HelpLink.ProdVer: 13.00.6300\r\n HelpLink.EvtSrc: MSSQLServer\r\n HelpLink.EvtID: 515\r\n HelpLink.BaseHelpUrl: http://go.microsoft.com/fwlink\r\n HelpLink.LinkId: LINK_ID_NUMBER_CENSORED\r\n - from .Net SqlClient Data Provider\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}
Normally, such things aren't noticeable, because when e-mails go out from Marketing Cloud, the link to the Cloud Page is a fully-qualified https://cloudpages.example.com/preferencecenter?SenderKey=ABCDEFG&[email protected]&JobID=98765&ListID=2323232&BatchID=6789&EmailName=Some_Email_Name_String
.
However, the intent of only specifying SenderKey
and EmailAddress
in the URL is to allow other systems, like Pardot, to also have people unsubscribe through the company's centralized subscription preference center. In that case, there wouldn't be such Marketing-Cloud-specific details available to put into the URL, and they're really not necessary to unsubscribe someone, anyway.
I'll be meeting with the Marketing Cloud administrator for this company next week, but they didn't write this Cloud Page (they inherited it), and I haven't worked with this setup since it was hosted in Cloud Pages for an older Marketing Cloud instances that has since been decommissioned and also was built/retired by someone else.
Seeing as the page works fine, but is simply being "ugly" about logging inside of Marketing Cloud not going well (again, the real DML that needs to happen in Salesforce is doing just fine), what are some things I might have us look into as we try to get the error message to go away?
I'm open both to actually fixing the Cloud Page and to tricking it (e.g. maybe we just need to make a big old "ignore-these" job in Marketing Cloud so it has a job number? I don't know how to figure out what the minimum data entry standards would be to make the logging process happy).
Also, I should mention that a URL with just SenderKey
and EmailAddress
parameters worked fine in the Cloud Page hosted in the old Marketing Cloud instance. I don't know enough about Marketing Cloud to guess whether this one being "pickier" about its parameters has to do with something that changed under the covers in Marketing Cloud as a product, or if whoever reimplemented the Cloud Page in our new Marketing Cloud instance perhaps got a little more thorough with logging than the old Cloud Page had been.