0

I am trying to use InsertData amp-script function in an SMS. But its not working. My ultimate objective is to update customer data into master data extension when someone subscribes to 'START' keyword. I have not added the full code here and I am using this code in SMS confirmation part under Single Opt in template.

Code:

%%[
var @jobseeker, @optin,@mobile
SET @mobile = MOBILE_NUMBER 
SET @jobseeker = "1521763"
SET @optin = InsertData("SMS_Subscription_Status_LOCALE", "JOBSEEKER_ID", @jobseeker)
]%%

I tried to replicate the same in Cloud pages but its still not working and giving me the following error. Although same code with 'InsertDE' functionality works when running from cloud page. As per document InsertDE function should only be used inside email and not on cloud pages, mobile connect etcs.

"ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to execute an InsertData function call. See inner exception for details. Error Code: OMM_FUNC_EXEC_ERROR - from Jint --> --- inner exception 1--- ExactTarget.OMM.FunctionExecutionException: InsertData Function is not valid in content. This function is only allowed in a non batch context. Function: InsertData("SMS_Subscription_Status_LOCALE", "JOBSEEKER_ID", @jobseeker) Error Code: OMM_FUNC_CONTEXT_ERR - from OMMCommon "

I tried using SSJS it works.

Code:

<script runat="server">
var rows = Platform.Function.InsertData("SMS_Subscription_Status_LOCALE_NS",["JOBSEEKER_ID"],["1521763"]);
</script>
2
  • InsertData works fine in the SMS context. You say your SSJS is working, but it has a different DE name defined. Can you try testing your ampscript with the same DE as you have in your SSJS? Oct 18, 2023 at 9:06
  • Are you using name and not external key right? I am using insertdats and never had problems in cloud page Nov 6, 2023 at 21:27

0

You must log in to answer this question.