• Robert Wynter
  • NEWBIE
  • 65 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 42
    Replies
I've tweaked an unmanaged package to include an additional Affiliation upsert and it's causing my limit to exceed. if someone can please suggest what I can do to fix the following I would appreciate it. I'm only just learning this stuff. Thank you in advance :)
 
public void processInteractions(List<Interaction__c> newInteractions) {
   
	List<hed__Affiliation__c> affiliationsToUpsertagent = new List<hed__Affiliation__c>();


            //added Agent Affiliation on Agent_Key__c

   if (interaction.Affiliated_Agent_Account__c != null) {
   
         affiliationsToUpsertagent.add(createAgentUpsertAffilFromInteraction(interaction));
   
          system.debug(affiliationsToUpsertagent);
      }

       // Upsert Affiliations using the Upsert_Agent_Key__c
 
   if (affiliationsToUpsertagent.size() > 0) {
            
	logPossibleErrors(Database.upsert(affiliationsToUpsertagent, hed__Affiliation__c.Upsert_Agent_Key__c, false));

       
					     }

/*
We want to inject Apex directly into the SOQL query itself!
What we want to do is create a bind variable. A “bind variable” is simply the term for an Apex variable used inside a SOQL query.
Salesforce knows you’re using a bind variable when you precede your Apex variable with a colon (:)
1. we set the string variables for Contact and Agent Account ID's
2. Then, in our SOQL query, we used a bind variable to find every Affiliation Account in our database that has the same Contact with Agent to see if it exists!
3. if it does NOT exists, we insert the agent Affiliation
*/
        

private hed__Affiliation__c createAgentUpsertAffilFromInteraction(Interaction__c interaction) {
   
       
        
//Set String Variables
        String checkConID =interaction.Contact__c;
        //String checkAccID =interaction.Agent_Key__c;
        String checkAccID =interaction.Affiliated_Agent_Account__c;
        system.debug(checkAccID); 
        //Use SOQL query with Bind Variables to check for Existing Agent Account on Contact
        List<hed__Affiliation__c> AllAccounts= [select id, name 
                                FROM hed__Affiliation__c  
                                WHERE hed__Account__c= :checkAccID AND hed__Contact__c= :checkConID]; 
        
        //Set a list Affiliation for upsert

         hed__Affiliation__c newAffil1 = new hed__Affiliation__c();
        // intMappingService.applyDataToSObject(interaction, newAffil1); 
      
        if(AllAccounts.size() ==  0)//if affilisation does NOT already exisits, then create new affiliaition on Contact
        { 
     
        intMappingService.applyDataToSObject(interaction, newAffil1);//set up mapping for affiliation

        newAffil1.Upsert_Agent_Key__c = interaction.Contact__c + '.' + interaction.Affiliated_Agent_Account__c;
        newAffil1.Upsert_Key__c = interaction.Contact__c + '.' + interaction.Affiliated_Agent_Account__c;// because of the same mapping being used for the first affiliation record we need to replace it with agent
        newAffil1.hed__Status__c='Current';
        newAffil1.hed__Role__c='Applicant';
        newAffil1.hed__Account__c=  interaction.Affiliated_Agent_Account__c;
        newAffil1.hed__Primary__c=True;
        newAffil1.hed__Contact__c=interaction.Contact__c;   

        system.debug(AllAccounts.size()); 
        system.debug(newAffil1.hed__Account__c); 
        system.debug(newAffil1.hed__Contact__c);   

        upsert newAffil1;
       }//EOR_IF  
       
     
        return newAffil1;
   
    }

 
I have a checkbox and I want to create a formula that if the checkbox is checked. the formula will pick a number between 1 and NumberOfLeads 
This could inserts  a related affiliation record to contact on upload. I need to add some kind of if statement to have it skip if the Affiliation already exists.
 
//Updated by Robert Wynter for Agent Affiliation
        private hed__Affiliation__c createAgentUpsertAffilFromInteraction(Interaction__c interaction) {

        hed__Affiliation__c newAffil1 = new hed__Affiliation__c();
  
        intMappingService.applyDataToSObject(interaction, newAffil1);
  
         newAffil1.Upsert_Agent_Key__c = interaction.Contact__c + interaction.Agent_Key__c;
        
        newAffil1.hed__Status__c='Current';
        newAffil1.hed__Role__c='Applicant';
        newAffil1.hed__Account__c= interaction.Agent_Key__c;
        newAffil1.hed__Primary__c=True;
        newAffil1.hed__Contact__c=interaction.Contact__c;            
        upsert newAffil1;
       
        system.debug(newAffil1.hed__Account__c= accID);
        system.debug(newAffil1.hed__Contact__c=conID);

     
        return newAffil1;
    }

 
If you are using VS Code with the Salesforce Extension package and you've had an issue with the Replayer debug. Please let me know how you resolved the issues(s). I've tried uninstalling and reinstalling and even that will not work. I set the breakpoint and get the debug log. Right mouse clicks in the log and selects the Apex Replayer Debug. It starts no problem but when I do the step through it does not step through the cls file. it seems to be stepping through the debug console
We have an Installed unmanaged package and I need help reconfiguring the duplicate check of the apex code to include Recruitment_Interest__c and Term__c fields. But only when the Interaction_Source__c Equals "Student Information System" ELSE the existing Duplicate check of Last Name, First Name and Email can check.
/**
     * @description Does basic pre-processing for duplicates of the Interactions in the import. If it finds a possible
     * duplicate, it removes it from the import and flags it for future processing.
     * @param interactions, the List of new Interaction__c records.
     * @return the List of filtered Interaction__c records for processing.
     */
    private List<Interaction__c> duplicatePreProcessing(List<Interaction__c> interactions) {
        // If the custom setting is turned off, return the List and do not run any pre-processing for duplicates.
        if (Interactions_PreProcessing__c.getAll().values() != null) {
            for (Interactions_PreProcessing__c ipp : Interactions_PreProcessing__c.getAll().values()) {
                if (!ipp.Active__c) return interactions;
            }
        }

        Map<String, Interaction__c> filteredMap = new Map<String, Interaction__c>();

        for (Interaction__c interaction : interactions) {
            String filterKey = interaction.First_Name__c + interaction.Last_Name__c + interaction.Email__c;
           if (!filteredMap.containsKey(filterKey)) {
                filteredMap.put(filterKey, interaction);
            } else {
                interaction.Interaction_Status__c = 'Audit Required';
                String error = ' Reason: this Interaction was not processed because it is a possible ' +
                    'duplicate of - ' + filteredMap.get(filterKey).Id + ': ' + filteredMap.get(filterKey).First_Name__c +
                    ' ' + filteredMap.get(filterKey).Last_Name__c + ' ' + filteredMap.get(filterKey).Email__c;
                interaction.Audit_Reason__c = error;
                dupeInteractions.add(interaction);
            }
        }

        return filteredMap.values();
    }


 
Using JS to add to a dropdown from Salesforce repeater prefills. This works great, however, when I try to get the selected value when a user selects from the dropdown (tfa_4) and add to a text box (tfa_25), I get undefined. I've tried .selectedIndex -1, +1 and just selectedIndex and sometimes it works but only on one or two selected values and not in the right order

 
<script type="text/javascript">
    
    
    window.onload = document.addEventListener("DOMContentLoaded", function() {
    document.getElementById("tfa_4").options.length=0;
    var option = document.createElement("option");
    option.text = "Select Tour Date";
    document.getElementById("tfa_4").add(option);
    var startDate = document.querySelectorAll('[id^=tfa_9]');
    var campaignRepaterID = document.querySelectorAll('[id^=tfa_26]');
    
    for(var i in startDate){
                   textToWrite = startDate[i].value;
                if (textToWrite) {
                    if (textToWrite.length > 1) {
                        displayTime = textToWrite;
                        addToDropdown(displayTime);
                       }
                }
            }
            
    document.getElementById("tfa_4").addEventListener(
     'change',
  function getSelectedValue(){    //Gets the index value of the selected event
      var x = document.getElementById("tfa_4").selectedIndex - 1;
      //Finds and sets the event ID
var IDToFind = campaignRepaterID[x].value;
var dd = document.getElementById('tfa_25');
    dd.value = IDToFind;
    return;
        
}

  );
    
    });
    
    
    // Function to add to the campaign dropdown
        function addToDropdown(text) {
            var x = document.getElementById("tfa_4");//Dropdown field
            var option = document.createElement("option");
            option.text = text;
            x.add(option);
        }
        
</script>


 
Trying to switch out the static attachment in an email to dynamic based on a Data Extension(DE).

The Static:
%%[
%%=AttachFile("FTP","AIDI.pdf")=%%
]%%

And what I'm tried to replace it with:

%%[ var @Program,@ColumnProgramCode  set @ColumnProgramCode = Lookup("Program_Interest_G", "ProgramCode", "ProgramOfInterest", @Program)]%%
%%[
%%=AttachFile('FTP',%%@ColumnProgramCode%% +'.pdf')=%%
]%%

The DE is Program_Interest_G
the filed name is ProgramCode

User-added image

here is the code:
<table>
                    <tr>
                      <td>
                        <span><span>&nbsp; &nbsp;</span></span> 
                        <img class="logoLine" data-assetid="7253" height="40" src="http://image.info-durhamcollege.ca/lib/fe8c13727d6c007f71/m/1/610ae344-5e71-41c5-be5e-cc22ad45b5f8.png" style="margin: 0; border: 0; padding: 0; display: block;" width="29">
                      </td>
                      <td align="top" style="text-transform: uppercase; color: white;line-height: 8px;">
                        <h1>
                          <span style="font-size:10px;">%%=v(@Program)=%%</span>
                        </h1>
                        <h2>
                          <span style="font-size:10px;">%%=v(@ColumnSemester)=%% SEMESTER %%=v(@ColumnCredential)=%% %%[ IF NOT EMPTY(@ColumnSemester2) THEN ]%% / %%=v(@ColumnSemester2)=%% SEMESTER %%=v(@ColumnCredential2)=%% %%[ ENDIF ]%%</span>
                        </h2>
                      </td>
                    </tr>
                  </table>

 
The image works perfectly well in outlook but in Gmail it the image overlaps. The source of the image is reading from a file I FTP into Marketing cloud. The file is read, via ampscript on a Dynamic email content template and this sections of the email image is a web link to the image.

.headerImage {
                                        -webkit-background-size: cover;
                                        -moz-background-size: cover;
                                        -o-background-size: cover;
                                        background-size: cover;
                                        background-position: center top;
                                        background-repeat: no-repeat center;
                                       
                                      }
 
Which is being used in my td tag
 
                   <td background="%%=v(@ColumnHeaderPic)=%% " class="container headerImage" height="313" width="600">
                    <!--[if gte mso 9]>           <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:275px;">             <v:fill type="frame" src="%%=v(@ColumnHeaderPic)=%%" />             <v:textbox inset="0,0,0,0">           <![endif]-->

RESULT:
User-added image
I have two fields Email Opt-In    And Email Opt Out. I need that if field "Source" = FA then one of these need to be check. If Opt-In ischanged to TRUE then Opt-Out =False and it Opt-In ischanged to FALSE then Opt-Out = TRUE. So far I have the first part working with the following:
  1. Evaluation CriteriaEvaluate the rule when a record is created, and every time it's edited
  2. Rule CriteriaAND( 
    ISCHANGED(Email_Opt_In__c), 
    Email_Opt_In__c = FALSE, 
    Source__c = "FormAssembly")
  3. Field Update Email Opt-Out Updated To True
If you have any suggestions, please help
 
I need the user to select either both or at least one of the checkboxes.

Thank you in advance for your help:)       
<tr>
          <td>
            <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True" >  Please click here to allow us to continue to contact you via email. 
          </td> 
        </tr>
        <tr>
          <td>
            <input type="checkbox" name="Mobile_Opt_in" id="Mobile_Opt_in" value="True" >  Please click here to allow us to continue to contact you via phone. 
          </td> 
        </tr> 
In the ampscript content if I set to List and not DE like this “set @Program =v(ProgramOfInterests)” and preview test with a list. this will bring up content data related to the correct program.
 
If I change this to “set @Program =v(Lead:Global_Program_of_Interest_1__c) ” and use the DE “Leads from High School Visits ”
 
It does not work and this is where I need
 
I've added the email template code below and this is my Data Extension that is created by my Journey "Leads from High School Visits":
 
Lead:Campaign_Event_Type__cLead:High_School_Name__cLead:FirstNameLead:LastNameLead:Global_School_Program_of_Interest_1__cLead:Global_Program_of_Interest_1__c
High School/College VisitSt. Michael Catholic Secondary SchoolTest 1 RobertwynterSchool of Media, Art & DesignBroadcasting - Radio & Contemporary Media
 
%%[ var @Program,@url, @ColumnCredential2, @ColumnSemester2, @ColumnProgramCode, @ColumnSchool, @ColumnLeft, @ColumnRight, @ColumnCredential, @ColumnSemester, @ColumnLocation, @ColumnTitleDescription, @ColumnDescription, @ColumnHeaderPic, @ColumnMiddlePic, @ColumnBotPic, @ColumnQuote, @ColumnQuoteFrom, @ColumnQuoteFromPosition set @Program =v(Lead:Global_School_Program_of_Interest_1__c) set @ColumnProgramCode = Lookup("Program_Interest", "ProgramCode", "ProgramOfInterest", @Program) set @url = Concat("http://www.durhamcollege.ca/",@ColumnProgramCode) set @ColumnSchool = Lookup("Program_Interest", "SchoolProgram", "ProgramOfInterest", @Program) set @ColumnCredential= Lookup("Program_Interest", "CredentialAwarded", "ProgramOfInterest", @Program) set @ColumnSemester = Lookup("Program_Interest", "NumberOfSemesters", "ProgramOfInterest", @Program) set @ColumnCredential2= Lookup("Program_Interest", "CredentialAwarded2", "ProgramOfInterest", @Program) set @ColumnSemester2 = Lookup("Program_Interest", "NumberOfSemester2", "ProgramOfInterest", @Program) set @ColumnLocation= Lookup("Program_Interest", "CampusLocation", "ProgramOfInterest", @Program) set @ColumnTitleDescription = Lookup("Program_Interest", "TitleDescription", "ProgramOfInterest", @Program) set @ColumnDescription = Lookup("Program_Interest", "Description", "ProgramOfInterest", @Program) set @ColumnHeaderPic= Lookup("Program_Interest", "HeaderImage", "ProgramOfInterest", @Program) set @ColumnMiddlePic = Lookup("Program_Interest", "MiddleImage", "ProgramOfInterest", @Program) set @ColumnBotPic = Lookup("Program_Interest", "BottomImage", "ProgramOfInterest", @Program) set @ColumnProgramCode = Lookup("Program_Interest", "ProgramCode", "ProgramOfInterest", @Program) set @ColumnQuote = Lookup("Program_Interest", "Quote", "ProgramOfInterest", @Program) set @ColumnQuoteFrom = Lookup("Program_Interest", "QuoteFrom", "ProgramOfInterest", @Program) set @ColumnQuoteFromPosition = Lookup("Program_Interest", "QuoteFromDescription", "ProgramOfInterest", @Program) set @ColumnLeft = Lookup("Program_Interest", "LeftSideHTML", "ProgramOfInterest", @Program) set @ColumnRight = Lookup("Program_Interest", "RightSideHTML", "ProgramOfInterest", @Program) ]%%<table border="0" cellpadding="0" cellspacing="0" style="margin: 0px; padding: 0px" width="100%">
 /tr></table>

 
I have a landing page that displays a dynamic list from a data extension. From another landing page. How can I call / retrieve the content of the other page. I want to add that content as a string into a dropdownlist. The page content is ["Program 1", "Program 2", "Program 3", "Program 4", "Program 5"];
I've tried: 
%%[ set @JSON = HttpGET("insert URL here") ]%% // get JSON from ampscript var jsonObj = %%=TreatAsContent(HttpGet(@JSON)=%%; var evaluatedJSON = eval("(" + jsonObj + ")");

 
I can add the list with a for loop but I'd like to call a function and have that function append the items to the list. I have both on my code Just can't seem to figure out the call function option.
 
<table> <tr><th>Test 8</th></tr>
  <tr>
    <td>
%%[/* Modify to view AMPScript <div style="display:none"> */

var @DEProgramOfInterest, @lookupValue, @rowCount,@rows,@numRowsToReturn
set @lookupValue = "1234" /* ID for all records */


               /*Lookup("DataExtensionName"= the name of the Cloud Page Extention,
				        "ReturnColumn" = the column NAME where the record you wish to retrive is located
                        "LookupColumn" = the column you will use to match the value,
					     @lookupValue = the referenced value you wish the lookuoColumn to find)*/

set @multiRows = LookupRows("Program_of_Interest","ID",@lookupValue)
if @rowCount > 0 then

	/*Loop through rows and set variable to records while passing through loop*/
    for @i = 1 to RowCount(@multiRows) do

        var @Program_of_Interest
        Set @row = Row(@multiRows,@i)
        set @Program_of_Interest = field(@row,"Program of Interest")
  
  
    
/*Start of dropdown when count = 1*/
        if @i == 1 then
          outputline(concat("<select ><option value="">None</option>"))
		  outputline(concat("<option value="">None</option>"))
        endif
/*</div>*/ 

]%%

/*add values to dropdown*/
 <option value="">%%=v(@Program_of_Interest)=%%</option>

      
      
      
      
      
%%[ 
		/*end of dropdown*/
        if @i == @rowcount then
outputline(concat(" </select>"))
        endif
]%%
      
 <!-- this is my function call of fillDataList  -->     
 <script type="text/javascript">

 var newOption = $(fillDataList(%%=v(@Program_of_Interest)=%%))
 $('#test').append(newOption)
  


</script>  
    
           
%%[ 


    next @i 
]%%
</td>  
%%[ else ]%%

No rows found

%%[ endif ]%%
</tr>
  <tr>
    <td>
        <select class="test">
  
  
		</select> 
    </td>
    
  </tr>
  <tr>
  <td>
  

    
    </td>
  </tr>
</table>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 




<script>


 var fillDataList = function( options )
 {
      var items = ''
        $.each( options, function ( index, option ) {
            items += '<option value="' + option + '">'
            items += option
            items += '</option>'     })
            return items
  }

</script>

 
Can I somehow use RetrieveSalesforceObjects to retrieve the Lead objects fields then populate those field if exists. I have the retrive part now sure what I'd use to pre-file.
 
set @web = RetrieveSalesforceObjects("Lead", "Id","FirstName","LastName","MobilePhone", "Email", "=", @email)

 
Hi all not sure if this is the right place to post ampscript help. I have a web formthat is embeded into out website. The form has Name, Email and Phone. I'm tryign to replace phone with or Lead Field Mobile. The field name in Leads is MobilePhone. I get a 500 erro when I change this. In both createSalesforceObject/UpdateSingleSalesforceObject () I've tried ("MobilePhone", @MobilePhone ) AND ("Mobile", "@Mobile") and ("MobilePhone", "@Mobile"). 
 
%%[ 
set @post = QueryParameter("p")
set @Email = QueryParameter("emailaddress")
 set @FirstName = QueryParameter("firstname")
 set @LastName = QueryParameter("lastname")
 set @Phone = QueryParameter("phone")
 set @Email_Opt_in = QueryParameter("Email_Opt_in")
 set @SubmitDate = QueryParameter("SubmitDate")

   
If @post == "y" then 
  
   set @web = RetrieveSalesforceObjects("Lead", "Id", "Email", "=", @email)         

   if RowCount(@web) == 0 then

           CreateSalesforceObject("Lead", 5, "FirstName", @FirstName ,"LastName", @LastName, "Email",@Email,"Status","Open", "MobilePhone", @Phone)
    else 
        row Set @row = ROW(@web,1)
        Set @Id = FIELD(@row,"Id")
        UpdateSingleSalesforceObject("Lead",@id,"FirstName", @FirstName, "LastName", @LastName, "MobilePhone", @Phone) 
    endif 
   
UpsertData("BookTour_Form", 1, "Email", @Email, "FirstName", @FirstName, "LastName", @LastName, "SubmitDate", @SubmitDate) 
  
 var @emailaddr,@attr, @ts, @tsDef, @ts_subkey, @ts_sub, @ts_statusCode, @errorCode
       SET @ts = CreateObject("TriggeredSend")
       SET @tsDef = CreateObject("TriggeredSendDefinition")


       SetObjectProperty(@tsDef, "CustomerKey", "Additional_Tour_Info_Trigger")
       SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

       SET @ts_sub = CreateObject("Subscriber")
       SetObjectProperty(@ts_sub, "EmailAddress", @Email)   
       SetObjectProperty(@ts_sub, "SubscriberKey", @Email)   

       SET @attr = CreateObject("Attribute")
       SetObjectProperty(@attr, "Name", "FirstName")
       SetObjectProperty(@attr, "Value", @FirstName)
       AddObjectArrayItem(@ts_sub, "Attributes", @attr)

       SET @attr = CreateObject("Attribute")
       SetObjectProperty(@attr, "Name", "LastName")
       SetObjectProperty(@attr, "Value", @LastName)
       AddObjectArrayItem(@ts_sub, "Attributes", @attr)
  


       AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
       SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)


   
   EndIf 
]%%
  
%%[If @post == "y" then
   
redirect("http://www.durhamcollege.ca/book-campus-tour")
 
Else]%%
   
      <form action="http://pub.info-durhamcollege.ca/Booktour" method="POST" target='_parent'>
   <input type="hidden" id="p" name="p" value="y">
   <input type="hidden" id="rid" name="rid" value = "%%=v(@Id)=%%" />
   <input type="hidden" id="SubmitDate" name="SubmitDate" value="%%=Now()=%%">
                <table>
                  <tr>
                    <td>First Name
                    </td>
                    <tr>
                      <td>
                      <input  type="text" id="firstname" name="firstname" />
                    </td>
                    </tr>
                  <tr>
                    <td>Last Name*
                    </td>
                    </tr>
                  <tr>
                    <td>
                    <input type="text" id="lastname" name = "lastname" required />
                    </td>
                      </tr>
                  <tr>
                    <td>Email*
                    </td>
                     <tr>
                      <td>
                        <input type="email" id="emailaddress" name = "emailaddress" required/>
                    </td>
                    </tr>
                  <tr>
                    <td>Mobile Phone*
                    </td>
                     <tr>
                      <td>
                        <input type="tel" id="mobilephone" name = "mobilephone" required/>
                    </td>
                    </tr>
                    <tr>
                    <td>
                   <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True"> Durham College values the opportunity to provide you with information. Please click here to allow us to continue to contact you via email. </td> </tr>
                    
        </table>
                  <input type="submit" value="Submit">
  </form>
 
  
      %%[ endif ]%%

 
I have 2 custom buttons on my Accounts Object. The buttons have Javascript that tells the execution which Echosign Agreement template to use with the Account Object. I just created a process Builder for Contracts Object and I'd like to execute the templates within the PB. is there an example located someplace that someone can point me to. I was thinking since I can call apex in PB maybe there's an example out there that can help me figure this out. here is an example of the JS inside the custom button:
 
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} 
if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active' ) 
{ 
window.alert("Hello {!$User.FirstName} Please make sure you have entered the values in Contract End, Original Contract Start and Current Contract Start fields and that the Account Status is Active"); 
} 
else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Closed Won') 
{ 
window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o000000C6EDi ","_blank"); 
} 
else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Approved') 
{ 
window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o0000003aNJZ ","_blank"); 
}

 
I have a custom button that has a javascript picklist that checks feild criteria. I need to add a multi-picklist field to the if statement to check if it does NOT contain "India".
 
if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active' || {!INCLUDES(!Account.Target_Market__c, "India") == False } ) {



and here's the full syntax if needed:
 
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active' || {!CONTAINS(!Account.Target_Market__c, "India") == False } ) { window.alert("Hello {!$User.FirstName} Please make sure you have entered the values in Contract End, Original Contract Start and Current Contract Start fields and that the Account Status is Active"); } else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Closed Won') { window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o000000C6jYl ","_blank"); } else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Approved') { window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o0000004m8XH ","_blank"); }
My trigger fires if I edit/save Account only but I want it to fire once the Contract_End__c == Today_10_Trigger__c. The Today_10_Trigger__c is a formula. I'm getting the impression that triggers will not execute on an internal query,if that's the correct phase for a formula field. If this is the case does anyone have a suggestion for me.

Here's my trigger:
 
trigger RenewalUpdates on Account (before insert,before update) {
  
    List<Account > needsUpdate = new List<Account >();  
    
 for( Account accountId : Trigger.new)
 {

  if(accountId.Contract_End__c== accountId.Today_10_Trigger__c && accountId.Record_Type_Hidden__c== 'Agent' && accountId.Status__c == 'Active')
  {
     
     
        // do something here because your field are equal

        accountId.Renewal_In_Progress__c=true;
        accountId.Status__c='Renewal In progress';
        accountId.Approval_Progress__c='Up For renewal';        
     
        needsUpdate .add(accountId);
        System.debug('Test=============');
  }
}

}

 
I'm using a formulas to verify if 2 fields have changed from specific values to specific values. When I applied it to 1 field it works. I'm having trouble verifying 2 fields in the formula. Can I please get help tweaking this formula below. I want that if both Status__c and Approval_Progres__cc are changed from New to Active/Approved:

AND( 
ISPICKVAL(PRIORVALUE(Status__c),'New'), 
ISPICKVAL(Status__c, "Active") && ISPICKVAL(PRIORVALUE(Approval_Progress__c),'New'), 
ISPICKVAL(Status__c, "Approved"))
I have a checkbox and I want to create a formula that if the checkbox is checked. the formula will pick a number between 1 and NumberOfLeads 
This could inserts  a related affiliation record to contact on upload. I need to add some kind of if statement to have it skip if the Affiliation already exists.
 
//Updated by Robert Wynter for Agent Affiliation
        private hed__Affiliation__c createAgentUpsertAffilFromInteraction(Interaction__c interaction) {

        hed__Affiliation__c newAffil1 = new hed__Affiliation__c();
  
        intMappingService.applyDataToSObject(interaction, newAffil1);
  
         newAffil1.Upsert_Agent_Key__c = interaction.Contact__c + interaction.Agent_Key__c;
        
        newAffil1.hed__Status__c='Current';
        newAffil1.hed__Role__c='Applicant';
        newAffil1.hed__Account__c= interaction.Agent_Key__c;
        newAffil1.hed__Primary__c=True;
        newAffil1.hed__Contact__c=interaction.Contact__c;            
        upsert newAffil1;
       
        system.debug(newAffil1.hed__Account__c= accID);
        system.debug(newAffil1.hed__Contact__c=conID);

     
        return newAffil1;
    }

 
Trying to switch out the static attachment in an email to dynamic based on a Data Extension(DE).

The Static:
%%[
%%=AttachFile("FTP","AIDI.pdf")=%%
]%%

And what I'm tried to replace it with:

%%[ var @Program,@ColumnProgramCode  set @ColumnProgramCode = Lookup("Program_Interest_G", "ProgramCode", "ProgramOfInterest", @Program)]%%
%%[
%%=AttachFile('FTP',%%@ColumnProgramCode%% +'.pdf')=%%
]%%

The DE is Program_Interest_G
the filed name is ProgramCode
The image works perfectly well in outlook but in Gmail it the image overlaps. The source of the image is reading from a file I FTP into Marketing cloud. The file is read, via ampscript on a Dynamic email content template and this sections of the email image is a web link to the image.

.headerImage {
                                        -webkit-background-size: cover;
                                        -moz-background-size: cover;
                                        -o-background-size: cover;
                                        background-size: cover;
                                        background-position: center top;
                                        background-repeat: no-repeat center;
                                       
                                      }
 
Which is being used in my td tag
 
                   <td background="%%=v(@ColumnHeaderPic)=%% " class="container headerImage" height="313" width="600">
                    <!--[if gte mso 9]>           <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:275px;">             <v:fill type="frame" src="%%=v(@ColumnHeaderPic)=%%" />             <v:textbox inset="0,0,0,0">           <![endif]-->

RESULT:
User-added image
I have two fields Email Opt-In    And Email Opt Out. I need that if field "Source" = FA then one of these need to be check. If Opt-In ischanged to TRUE then Opt-Out =False and it Opt-In ischanged to FALSE then Opt-Out = TRUE. So far I have the first part working with the following:
  1. Evaluation CriteriaEvaluate the rule when a record is created, and every time it's edited
  2. Rule CriteriaAND( 
    ISCHANGED(Email_Opt_In__c), 
    Email_Opt_In__c = FALSE, 
    Source__c = "FormAssembly")
  3. Field Update Email Opt-Out Updated To True
If you have any suggestions, please help
 
I need the user to select either both or at least one of the checkboxes.

Thank you in advance for your help:)       
<tr>
          <td>
            <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True" >  Please click here to allow us to continue to contact you via email. 
          </td> 
        </tr>
        <tr>
          <td>
            <input type="checkbox" name="Mobile_Opt_in" id="Mobile_Opt_in" value="True" >  Please click here to allow us to continue to contact you via phone. 
          </td> 
        </tr> 
In the ampscript content if I set to List and not DE like this “set @Program =v(ProgramOfInterests)” and preview test with a list. this will bring up content data related to the correct program.
 
If I change this to “set @Program =v(Lead:Global_Program_of_Interest_1__c) ” and use the DE “Leads from High School Visits ”
 
It does not work and this is where I need
 
I've added the email template code below and this is my Data Extension that is created by my Journey "Leads from High School Visits":
 
Lead:Campaign_Event_Type__cLead:High_School_Name__cLead:FirstNameLead:LastNameLead:Global_School_Program_of_Interest_1__cLead:Global_Program_of_Interest_1__c
High School/College VisitSt. Michael Catholic Secondary SchoolTest 1 RobertwynterSchool of Media, Art & DesignBroadcasting - Radio & Contemporary Media
 
%%[ var @Program,@url, @ColumnCredential2, @ColumnSemester2, @ColumnProgramCode, @ColumnSchool, @ColumnLeft, @ColumnRight, @ColumnCredential, @ColumnSemester, @ColumnLocation, @ColumnTitleDescription, @ColumnDescription, @ColumnHeaderPic, @ColumnMiddlePic, @ColumnBotPic, @ColumnQuote, @ColumnQuoteFrom, @ColumnQuoteFromPosition set @Program =v(Lead:Global_School_Program_of_Interest_1__c) set @ColumnProgramCode = Lookup("Program_Interest", "ProgramCode", "ProgramOfInterest", @Program) set @url = Concat("http://www.durhamcollege.ca/",@ColumnProgramCode) set @ColumnSchool = Lookup("Program_Interest", "SchoolProgram", "ProgramOfInterest", @Program) set @ColumnCredential= Lookup("Program_Interest", "CredentialAwarded", "ProgramOfInterest", @Program) set @ColumnSemester = Lookup("Program_Interest", "NumberOfSemesters", "ProgramOfInterest", @Program) set @ColumnCredential2= Lookup("Program_Interest", "CredentialAwarded2", "ProgramOfInterest", @Program) set @ColumnSemester2 = Lookup("Program_Interest", "NumberOfSemester2", "ProgramOfInterest", @Program) set @ColumnLocation= Lookup("Program_Interest", "CampusLocation", "ProgramOfInterest", @Program) set @ColumnTitleDescription = Lookup("Program_Interest", "TitleDescription", "ProgramOfInterest", @Program) set @ColumnDescription = Lookup("Program_Interest", "Description", "ProgramOfInterest", @Program) set @ColumnHeaderPic= Lookup("Program_Interest", "HeaderImage", "ProgramOfInterest", @Program) set @ColumnMiddlePic = Lookup("Program_Interest", "MiddleImage", "ProgramOfInterest", @Program) set @ColumnBotPic = Lookup("Program_Interest", "BottomImage", "ProgramOfInterest", @Program) set @ColumnProgramCode = Lookup("Program_Interest", "ProgramCode", "ProgramOfInterest", @Program) set @ColumnQuote = Lookup("Program_Interest", "Quote", "ProgramOfInterest", @Program) set @ColumnQuoteFrom = Lookup("Program_Interest", "QuoteFrom", "ProgramOfInterest", @Program) set @ColumnQuoteFromPosition = Lookup("Program_Interest", "QuoteFromDescription", "ProgramOfInterest", @Program) set @ColumnLeft = Lookup("Program_Interest", "LeftSideHTML", "ProgramOfInterest", @Program) set @ColumnRight = Lookup("Program_Interest", "RightSideHTML", "ProgramOfInterest", @Program) ]%%<table border="0" cellpadding="0" cellspacing="0" style="margin: 0px; padding: 0px" width="100%">
 /tr></table>

 
I can add the list with a for loop but I'd like to call a function and have that function append the items to the list. I have both on my code Just can't seem to figure out the call function option.
 
<table> <tr><th>Test 8</th></tr>
  <tr>
    <td>
%%[/* Modify to view AMPScript <div style="display:none"> */

var @DEProgramOfInterest, @lookupValue, @rowCount,@rows,@numRowsToReturn
set @lookupValue = "1234" /* ID for all records */


               /*Lookup("DataExtensionName"= the name of the Cloud Page Extention,
				        "ReturnColumn" = the column NAME where the record you wish to retrive is located
                        "LookupColumn" = the column you will use to match the value,
					     @lookupValue = the referenced value you wish the lookuoColumn to find)*/

set @multiRows = LookupRows("Program_of_Interest","ID",@lookupValue)
if @rowCount > 0 then

	/*Loop through rows and set variable to records while passing through loop*/
    for @i = 1 to RowCount(@multiRows) do

        var @Program_of_Interest
        Set @row = Row(@multiRows,@i)
        set @Program_of_Interest = field(@row,"Program of Interest")
  
  
    
/*Start of dropdown when count = 1*/
        if @i == 1 then
          outputline(concat("<select ><option value="">None</option>"))
		  outputline(concat("<option value="">None</option>"))
        endif
/*</div>*/ 

]%%

/*add values to dropdown*/
 <option value="">%%=v(@Program_of_Interest)=%%</option>

      
      
      
      
      
%%[ 
		/*end of dropdown*/
        if @i == @rowcount then
outputline(concat(" </select>"))
        endif
]%%
      
 <!-- this is my function call of fillDataList  -->     
 <script type="text/javascript">

 var newOption = $(fillDataList(%%=v(@Program_of_Interest)=%%))
 $('#test').append(newOption)
  


</script>  
    
           
%%[ 


    next @i 
]%%
</td>  
%%[ else ]%%

No rows found

%%[ endif ]%%
</tr>
  <tr>
    <td>
        <select class="test">
  
  
		</select> 
    </td>
    
  </tr>
  <tr>
  <td>
  

    
    </td>
  </tr>
</table>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 




<script>


 var fillDataList = function( options )
 {
      var items = ''
        $.each( options, function ( index, option ) {
            items += '<option value="' + option + '">'
            items += option
            items += '</option>'     })
            return items
  }

</script>

 
Hi all not sure if this is the right place to post ampscript help. I have a web formthat is embeded into out website. The form has Name, Email and Phone. I'm tryign to replace phone with or Lead Field Mobile. The field name in Leads is MobilePhone. I get a 500 erro when I change this. In both createSalesforceObject/UpdateSingleSalesforceObject () I've tried ("MobilePhone", @MobilePhone ) AND ("Mobile", "@Mobile") and ("MobilePhone", "@Mobile"). 
 
%%[ 
set @post = QueryParameter("p")
set @Email = QueryParameter("emailaddress")
 set @FirstName = QueryParameter("firstname")
 set @LastName = QueryParameter("lastname")
 set @Phone = QueryParameter("phone")
 set @Email_Opt_in = QueryParameter("Email_Opt_in")
 set @SubmitDate = QueryParameter("SubmitDate")

   
If @post == "y" then 
  
   set @web = RetrieveSalesforceObjects("Lead", "Id", "Email", "=", @email)         

   if RowCount(@web) == 0 then

           CreateSalesforceObject("Lead", 5, "FirstName", @FirstName ,"LastName", @LastName, "Email",@Email,"Status","Open", "MobilePhone", @Phone)
    else 
        row Set @row = ROW(@web,1)
        Set @Id = FIELD(@row,"Id")
        UpdateSingleSalesforceObject("Lead",@id,"FirstName", @FirstName, "LastName", @LastName, "MobilePhone", @Phone) 
    endif 
   
UpsertData("BookTour_Form", 1, "Email", @Email, "FirstName", @FirstName, "LastName", @LastName, "SubmitDate", @SubmitDate) 
  
 var @emailaddr,@attr, @ts, @tsDef, @ts_subkey, @ts_sub, @ts_statusCode, @errorCode
       SET @ts = CreateObject("TriggeredSend")
       SET @tsDef = CreateObject("TriggeredSendDefinition")


       SetObjectProperty(@tsDef, "CustomerKey", "Additional_Tour_Info_Trigger")
       SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

       SET @ts_sub = CreateObject("Subscriber")
       SetObjectProperty(@ts_sub, "EmailAddress", @Email)   
       SetObjectProperty(@ts_sub, "SubscriberKey", @Email)   

       SET @attr = CreateObject("Attribute")
       SetObjectProperty(@attr, "Name", "FirstName")
       SetObjectProperty(@attr, "Value", @FirstName)
       AddObjectArrayItem(@ts_sub, "Attributes", @attr)

       SET @attr = CreateObject("Attribute")
       SetObjectProperty(@attr, "Name", "LastName")
       SetObjectProperty(@attr, "Value", @LastName)
       AddObjectArrayItem(@ts_sub, "Attributes", @attr)
  


       AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
       SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)


   
   EndIf 
]%%
  
%%[If @post == "y" then
   
redirect("http://www.durhamcollege.ca/book-campus-tour")
 
Else]%%
   
      <form action="http://pub.info-durhamcollege.ca/Booktour" method="POST" target='_parent'>
   <input type="hidden" id="p" name="p" value="y">
   <input type="hidden" id="rid" name="rid" value = "%%=v(@Id)=%%" />
   <input type="hidden" id="SubmitDate" name="SubmitDate" value="%%=Now()=%%">
                <table>
                  <tr>
                    <td>First Name
                    </td>
                    <tr>
                      <td>
                      <input  type="text" id="firstname" name="firstname" />
                    </td>
                    </tr>
                  <tr>
                    <td>Last Name*
                    </td>
                    </tr>
                  <tr>
                    <td>
                    <input type="text" id="lastname" name = "lastname" required />
                    </td>
                      </tr>
                  <tr>
                    <td>Email*
                    </td>
                     <tr>
                      <td>
                        <input type="email" id="emailaddress" name = "emailaddress" required/>
                    </td>
                    </tr>
                  <tr>
                    <td>Mobile Phone*
                    </td>
                     <tr>
                      <td>
                        <input type="tel" id="mobilephone" name = "mobilephone" required/>
                    </td>
                    </tr>
                    <tr>
                    <td>
                   <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True"> Durham College values the opportunity to provide you with information. Please click here to allow us to continue to contact you via email. </td> </tr>
                    
        </table>
                  <input type="submit" value="Submit">
  </form>
 
  
      %%[ endif ]%%

 
I have a custom button that has a javascript picklist that checks feild criteria. I need to add a multi-picklist field to the if statement to check if it does NOT contain "India".
 
if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active' || {!INCLUDES(!Account.Target_Market__c, "India") == False } ) {



and here's the full syntax if needed:
 
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active' || {!CONTAINS(!Account.Target_Market__c, "India") == False } ) { window.alert("Hello {!$User.FirstName} Please make sure you have entered the values in Contract End, Original Contract Start and Current Contract Start fields and that the Account Status is Active"); } else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Closed Won') { window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o000000C6jYl ","_blank"); } else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Approved') { window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o0000004m8XH ","_blank"); }