Skip to main content
小组

AMPscript

AMPscript questions, tips and tricks.

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.

 

@AMPscript

 

#Email Marketing #Marketing Cloud

2 个回答
  1. 2024年7月26日 15:46

    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

0/9000

I've created a custom profile center in Marketing Cloud, on the cloud page the profile information is prepopulated using lookup function in Ampscript. the information is checked will be updated using a triggered send which will be sent to the account admin,, who will then update the info for the subscriber. need help with checking the profile information from CRM using the RetrieveSalesforceObjects function and then send a triggered email to the admin with only the fields the subscriber wants to update.  Can someone help on this? #Marketing Cloud #AMPscript #Cloud Page Landing Pages #Custom Profiles

1 个回答
0/9000

Hello Everyone, 

 

Hope all are doing well. I would like to learn AmpScript from basics could anyone please help me with the resources from where to gain knowledge except Trailheads. 

 

Thanks in Advance!

2 个回答
0/9000

Hi everyones,

 

I have a issue about a form. The issue is related with how can I put into a box form the client email ? Yesterday I tried with setting and call a declared variable, but that not is functioned. So, anyone knows how to do that? I loaded a image where you all can see it what I did.

 

Issue related with to put in a box form the email field like a placeholder

2 个回答
  1. Ruchit Patel (Cognizant) Forum Ambassador
    2023年1月27日 17:38

    nope @Kermit Del Rosario actually I have no expertise Ampscript side. it is something I am still yet to explore. Thanks for bringing in.

    @AMPscript

0/9000

I have created a survey and now want to retrieve it in my email template. Which content block shall I use to browse the survey to be used in email template? 

https://help.salesforce.com/s/articleView?id=sf.mc_es_retrieve_stored_content.htm&type=5

I found this article but it does not help much. 

 

@Shashi Prasad @Mateusz Dąbrowski

6 个回答
  1. 2022年10月28日 19:00

    @jaishree chundawat If you want to embed survey in email , then the only option in interactive form.

     

    if you have option not to embed into email but redirect to cloud page, you can design cloud page for survey and embed the link that would redirect the subscriber to cloud page.

     

    @* Marketing Cloud Engagement *

0/9000

Hello, 

I am new to WAC - Trying to create AMPScript snippet code solution to handle clients tracking parameters to add custom information that will be added in all specific email urls.

Tracking parameters code are in few formats like - trackingID, trackingID__c, Lead:TrackingID__c, Client: Tracking ID

Need to convert all of them if not into one Attribute value “trackingID”. If outcome attribute is not empty need to set this attribute to use as param.

This code should set link Tracking parameter to be used in email and the Snippet to be used within email that’s pulling contentblockbyid.

 

Where this code line should sits within html or css code ? @MarketingCloudConnectUser  @webanalytics @AMPscript 

1 条评论
  1. 2021年12月4日 16:21

    Hi @Srinivas Rathod,  Did you find an answer? I am a newbie and I have a similar case to figure out. Could you please advise with this? 

0/9000

Hi trailblazers,

 

Someone know witch the best way to implement a lead scoring for a form with AMPscript?

 

I really aprecciate your help.

 

@* Marketing Cloud Engagement * 

1 个回答
  1. Mateusz Dąbrowski (mateuszdabrowski.pl) Forum Ambassador
    2021年12月1日 13:07

    Quite hard to answer without knowing what outcome you expect. I would rather recommend using SQL Queries for Lead Scoring rather then AMPScript for most use cases, but maybe your requirement is indeed simple enough to be able to work with just AMPScript.

0/9000
1 条评论
  1. 2021年7月7日 17:57

    Got it to work:

    %%[var @Program,@fileset @Program = [LiveChatNow Major Code]set @file = Concat(@Program, '.pdf') if not empty(@Program) then    /* attach file to email /   AttachFile('FTP',@file)else    / do nothing */endif]%%
0/9000
Hello All, i am looking for some good ampscript resources other than MC documentation available at help.marketingcloud.com

.

Thanks

Nikhil

1 条评论
0/9000