0

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 Automation Studio.

If i use DE within same child BU, it is working fine. I am facing issue with shared DE

Below is my code:

<script runat="server" language="javascript" excutioncontexttype="get">
Platform.Load("core","1");
Platform.Function.UpsertDE("[ENT.SharedDEname]",["Date"],[Now()],["FName","Lname","Status"],["value1","value2","value3"]);
</script>
1
  • 4
    You need to use the external key not the name of the DE in UpsertDE() I believe. That might be the issue you are having. I also would put this on a CloudPage and wrap in a try { ... } catch(e) { Write(Stringify(e)) } to have it output the cause of the 500 error for easier debugging. Nov 22, 2022 at 18:48

1 Answer 1

1

While it doesn't quite explain the same code working in child BU, I do see simple syntax error in your case:

"[ENT.SharedDEname]"

should not be an array but

"ENT.SharedDEname"

Which makes sense, the arrays are meant to accomodate "lists of things" - but this will be exactly one DE. Whereas the fields - primary keys and others - can be more than 1 and the array helps with that.

Platform.Function.UpsertDE and similar functions (insert, lookup, lookuprows), do work on DE name (reference), these SSJS Platform functions "mirror" AMPScript in capability (in that they do work by data extension name, and they do support "ENT.").

See a functional example of pretty much your usecase in the answer here: Rows.update data extension function

==

UpsertData's SSJS cousin "rows.add" from the Core library leverages the customerKey, where the ENT prefix simply "does not apply" and you couldn't do this.

https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionRowsAdd.html

3
  • Thanks Jonas. It helped.
    – SFMCuser
    Nov 23, 2022 at 7:58
  • nice - please accept the answer it the question is resolved for you :) Nov 23, 2022 at 8:01
  • Thanks. Accepted it
    – SFMCuser
    Nov 23, 2022 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .