All Questions
Tagged with marketing-cloud javascript
207 questions
0
votes
1
answer
62
views
JS Code in Browser AND Server
Is there any practical way to write JavaScript functions such that the same code can be executed in BOTH a Landing Page written in AMPscript AND SSJS executed on the server (other than copying the ...
-1
votes
1
answer
93
views
Send Cloudpage content in an email to a set email address
I have an interesting case that I find difficult to solve. The business wants this to be built in Cloudpages (and yes I know it's better to do it in Experience Cloud with custom components).
I can't ...
1
vote
0
answers
182
views
MCP (Personalization) SDK / sitemap which namespace to use and how to configure sitemap for multiple domains
In MCP (Personalization) SDK / sitemap, when we are reviewing the namespace, examples are supporting both: SalesforceInteractions & Evergage
https://developer.salesforce.com/docs/marketing/...
0
votes
0
answers
82
views
Javascript variable not being passed to ampscript when using Save button. The form should not be submitted
<form>
<input id="firstName" name="firstName" type="text" placeholder="First Name">
<input id="lastName" name="lastName" type=...
0
votes
1
answer
403
views
Retrieve with ws proxy with filter using DateValue does not work
Hello dear sfmc people,
using date field in filter does not work as it's stated in the documentation
https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/simplefilterpart.html
I have ...
0
votes
1
answer
58
views
smart Capture does not work with iphone
I have a smarcapture that I added this code snippet to pass by url a parameter of a question and it works in android and pc but it does not capture the IOS information.
const form = document....
1
vote
1
answer
189
views
How Do I Break Down a JSON Array Format CSV Column Into Individual Columns Within SFMC Data Extensions?
I have an interesting use-case where I am getting a Data Extension from CDP where one of the columns is in JSON Format.
Now I want to break down the last column of this DE into its individual columns....
0
votes
1
answer
150
views
SSJS to update query definition - stringify individual column names with loop
We have a script activity in automation studio to update the text of a query definition and target a new data extension. It currently selects all fields using the standard SELECT *, but we need to now ...
0
votes
0
answers
270
views
How to check if a today's date is between two dates using AMPScript in SFMC?
Background: On a cloud page in SFMC, I am trying to display a message if today's date is between start and end dates that are coming from data extension.
Question: How can I perform a check and see if ...
0
votes
1
answer
202
views
help with UpdateSingleSalesforceObject with server-side Javascript script
I want to perform data updates based on data that is in a DE, if the Contact_Id of the case is the same as what is in the DE then perform the modifications that are in the variables
but when I run the ...
0
votes
1
answer
439
views
how to access clientside code object in handlebar in salesforce marketing cloud personalization web template
I am trying to develop a timer clock in marketing cloud personalization web template and i am kind of new to salesforce.
right now, i have a date set in serverside code as below:
export class ...
0
votes
1
answer
198
views
Can you pass encoded url parameter strings in a cloudpages url?
This may not be an SFMC problem at all, and more of a scripting issue. But I wanted to see if there was anything I could do from an SFMC side.
I'm using the below code to generate an event on a ...
-2
votes
1
answer
391
views
Javascript issue "Object reference not set to an instance of an object."
I have a JSON file from which I need to extract some information about ordered items. i believe my JSON is configured properly with an array called 'items'.
Whenever I try to run my code, it gives me ...
0
votes
1
answer
146
views
How to update sendlog data extension after the email launch that has no primary key
We launched the ABC campaign newsletter to a 30000 target audience. Unfortunately, the subscriber key's email address was mapped incorrectly and the email launched. After the email launch, all email ...
0
votes
1
answer
91
views
Unsub and Submit the data in Marketing cloud Data Extension
When someone clicks on the email unsub URL, it will be redirected to the cloud page, and on CP, there are reasons for unsub using the check box. I want to perform two actions on a single button:
Save ...
0
votes
1
answer
206
views
Script to create a DE in MC automation studio enterprise edition
I am using this script to create a Data Extension in automation studio.
I checked my code on a landing page and the statuscode is 200. Whene running it on automation studio as a script it returns an ...
-2
votes
1
answer
1k
views
Pass a variable from Javascript to AMP Script or SSJS
Is it possible to pass a variable from Javascript to AMP Script or SSJS? The reason is I need to use Javascript libraries to generate a variable which I need to use in SSJS to make an API call.
0
votes
0
answers
167
views
Not able to retrieve null values from nested JSON array using SSJS For loop
Here's the nested json I'm working with
{
"Instructions":{
"Instruction":[
{
"Type 1":"abc",
"Type 2":"...
0
votes
1
answer
86
views
Programatically update the "Used for Sending" value for DEs in folder and all child folders
I'm attempting to update the "Used for sending" value for all DEs in a select folder and include the DEs in all the child folders.
I've written the code below that passes valideation, but I ...
0
votes
1
answer
251
views
Remove duplicates from an array built in SSJS
I'm using SSJS to pull api data and build emails. I have an array built that has some duplicate data in it. I'm looking for anyway to remove the duplicate information. I've tried all the regular JS ...
0
votes
0
answers
232
views
Retrieve AccountUser List Using WS Proxy and returns no rows Found
Help, I'm new to using WS Proxy.
I'm trying to retrieve Inactive users but throws me no rows found.
Here's the code I used.
<script runat="server">
Platform.Load("Core", &...
0
votes
1
answer
348
views
SmartCapture Form Not Submitting Values
I'm trying to have the "Otro" option display a text-field so someone can provide more details.
I have a SmartCapture form on a CloudPage that has a checkbox field with several options, and ...
0
votes
1
answer
671
views
AMPscript InsertDE is inserting an empty row
I have a code on client-side that is using JavaScript to create an object called "data" that contains several variables such as "matricula", "scheduled", "...
0
votes
1
answer
77
views
How to update Data Extention row without creating a new record
i am very new for marketing cloud and I am having this problem.I have a Data Extention containig a list of Subscribers with their email and subscriber key.I build a form working well, which can post ...
-1
votes
1
answer
471
views
Using UpdateSingleSalesforceObject for multiple records
I've got a Cloudpage with Ampscript that displays record information of a custom object related to a Contact. It displays a particular field as a checkbox, which corresponds with the custom object ...
0
votes
1
answer
208
views
Using MC Data Extension to update HTML on Landing Page [closed]
Is it possible to pass HTML code through a Data Extension value to set the HTML for an AmpScript Landing Page?
0
votes
1
answer
640
views
UpsertDE function not working on Shared Data Extension using SSJS from child BU even though used ENT
I want to use UpsertDE function on Shared Data Extension using SSJS from child BU. Even I tried ENT. before DE name, I have received 500 error in cloud page and script activity is getting errored in ...
1
vote
1
answer
1k
views
AMPscript and JS on the same submit action
I created a Landing Page in Marketing Cloud that basically consists of a form with checkboxes and a signature field. I have an AMPscript block that updates a salesforce fields based on the form ...
0
votes
0
answers
133
views
Pass AMPScript variable to client-side Javascript code in separate JS file
As above mentioned in the title, I'm trying to pass an AMPScript variable, which is a value coming from a data extension. The AMPScript block remains in the HTML code.
On the other hand, I have a ...
0
votes
0
answers
385
views
Salesforce Marketing Cloud - Use OnChange with AMP Script in Cloudpage
I have a problem since yesterday. I want to build a cloudpage which is use to save some informations filled by the customer. I need 2 dropdown list, which the options of the second one, depends on the ...
1
vote
0
answers
303
views
Fetch form values from localStorage to SSJS script
I am trying to resolve an issue of a scenario in which two cloud pages are created, for example, Page A contains a form with multiple fields, while Page B contains SSJS code to send the data to the ...
1
vote
1
answer
152
views
ERROR "Unable to retrieve security descriptor for this frame." When using WSPROXY's createitem with JSON object any tips?
So, I've been testing some use cases with SSJS and got into this error "Unable to retrieve security descriptor for this frame." which occurs with the
apiAudiencia.createItem("...
0
votes
1
answer
1k
views
How to configure a cloud page to be inaccessible to public in SFMC
Currently, I have built a cloud page in SFMC that is being used for custom report.
Goal is to make it private / inaccessible to public so only SFMC users can access it.
Out of scope options:
Private ...
0
votes
1
answer
638
views
Save radio button value into a variable using AMPscript
I'm quite new AMPscript, the problem I'm facing is I want to store the radio button value into a variable then I want to display that variable please someone help me.
<html lang="en">
...
0
votes
0
answers
294
views
CloudPage redirect to landing page not working - Error 500
I need some help with creating a Cloud Page that need to redirect customers to a landing page. When the customer land on the page this should be counted as action and trigger a 'Wait Until API Event' ...
0
votes
1
answer
731
views
how to use SSJS to extract all distinct values (may require looping) and push it to sql query in marketing cloud?
I am new to SSJS and have not used it yet.
I have a use case where I need to extract JobID and Data Extention Name from SendLog Data Extension.
I use JobID and DE_Name in SQL query but right now I ...
1
vote
0
answers
112
views
Duplicate API Calls on HTTPPost
We have added an API call to one of our emails, when activated in journey builder we are seeing the same contact hit the same API twice, sometimes three times ~85% of the time. Here is the JS we are ...
0
votes
1
answer
429
views
Pass a variable from AMPscript block to Client side JS?
I have an index.html file with the following structure:
%%[
SET @contactId = AttributeValue("_subscriberkey")
]%%
<!DOCTYPE html>
<html lang="en">
<head>
&...
0
votes
1
answer
366
views
Why does my publication list array return undefined in Vuejs?
I'm learning to build a custom preference centre and trying to display all the lists for a subscriber. I retrieved all the lists like below:
<script runat='server' type="text/javascript"&...
0
votes
1
answer
831
views
Retrieve fields from dynamic data extention in Custom activity?
I am having little issue :
in my js script I am trying to push some data dynamically :
/**
* Save settings
*/
function save() {
//if($form.valid()) {
payload['metaData'].isConfigured = ...
1
vote
1
answer
881
views
how to get the owner of a data extension in marketing cloud [closed]
Is there any way to get the owner of a DE through API or Query?, Currently we have have a SOAP API but this is not bringing us the Owner, this would be the only attribute that does not call
2
votes
2
answers
866
views
Pass arguments to Execute method in Custom Activity?
Hello I am having a little issue, I am using a template I found online, this, I have hosted it and it is working properly when it comes to ethds executiion and so on :
The issue is That I am trying to ...
0
votes
1
answer
694
views
Can I trigger a specific step of automation I want to start ? Using SSJS
I have this code that Start my automation, but I also would like to say what of steps start and finish
Like : I just want that step 3 start and finish
Follow the code:
<script runat="server&...
0
votes
1
answer
5k
views
How to use Next JS to send POST requests to Salesforce Marketing Cloud API
The problem
I'm building a site on Next.JS to collect emails and I need to send the emails to a Salesforce Marketing Cloud data extension via the API.
I first need to request an SFMC token then send ...
0
votes
0
answers
71
views
I'm having problems with inserting subscribers in my DE
I want to insert data in my DE, but instead of inserting each subscriber inside a line, it's putting all the text on my page on one line, how do I fix this?
The Subscribers that I retrieve in my web ...
0
votes
0
answers
164
views
I want to retrieve all the publications lists that it's inside of a folder
I have this code that retrieve all publications lists (Id and Name) from marketing cloud
I would like to retrieve just publications lists that it's inside of my folder called "Morning Message&...
0
votes
0
answers
117
views
I want to retrieve records from a List and update a DE, what's wrong with my code?
I tried retrieve the records from my list and then try "updateitem" with Data Extension inside
but it's not working
<script runat="server">
Platform.Load("core&...
0
votes
2
answers
214
views
Einstein Streaming Updates through API not working
I know there is another question out there similar to mine. When I make the Postman call, I receive a 401 error (unauthorized). I've checked the API_Key. Is this related to the whitelisting ...
0
votes
0
answers
2k
views
Adding css/js code resources into a Marketing Cloud Landing Page (Preference Center)
I want to start by saying I am very new to html, css, and js. So this may seem like a stupid questions.
After I upload my CSS file upload into Marketing Cloud using the code resource, I have added the ...
0
votes
0
answers
155
views
ClaimRow in SSJS does not work
I have wrapped AMP script function ClaimRow in to the SSJS it works and changes the boolean field to true but when I do lookup rows this change is not visible.. I had issue in the past and that is why ...