0

In my SSJS, I am using this approach to retrieve the value / record from a data extension field.

  • Data extension name is Test_QResult

  • Data extension field name from where i want to retrieve value is DE_Name

    var DEnameInRows = DataExtension.Init("Test_QResult").Rows.Retrieve();
    
    var FromDEname = DEnameInRows[1].DE_Name;
    

In my test, FromDEname is showing null - can anyone please help?

Write(Stringify(FromDEname));

1 Answer 1

0

As described in this answer, you need can't use the name of the DE in the DataExtension.Init() function, but need to use it's external key.

For example:

var DEnameInRows = DataExtension.Init("A1A1A1A1-B2B2-C3C3-D4D4-E5E5E5E5E5E5").Rows.Retrieve();

var FromDEname = DEnameInRows[1].DE_Name;

That's one option, but you could just simply change the external key (for example in Email Studio) to Test_QResult and your original code should start working.


You might already know this, but it could also come in play here:

If you would have only one record in the DE, you wouldn't be able to retrieve it with DEnameInRows[1]. In contrast to Ampscript where rowsets start with 1, arrays in JavaScript (and SSJS) start with 0 (are zero-indexed), so you would need to use DEnameInRows[0].DE_Name.

You must log in to answer this question.

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