Last active
September 20, 2023 01:26
-
-
Save katydorjee/24fa882a02656619c869ea9bd0e005cc to your computer and use it in GitHub Desktop.
Delete a record from DataExtension using AMPscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
SET @status = DeleteData("DataExtension Name", "SubscriberKey","XXXXXXXXXX") | |
]%% | |
Status: %%=v(@status)=%% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Converting to SSJS:
<script runat='server'>Platform.Load('Core','1');
try{
var DE_name = 'XYZ';
var FeildName = 'SubscriberKey';
var FeildValue = 'XXXXXXXXXX';
var ampscriptStr = '%'+'%[SET @deleteCount = DeleteData("'+DE_name+'","'+FeildName+'","'+FeildValue+'")]%'+'%';
Platform.Function.TreatAsContent(ampscriptStr);
Write(Platform.Variable.GetValue("@deleteCount"));
}catch (ex){
Write(Stringify(ex));
}
</script>