• Alfredo Ornelas
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 11
    Replies
This is my FIRST trigger.
I want to create an "Event" after "Time Off Request" is Approved.
After approving, the following error message is showing...

User-added image

Here is my trigger:

trigger TRTimeOffAfterUpdate on Time_Off_Request__c (after update) {

for (Time_Off_Request__c toEvent : Trigger.new) {
    if(toEvent.Status__c=='Approved'){
   // Event event = new Event
   Event ev= new Event 
   (
        OwnerId = toEvent.CreatedById,
        StartDateTime = toEvent.First_Day_Off__c,
        EndDateTime = toEvent.End_Time_Off__c,
        Subject = toEvent.Type__c,
        Description =  toEvent.Comments__c,
        ShowAs = 'Out of Office'
    );
    insert ev ;             
}
}
}

Any idea what is wrong?
Thanks
I'm new to code, can someone help and give me an idea how I can create an entry form as below with Lightning Component?
User-added image
Thanks!
I have a screen flow showing pre-populated values on it...is there a way to DON'T PRE-POPULATE VALUES? Thanks!
below screenshot of my flow

User-added image
Hi
I changed the OWD of a custom object from "Public Read/Write" to "Private". When using CLI command "sfdx force:source:pull" it's showing "No results found".

User-added image

Any ideas what I'm doing wrong? Is showing that I don't have changes on my scratch org when I do ...
Thanks for your help!
Any recommendations for an online "Salesforce DX training course"
Thanks
I had a visualforce page and I want to take off a label "= Required Information" but I can't see where is at?? below web form and code

User-added image

 
<apex:page standardController="Lead" extensions="myWeb2LeadExtensionA" title="Contact Us" showHeader="false" standardStylesheets="false">
  <apex:define name="body">
    <apex:pageBlock title="" mode="edit">
    
        <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'></link>
    
<style type="text/css">

    body { 
        width: 100%; 
        height: auto; 
        margin: 0px; 
        padding: 0px;
        background-color: #ffffff; 
        }
    
    #HEheader {
        margin: auto;
        width: 100%;
        height: 43px;
        background-color: #000;
        }
        
    #centered {
        margin: auto;
        width: 1024px;
        height: auto;
        background-color: #ffffff;
        overflow-y: auto;
        }

    #HEhead {
        margin: auto;
        width: 999px;
        height: 31px;
        padding-top: 12px;
        padding-left: 25px;
        }

    #EPheader {
        margin: auto;
        width: 999px;
        height: 70px;
        padding-top: 12px;
        padding-left: 25px;
        }
    #pageTitle {
        padding-left: 25px;
        width: 875px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:30px;
        font-weight:bold;
        color: #00728f;
        }
     #pageDesc {
        margin: 10px 0px 0px 0px;
        padding-left: 25px;
        width: 860px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:24px;
        font-weight:Normal;
        color: #333;
        }
    #pageBody{
        float: left;
        margin: 0px 25px 50px 25px;
        width: 390px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:18px;
        font-weight:Normal;
        color: #000;
        }
    #picture {
        float: left;
        margin: 15px 10px 0px 10px;
        }
    #FormCon  {
        float: left;
        width: 275px;
        }
    #EPformHead {
        height: 60px;
        }
    #EPform {
        padding: 15px;
        width: 500px;
        background-color: #fff;
        font-family:Verdana, Geneva, sans-serif;
        font-size:16px;
        text-align:left;
        }

</style>

    
   

      <script type="text/javascript">
      window.onload=function() {
          var queryDict = {}
          var cid = '';
          location.search.substr(1).split("&").forEach(function(item) {queryDict[item.split("=")[0]] = item.split("=")[1]})
          if(typeof queryDict['cid'] != 'undefined') {
            cid = queryDict['cid'];
          }
          
          var pageTitle = '';
          var pageDesc = '';
          var pageBody = '';
          var imgSrc = '';
          var videoSrc = ''; 
          switch(cid) {
          
              
             
 default:
              cid = ''; // Protect against injection
              pageBody = '<p style="color:red; font-weight:bold;">Missing or incorrect whitepaper.</p>';
              document.getElementById('contact-form').style.display = 'none';
videoSrc = '';
              break;
          }

          
          document.getElementById('pageTitle').innerHTML = pageTitle;
          document.getElementById('pageDesc').innerHTML = pageDesc;
          document.getElementById('pageBody').innerHTML = pageBody;
          document.getElementById('theImage').setAttribute('src', imgSrc);
          
          
          if(cid != '') {
            document.getElementsByTagName('form')[0].action += '?cid=' + cid;
          }
      }
      </script>

        

      <div id="centered">
          
        
        <div id="FormCon" align="center">
               
                <div id="EPform">
                 <apex:form >
                          <apex:messages id="error" styleClass="errorMsg" layout="table" style="margin-top:1em; color:red;"/>
                          <apex:pageBlockSection title="Sign Up For These Trials:" collapsible="false" columns="2">

                  <apex:pageBlockSectionItem >
                      <apex:inputCheckbox value="{!Lead.AD_Watch__c}"/><apex:outputText >A-D Watch</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Midstream_Monitor__c}"/><apex:outputText >Midstream Monitor</apex:outputText>
                  </apex:pageBlockSectionItem>        
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor__c}"/><apex:outputText >Oil and Gas Investor</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                  <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor_Australia_Website__c}" label="Oil and Gas Investor Australia"/><apex:outputText >Oil and Gas Investor Australia</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                  <apex:inputCheckbox value="{!Lead.Midstream_Business_Trial__c}" label="Midstream Business"/><apex:outputText >Midstream Business</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor_This_Week__c}"/><apex:outputText >Oil and Gas Investor This Week</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Downstream_Business_Trial__c}" label="Downstream Business"/><apex:outputText >Downstream Business</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Subsea_Engineering_News__c}"/><apex:outputText >Subsea Engineering News</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Gulf_States_Petroleum_Directory__c}"/><apex:outputText >Gulf States Petroleum Directory</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Unconventional_Oil_and_Gas_Center__c}" label="Unconventional Oil & Gas Center"/><apex:outputText >Unconventional Oil and Gas Center</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.North_American_Petroleum_Directory__c}"/><apex:outputText >North American Petroleum Directory</apex:outputText>
                  </apex:pageBlockSectionItem>        
                 <p><br></br></p>


                  
              </apex:pageBlockSection>
                          <apex:pageBlockSection title="" collapsible="false" columns="1">
                  
                  <apex:inputField required="true" value="{!Lead.FirstName}"/>
                  <apex:inputField required="true" value="{!Lead.LastName}"/>
                  <apex:inputField required="true" value="{!Lead.Email}"/>
                  <apex:inputField required="true" value="{!Lead.Phone}"/>
                  <apex:inputField required="true" value="{!Lead.Company}" label="Company"/>
                  <apex:inputField required="true" value="{!Lead.Title}"/>
                  <apex:inputField required="true" value="{!Lead.CountryDropDown__c}"/>
                  <apex:inputField required="true" value="{!Lead.Street}"/>
                  <apex:inputField required="true" value="{!Lead.City}"/>
                  <apex:inputField required="false" value="{!Lead.State_ProvinceDropdown__c}"/>
                  <apex:inputField required="false" value="{!Lead.PostalCode}" label="Postal Code"/>
                  <br></br>
                  
                  
                  <p>* Required Information<br></br><br></br>We encourage you not to enter an AOL, Hotmail, or other free email account. These types of accounts may block the mail that we send to you. </p>
                  <apex:commandButton value="Submit" action="{!saveLead}"/>
                  <apex:commandButton value="Clear Form" onclick="this.form.reset();return false;" />
              </apex:pageBlockSection>
            </apex:form>
                
                
                </div>
        </div>
      </div>
    </apex:pageBlock>
  </apex:define>
</apex:page>

 
Is there a way to change the position of the checkbox from the end of my field name to the beginning of the field name? below what I want to achieve...

User-added image
Can you share a code/controller to create a pop-up window for Account address infromation?

Street
City
State/Province
Zip/Postal Code
Country
Can you share a code/controller to create a pop-up window with Account address information (Street, City, State/Province, Zip/Postal code, Country)?
Hi,
I'm new in VFP can you send me a simple Custom Controller code and VFP code so i can send an email to a email address?
The user will enter the email address on the VFP.
Thanks!

I`m  creating a visualforce page and want to know how i use SAVE action in the controller code?
The code in VFP is:

 <apex:page controller="EAccount">
 <apex:form >
      <apex:pageBlock title="NEW Email Account">
     <apex:pageblockButtons location="Bottom" >
      <apex:commandButton action="{!Save}" value="Create Account" />
   </apex:pageblockButtons>   
    <apex:pageBlockSection columns="1" title="Enter Information">
     <apex:inputField value="{!ema.First_Name__c}"/> 
     <apex:inputField value="{!ema.Last_Name__c}"/>
     <apex:inputField value="{!ema.Username__c}"/> 
     <apex:inputSecret value="{!ema.Password__c}" label="Password"/>
     <apex:inputField value="{!ema.Mobile__c}"/>
     <apex:inputField value="{!ema.Birthday__c}"/>
     <apex:inputField value="{!ema.Male__c}" label="Male"/>
     <apex:inputField value="{!ema.Female__c}" label="Female"/>            
    </apex:pageBlockSection>
   </apex:pageBlock>
 </apex:form>
</apex:page> 

Controller Class

public class EAccount {

    public static void LoginPage(){
                           
    }
    public Email_Account__c ema{get; set;}
    public String EmailAccount { get; set; }
           
    public PageReference Save() {
     return null;    
      PageReference LoginPage = Page.MyLoginPage;
       LoginPage.setRedirect(true); 
        return LoginPage;
       } 
   }

An error occurs an is not saving the records.

Can you give me an idea how to create a button style calculator in visualforce? simple math: + , - , / , * , =
Hi,
How can i create and email account in VFP, login and if i forgot password, send an email to the user with the password info...below my code:

 <apex:page controller="EAccount">
 <apex:form >
  <apex:pageBlock title="NEW Email Account">
   <apex:pageblockButtons >
    <apex:commandButton value="Create Account" action="{!Save}"/>
   </apex:pageblockButtons>
    <apex:pageBlockSection columns="1" title="Enter Information">
     <apex:inputField value"{!Email_Account__c.First_Name__c}"/>
    </apex:pageBlockSection>
   </apex:pageBlock>
 </apex:form>
</apex:page>
Is there a way to change the position of the checkbox from the end of my field name to the beginning of the field name? below what I want to achieve...

User-added image
I'm new to code, can someone help and give me an idea how I can create an entry form as below with Lightning Component?
User-added image
Thanks!
I had a visualforce page and I want to take off a label "= Required Information" but I can't see where is at?? below web form and code

User-added image

 
<apex:page standardController="Lead" extensions="myWeb2LeadExtensionA" title="Contact Us" showHeader="false" standardStylesheets="false">
  <apex:define name="body">
    <apex:pageBlock title="" mode="edit">
    
        <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'></link>
    
<style type="text/css">

    body { 
        width: 100%; 
        height: auto; 
        margin: 0px; 
        padding: 0px;
        background-color: #ffffff; 
        }
    
    #HEheader {
        margin: auto;
        width: 100%;
        height: 43px;
        background-color: #000;
        }
        
    #centered {
        margin: auto;
        width: 1024px;
        height: auto;
        background-color: #ffffff;
        overflow-y: auto;
        }

    #HEhead {
        margin: auto;
        width: 999px;
        height: 31px;
        padding-top: 12px;
        padding-left: 25px;
        }

    #EPheader {
        margin: auto;
        width: 999px;
        height: 70px;
        padding-top: 12px;
        padding-left: 25px;
        }
    #pageTitle {
        padding-left: 25px;
        width: 875px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:30px;
        font-weight:bold;
        color: #00728f;
        }
     #pageDesc {
        margin: 10px 0px 0px 0px;
        padding-left: 25px;
        width: 860px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:24px;
        font-weight:Normal;
        color: #333;
        }
    #pageBody{
        float: left;
        margin: 0px 25px 50px 25px;
        width: 390px;
        font-family:'Open Sans Condensed', sans-serif;
        font-size:18px;
        font-weight:Normal;
        color: #000;
        }
    #picture {
        float: left;
        margin: 15px 10px 0px 10px;
        }
    #FormCon  {
        float: left;
        width: 275px;
        }
    #EPformHead {
        height: 60px;
        }
    #EPform {
        padding: 15px;
        width: 500px;
        background-color: #fff;
        font-family:Verdana, Geneva, sans-serif;
        font-size:16px;
        text-align:left;
        }

</style>

    
   

      <script type="text/javascript">
      window.onload=function() {
          var queryDict = {}
          var cid = '';
          location.search.substr(1).split("&").forEach(function(item) {queryDict[item.split("=")[0]] = item.split("=")[1]})
          if(typeof queryDict['cid'] != 'undefined') {
            cid = queryDict['cid'];
          }
          
          var pageTitle = '';
          var pageDesc = '';
          var pageBody = '';
          var imgSrc = '';
          var videoSrc = ''; 
          switch(cid) {
          
              
             
 default:
              cid = ''; // Protect against injection
              pageBody = '<p style="color:red; font-weight:bold;">Missing or incorrect whitepaper.</p>';
              document.getElementById('contact-form').style.display = 'none';
videoSrc = '';
              break;
          }

          
          document.getElementById('pageTitle').innerHTML = pageTitle;
          document.getElementById('pageDesc').innerHTML = pageDesc;
          document.getElementById('pageBody').innerHTML = pageBody;
          document.getElementById('theImage').setAttribute('src', imgSrc);
          
          
          if(cid != '') {
            document.getElementsByTagName('form')[0].action += '?cid=' + cid;
          }
      }
      </script>

        

      <div id="centered">
          
        
        <div id="FormCon" align="center">
               
                <div id="EPform">
                 <apex:form >
                          <apex:messages id="error" styleClass="errorMsg" layout="table" style="margin-top:1em; color:red;"/>
                          <apex:pageBlockSection title="Sign Up For These Trials:" collapsible="false" columns="2">

                  <apex:pageBlockSectionItem >
                      <apex:inputCheckbox value="{!Lead.AD_Watch__c}"/><apex:outputText >A-D Watch</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Midstream_Monitor__c}"/><apex:outputText >Midstream Monitor</apex:outputText>
                  </apex:pageBlockSectionItem>        
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor__c}"/><apex:outputText >Oil and Gas Investor</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                  <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor_Australia_Website__c}" label="Oil and Gas Investor Australia"/><apex:outputText >Oil and Gas Investor Australia</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                  <apex:inputCheckbox value="{!Lead.Midstream_Business_Trial__c}" label="Midstream Business"/><apex:outputText >Midstream Business</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Oil_and_Gas_Investor_This_Week__c}"/><apex:outputText >Oil and Gas Investor This Week</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Downstream_Business_Trial__c}" label="Downstream Business"/><apex:outputText >Downstream Business</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Subsea_Engineering_News__c}"/><apex:outputText >Subsea Engineering News</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Gulf_States_Petroleum_Directory__c}"/><apex:outputText >Gulf States Petroleum Directory</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.Unconventional_Oil_and_Gas_Center__c}" label="Unconventional Oil & Gas Center"/><apex:outputText >Unconventional Oil and Gas Center</apex:outputText>
                  </apex:pageBlockSectionItem>
                  <apex:pageBlockSectionItem >
                          <apex:inputCheckbox value="{!Lead.North_American_Petroleum_Directory__c}"/><apex:outputText >North American Petroleum Directory</apex:outputText>
                  </apex:pageBlockSectionItem>        
                 <p><br></br></p>


                  
              </apex:pageBlockSection>
                          <apex:pageBlockSection title="" collapsible="false" columns="1">
                  
                  <apex:inputField required="true" value="{!Lead.FirstName}"/>
                  <apex:inputField required="true" value="{!Lead.LastName}"/>
                  <apex:inputField required="true" value="{!Lead.Email}"/>
                  <apex:inputField required="true" value="{!Lead.Phone}"/>
                  <apex:inputField required="true" value="{!Lead.Company}" label="Company"/>
                  <apex:inputField required="true" value="{!Lead.Title}"/>
                  <apex:inputField required="true" value="{!Lead.CountryDropDown__c}"/>
                  <apex:inputField required="true" value="{!Lead.Street}"/>
                  <apex:inputField required="true" value="{!Lead.City}"/>
                  <apex:inputField required="false" value="{!Lead.State_ProvinceDropdown__c}"/>
                  <apex:inputField required="false" value="{!Lead.PostalCode}" label="Postal Code"/>
                  <br></br>
                  
                  
                  <p>* Required Information<br></br><br></br>We encourage you not to enter an AOL, Hotmail, or other free email account. These types of accounts may block the mail that we send to you. </p>
                  <apex:commandButton value="Submit" action="{!saveLead}"/>
                  <apex:commandButton value="Clear Form" onclick="this.form.reset();return false;" />
              </apex:pageBlockSection>
            </apex:form>
                
                
                </div>
        </div>
      </div>
    </apex:pageBlock>
  </apex:define>
</apex:page>

 
Is there a way to change the position of the checkbox from the end of my field name to the beginning of the field name? below what I want to achieve...

User-added image
Hi,
I'm new in VFP can you send me a simple Custom Controller code and VFP code so i can send an email to a email address?
The user will enter the email address on the VFP.
Thanks!
Can you give me an idea how to create a button style calculator in visualforce? simple math: + , - , / , * , =