0

Currently, I'm fetching Job ID, Subscriber key of a subscriber who clicks on the landing page.

Code in the Email,

%%[ SET @Sub = _subscriberkey SET @CloudPageID = 1646]%% 

Code in the landing page

%%[ 

set @Subs = AttributeValue('_SubscriberKey')
 set @JobId = AttributeValue('jobID')
 set @memberid = AttributeValue("memberid")
 set @member_busname = AttributeValue('member_busname')

 Set @lookUp = LookupRows('Page Visits','Subscriber Key', @Subs,'jobid', @jobid)

 IF RowCount(@lookUp) == 0 THEN 
 InsertData('Page Visits','Subscriber Key', @Subs,'jobid', @jobid,'memberid', @memberid, 'member_busname', @member_busname , 'Event Date', NOW())
ENDIF 
 ]%%

Using member_busname, it is fetching the Parent BU Name even though if I send the email from the child BU, Is there a way to get the child BU name?

  • not aware of a solution. As the Child BU name is unlikely to be super dynamic (I am assuming), I suggest to create a data Extension with MID / Child BU Name and perform a lookup into the DE by memberId. – Jonas Lamberty Mar 11 at 7:55
  • Is your cloudpage at the Child BU level or at the Parent BU level? – Josh de Blank Mar 12 at 4:00
  • My Cloudpage is at Child BU level – kiran Mar 12 at 9:44
2

member_busname is the Enterprise Business Name, not the name of the BU which is why it's all the same across the child BUs. The BU name is not available as a personalization string. There are SOAP objects that could be useful ("BusinessUnit", "Account"), but I don't think they are retrievable from the child BUs. You could use the memberid and an IF statement on your landing page to set the MID name, presumably the BU name will not change often. If you have a large number of BUs, you could create a Data Extension to contain all the BU names (perhaps in Shared DEs folder for easy access across BUs), and do a lookup from the landing page using the MID.

| improve this answer | |
0

I've created a new DE with all the Child BU names and MID's and used lookup and get the data from it. It is working for me.

%%[ 



set @Subs = AttributeValue('_SubscriberKey')
 set @JobId = AttributeValue('jobID')
 set @memberid = AttributeValue("memberid")


 Set @lookUp = LookupRows('Page Visits','Subscriber Key', @Subs,'jobid', @jobid)

SET @lookupvalue = LookupRows('BU Details','memberid', @memberid)


IF Rowcount(@lookupvalue) >0 THEN
   SET @BURow = Row(@lookupvalue, 1)
   Set @BUName = Field(@BURow, 'BUName')
ENDIF 


 IF RowCount(@lookUp) == 0 THEN 
 InsertData('Page Visits','Subscriber Key', @Subs,'jobid', @jobid,'memberid', @memberid, 'BUName', @BUName , 'Event Date', NOW())
ENDIF 
 ]%%
| improve this answer | |
0

You could probably grab it via the MID using WSProxy on the 'BusinessUnit' object.

Something like:

<script runat="server">

Platform.Load("Core","1.1.1");

  var prox = new Script.Util.WSProxy();

  //This will cause an error if the memberid attribute does not exist.
  //May want to set try/catch or similar error handling on this to prevent 500 error
  var mid = Platform.Variable.GetAttributeValue('memberid');

  /* Set ClientID */
  prox.setClientId({ "ID": mid }); //Impersonates the BU

  var cols = ["Name"];
  var filter = {
      Property: "ID",
      SimpleOperator: "equals",
      Value: mid
  };
  var res = prox.retrieve("BusinessUnit", cols, filter);

  var buName = res.Results[0].Name;

</script>

Then buName would equal the stored name inside the SOAP object of your Business Unit.

As noted in the comments in the code, you will want to put some sort of error handling on the defining of the mid variable though as if the page is accessed outside of the ClougPagesURL() function (which passes the memberid) then that attribute does not exist, which causes the GetAttributeValue() function to error, throwing a 500 error.


EDIT
As @JoshdeBlank commented, this is currently only functional in the parent BU. To account for that, I would recommend adjusting the above SSJS to grab all the MID and BU Name and push that into a shared DE. Then turn this into a script activity and have it run daily (or at whatever interval) to collect most recent BU MID and name into the DE. You can then use a lookup to that DE with the memberid to grab the name on your page.

| improve this answer | |
  • 1
    I tried this same method, before submitting my answer, in a child BU and got an error: Error: The argument accountEmployeeID passed to the AccountUser constructor is invalid. It does work at the parent level though. – Josh de Blank Mar 12 at 0:23
  • That is odd and you are right. I am going to send a note to SF as this is not documented that it should be only parent BU. I will also adjust my answer to clarify this limitation. Thanks @JoshdeBlank – Gortonington Mar 12 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.