Hi All,
I am creating a Trigger for form which will redirect after submitting to a thank you page. I am reaching to thank you page but not next steps. The trigger is not working and updating the data into DE and sending trigger mail. I am sharing you details to understand the ampscript code below.
I put the AMPScript on that thank you page to trigger mail it and getting an error message -
Error Message: "CreateObject Function is not valid in content. This function is only allowed in non sendable content. Function: CreateObject(\"TriggeredSend\")"
Description: "ExactTarget.OMM.FunctionExecutionException: CreateObject Function is not valid in content. This function is only allowed in non sendable content. Function: CreateObject(\"TriggeredSend\") Error Code: OMM_FUNC_CONTEXT_ERR - from Jint "
The Script I have created is -
%%[
VAR @name, @email, @ts, @tsDef
SET @name=RequestParameter("name")
SET @email=RequestParameter("email")
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @TriggeredSendExternalKey = "43699"
SetObjectProperty(@tsDef, "CustomerKey", @TriggeredSendExternalKey)
SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "SubscriberKey", @email)
SetObjectProperty(@ts_sub, "EmailAddress", @email)
SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr , "Name", "Name")
SetObjectProperty(@ts_attr, "Value", @name)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)
SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "SubscriberKey")
SetObjectProperty(@ts_attr, "Value", @SubscriberKey)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)
SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "EmailAddress")
SetObjectProperty(@ts_attr, "Value", @email)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statuscode = InvokeCreate(@ts, @errorCode)
]%%
I have tested on ampscript.io and getting some warnings. shared in attachment.
Hi Shubham,
did you find a way to create your triggered send ?
I face the same error and I can't find anything on the web to create my triggered send.
I tried AMPSCRIPT and SSJS and I raised the same error
If you found how to do so, can you give me some tricks ?
Many thanks
Regards
Jerome