How to Use AMPscript to Retrieve Channel Member Names and IDs

From $1

    This document contains conceptual and procedural information about using AMPscript to pull back channel member IDs and names from an Enterprise account.

    Prerequsites

    You must be familiar with AMPscript to use the information in this document. You must also have microsites or landing pages enabled for your account.

    Why Use AMPscript to Retrieve Channel Member Names and IDs

    The landing page in this example displays the channel member names and IDs for all entities within your Enterprise account. You can then use this information as part of your XML API or SOAP API calls to perform any necessary calls.

    How to Use AMPscript to Retrieve Channel Member Names and IDs

    Place the AMPscript below in a landing page and refresh to page to view the information. Note that you must change the ParentID in the AMPscript to match your parent account and create the data extension necessary to hold the information.

    %%[
    SET @param = RequestParameter("p")
    IF @param == 1 THEN
    SET @rr = CreateObject("RetrieveRequest")
    SetObjectProperty(@rr,"ObjectType","Account")
    AddObjectArrayItem(@rr,"Properties","ParentID")
    AddObjectArrayItem(@rr,"Properties","PartnerKey")
    AddObjectArrayItem(@rr,"Properties","Name")
    AddObjectArrayItem(@rr,"Properties","ID")
    AddObjectArrayItem(@rr,"Properties","Client.PartnerClientKey")
    AddObjectArrayItem(@rr,"Properties","AccountType")
    SetObjectProperty(@rr,"QueryAllAccounts",1)
    SET @sfp = CreateObject("SimpleFilterPart")
    SetObjectProperty(@sfp,"Property","ParentID")
    SetObjectProperty(@sfp,"SimpleOperator","equals")
    AddObjectArrayItem(@sfp,"Value","InsertYourMIDValueHere")
    SetObjectProperty(@rr,"Filter",@sfp)
    SET @results = InvokeRetrieve(@rr)
    FOR @i = 1 TO RowCount(@results) DO 
    SET @row = Row(@results,@i)
    SET @id = Field(@row,"ID")
    SET @name = Field(@row,"Name")
    SET @date = NOW()
    SET @ud = UpsertData("Query Mapping",1,"ChannelMemberName",@name,"ChannelMemberID",@id,"Date",@date)
    NEXT @i
    ENDIF
    ]%%%%=RowCount(@results)=%%
    NOTE: Add the string &p=1 to the end of your microsite or landing page when running this AMPscript to prevent the page from being processed by search bots and other similar mechanisms. If you wish to have your page processed, leave the string off of the URL and remove line 3 in the above code.


    This page was last updated by Ryan Williams on Thu, 22 Mar 2012 15:37:43 GMT.

    If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:

     


    Was This Page Helpful?
    Suggestions or Comments:
    Name (optional):
    Email Address (optional):
    Enter 19505 backwards:
       

    Tags: (Edit tags)
    • No tags
     
    Comments (0)
    You must login to post a comment.

     
    Powered by MindTouch 2010
    Admin