How to pull in Journey ID via Marketing Cloud Data Views in SSJS

PART I: Obtain that Journey ID via Marketing Cloud Data Views – SSJS
Let’s take a look at Sandesh’s code below to outline the path of how to get from a personalization string (in this case _jobID) to identify the Journey ID that the send or job came from. In this section we’ll be digging into the wonderful world of Marketing Cloud Data Views (https://help.salesforce.com/s/articleView?id=sf.mc_as_data_views.htm&language=en_US&type=5

(1) The Job ID variable was set earlier up in the code:

In the amazing list of personalization strings in Marketing Cloud (https://help.salesforce.com/s/articleView?id=sf.mc_es_personalization_strings.htm&language=en_US&type=5_) you’ll find Job ID:


To set any personalization string to a variable simply add the name and a _ before the name.
(2) Our first lookup in the “Sent” Data View on line 60 to extract out the “TriggerSendDefinitionObjectID” on line 61
(3) This value is used to lookup in the “JourneyActivity” Data View on line 62 to extract the Journey “VersionID”.
(4) In our last lookup were going to the “Journey” Dataview on line 65
(5) To extract out the all important “JourneyID”

This is part of the following build session on the Journey Builder Wait Until Event functionality: https://handsonsfmc.com/2023/05/06/journey-builder-custom-activity-wait-until-event-journey-id-filtering/