• bob_buzzard
  • ALL STAR
  • 38691 Points
  • Member since 2009
  • CTO
  • BrightGen


Badges

  • Chatter
    Feed
  • 1360
    Best Answers
  • 9
    Likes Received
  • 2
    Likes Given
  • 11
    Questions
  • 8486
    Replies
Hi,
I'm new to the SF Apex triggers, and I am following this manual (https://help.salesforce.com/articleView?id=entitlements_milestones_trigger.htm&type=5) to enable Auto-Complete Case Milestones.
I managed to add create the first two Apex classes and the first Apex case trigger (Sample Trigger 1), but when I try to insert the third code (Sample Trigger 2, embedded below), I get the following error:
Error: Compile Error: Incorrect SObject type: EmailMessage should be Case at line -1 column -1

I tried looking online for a solution, but could'nt find any.
Does anyone have an idea how to solve this issue?
Thanks!
 
trigger CompleteFirstResponseEmail on EmailMessage (after insert) {
    if (UserInfo.getUserType() == 'Standard'){
        DateTime completionDate = System.now();
        Map<Id, String> emIds = new Map<Id, String>();
        for (EmailMessage em : Trigger.new){
            if(em.Incoming == false)
                emIds.put(em.ParentId, em.ToAddress);
        }
        if (emIds.isEmpty() == false){
            Set <Id> emCaseIds = new Set<Id>();
            emCaseIds = emIds.keySet();
                List<Case> caseList = [Select c.Id, c.ContactId, c.Contact.Email,
                    c.OwnerId, c.Status,
                    c.EntitlementId,
                    c.SlaStartDate, c.SlaExitDate
                    From Case c where c.Id IN :emCaseIds];
            if (caseList.isEmpty()==false){
                    List<Id> updateCases = new List<Id>();
                    for (Case caseObj:caseList) {
                        if ((emIds.get(caseObj.Id)==caseObj.Contact.Email)&&
                            (caseObj.Status == 'In Progress')&&
                            (caseObj.EntitlementId != null)&&
                            (caseObj.SlaStartDate <= completionDate)&&
                            (caseObj.SlaStartDate != null)&&
                            (caseObj.SlaExitDate == null))
                                updateCases.add(caseObj.Id);
                    }
                    if(updateCases.isEmpty() == false)
                        milestoneUtils.completeMilestone(updateCases, 
                                'First Response', completionDate);
            }
        }
    }        
}

 
Hi Everyone,

I have just completed the Create Global Quick Actions unit within Trailhead and I have noticed that when I created global action within Salesforce it took a good while for them to show within the Salesforce App even after I pulled down to refresh within the Navigation pane.  There was also a lag in them showing within the Global Actions Menu within Salesforce.

Is there some kind of lag?

Charlene
Following code helps me to convert my RichText Images to Public URL by saving in Document Object

Trigger:
 
trigger CaseComment on case (After insert, After update)
{

list<case > caselist = trigger.new;
    for(case cse:caselist)
    {

     if(cse.Steps_to_Reproduce__c .contains('/rtaImage'))
        {
            system.debug('cse[0].Steps_to_Reproduce__c '+cse.Steps_to_Reproduce__c);
            batchNotesInsert shn = new batchNotesInsert(cse.Id);
            database.executeBatch(shn);
        }     
    }
}

Batch:
 
global class batchNotesInsert implements Database.Batchable<sObject>,Database.AllowsCallouts, Database.Stateful
{

    private String strParameter;


    public batchNotesInsert(String strParam) {
        strParameter = strParam;
    }

    global Database.QueryLocator start(Database.BatchableContext BC) 
    {
        String query = 'select id from case where Id = :strParameter';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<case> scope) 
    {
        String imgTagPattern;
        List<Case> cas = new List<Case>();
        cas = [Select Id,Steps_to_Reproduce__c from Case where Id = :strParameter];                
        imgTagPattern = cas[0].Steps_to_Reproduce__c;

            List<String> parts = imgTagPattern.split('<img');
            String mystring = '';

            for (string imgvar : parts) 
            {   
                if(String.isBlank(imgvar))
                {

                }
                else
                {                    
                    String imageURL = imgvar.substringBetween('src="', '"');
                    String FinalUrl =imageURL.remove('amp;');
                    String fullFileURL='';

                    if(FinalUrl.contains('/rtaImage'))
                    {

                    list<Document> lstDocuments = new list<Document>();
                    PageReference pageRef = new PageReference(FinalUrl);
                    Document docvar = New Document();
                    docvar.FOLDERID = [select id from folder where name = 'TFS'].id;
                    docvar.type = 'jpg';
                    docvar.body = pageRef.getContent();
                    docvar.Name = 'TFS Inline Image';
                    docvar.IsPublic = true;

                    Insert docvar;

                    fullFileURL =+URL.getSalesforceBaseUrl().toExternalForm() + '/servlet/servlet.ImageServer?id=' + docvar.id + '&oid=' + UserInfo.getOrganizationId() ;                    

                    }                                 
                    else
                    {
                        fullFileURL  = FinalUrl;
                    }                    

                    if(!String.isBlank(imageURL))
                    {
                        mystring =imgTagPattern.replace(imageURL , fullFileURL);
                        imgTagPattern = mystring;                        
                        cas[0].Steps_to_Reproduce__c = mystring ;
                    }

                }
            }

        Update cas[0];
    }

    global void finish(Database.BatchableContext BC) {
    }
}

Small size images are working perfect by larger size images fails.


ANY HELP WILL BE APPRECIATED !​
And I'm doing the 'Personalize your chatter experience' badge. The option to toggle between classic and lightning is requried for this badge but not available. help!
The following outbound change set upload failed due to a system error:
 
Change set: DNA Tech Support test (04t0k0000000wgT)
Organization: NA (Developer Sandbox) (00D0k0000000RYj)
User: NA Admin (00528000000SCfN)
Error Number: 1617908545-19233 (245827274)
 
Please try to upload your change set again. If it does not succeed, contact Customer Support and provide the error number listed above.
 
I am trying this below code to view all the attachments in a single window as pdf, but i am unable to do it. Here i am using iframe.But it is not showing in a single
Is there any solution or workaround where i am view all the attachments in a single window as pdf.
 
public class AttachmentClass{
public string attachmentid {get; set;}
    public List<Attachment> atch {get; set;}
public AttachmentClass(){
    atch = new List<Attachment>();

    atch = [select Id from Attachment];
    For(Attachment a:atch){

       attachmentid=a.Id; 
    }
  //attachmentid='00P9000001HdVtc';
}
}
 
<apex:repeat value="{!atch}" var="a">
    <iframe src="{!URLFOR($Action.Attachment.Download, a.Id)}"/>
</apex:page>

 
This was my debug list of SOQL 
Number of SOQL queries: 38 out of 100
  Number of query rows: 73 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 184 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10


Stil I am getting Time out error.
(I had cleared all cache in vf page)
 
I have created one visualforce page for Inserting Accounts with Attachments.
I have used Wrapper class for insering accounts and Attachments.
while insertion the two Accounts has been inserted with same file attachments.
Below is my visualforce page.Here the second attachment(lighthouse) gets inserted for the both Accounts( Test Account and Test Account1 ) also.
Kindly provide solution for this.

User-added image
 
Hi Expert,

Now i am displaying selected records to Pageblock2 . Though selected records are don't need to show in PageBlock1. kindly Check the below Image For information.

**************** Apex *******************
 
public class OppDisplaySelectedContrl {

    public List<oppWrapper> listOppWrap{get;set;}
    Public List<Opportunity> listOfSelectedOpp{get;set;}
    Public List<Opportunity> listOfSelectedOpp2{get;set;}
    Set<Integer> st = New Set<Integer>();
    
    
    public OppDisplaySelectedContrl(){
        listoppWrap = new List<oppWrapper>();
        searchrecord();
    }
    
    public void searchrecord(){
        listOppWrap.clear();
        for(Opportunity opp : [Select id,name,stageName,amount, CloseDate From Opportunity Limit 5]){
            listOppWrap.add(New OppWrapper(opp));
             System.debug('Opportunity list' + opp );
        }
       
    }
    
    public void addToGrid(){
        listOfSelectedOpp = New List<Opportunity>();
        listOfSelectedOpp.clear();
        for(OppWrapper  OppWrapObj : listOppWrap){
            if(OppWrapObj.selected == True){
                listOfSelectedOpp.add(OppWrapObj.wrapOpp);
       
            }
        }
        
       
        
    }
    
    public void closedWon(){
        
        for(Opportunity opp : listOfSelectedOpp){
            opp.StageName = 'Closed Won';
        }
        update listOfSelectedOpp;
        searchrecord();
    }
    
    public void closedLost(){
        for(Opportunity opp : listOfSelectedOpp){
            opp.StageName = 'Closed Lost';
        }
        
        update listOfSelectedOpp;
        searchrecord();
    }
    
    public class OppWrapper{
        public boolean selected{get;set;}
        public Opportunity wrapOpp{get;set;}
        public OppWrapper(Opportunity opp){
            selected = false;
            wrapOpp = opp;
        }
    }
}

*********************VF Page ***********************
 
<apex:page controller="OppDisplaySelectedContrl">
    <apex:form >
       <apex:pageBlock title="Opportunity" id="pb1">
          <apex:pageBlockSection title="All Opportunity" columns="1">
             <apex:pageBlockTable value="{!listOppWrap}" var="oppWrap" >
                 <apex:column >
                 <!--<apex:inputCheckbox value="Select"/> -->
                 </apex:column>
                 <apex:column headerValue="Select">
                 	<apex:inputCheckbox value="{!oppWrap.selected}"  />
                 </apex:column>
                 <apex:column value="{!oppWrap.wrapOpp.name}"/>
                 <apex:column value="{!oppWrap.wrapOpp.StageName}"/>
                 <apex:column value="{!oppWrap.wrapOpp.closeDate}"/>
                 <apex:column value="{!oppWrap.wrapOpp.amount}"/> 
              </apex:pageBlockTable>
           </apex:pageBlockSection> 
           
              <apex:pageBlockButtons >
                 <apex:commandButton value="Add To Grid" action="{!addToGrid}"/>
              </apex:pageBlockButtons>
        </apex:pageBlock>
        
        <apex:pageBlock title="Selected opportunity" id="pb2">
            <apex:pageBlockSection columns="1">
              <apex:pageBlockTable value="{!listOfSelectedOpp}" var="selectedOpp" >
                  <apex:column value="{!selectedOpp.name}" headerValue="Opportunity Name"/>
                  <apex:column value="{!selectedOpp.StageName}" headerValue="Stage"/>
                  <apex:column value="{!selectedOpp.closeDate}" headerValue="Closed Date"/>
                  <apex:column value="{!selectedOpp.Amount}" headerValue="Amount"/>

                  
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockButtons >
              <apex:commandButton value="Closed Won" action="{!closedWon}"/>
                <apex:commandButton value="Closed Lost" action="{!closedLost}" />
           </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

**********Sample output ***********

User-added image


Special Thanks In Advance !!!!


Regards, 

Soundar 
Hello,

I am fairly junior to Apex and I am tgrying to build a random number.  I found this Apex code online and saved it successfully in my Sandbox.  
public with sharing class RandomNumberGenerator {
    public static String generateRandomNumber() {
        String randomNumber = generate();
        if (randomNumber.length() < 6) {
            String randomNumber2 = generate();
            randomNumber = randomNumber + randomNumber2.substring(0, 10 - randomNumber.length());
        }
        return randomNumber;
    }
    public static String generateIdentifier(String prefix) {
        return prefix + '-' + generateRandomNumber();
    }
    private static String generate() {
        return String.valueOf(Math.abs(Crypto.getRandomInteger()));
    }
}
I have a number field labeled BIOS_Password__c on the asset object.  How do I get this Apex class to populate this field on creation of the asset?  Any help is much appreciated.

Thanks,

Aaron
 
Hi All,

I am looking for an Apex code which can get me a list of all current logged In users.

Let me know if this is feasible.

Thanks
Sharan Desai
+91 966 33 11 740
I have this method
 
public PageReference selectBandwidth() {

    if (!BandwidthQualified
        || prequalToSave == null
        || servicesToAdd == null
        || (prequalToSave != null && prequalToSave.IsComplete__c && servicesToAdd.size() == 0))
    {
        return Page.PBXOrderingQuotePdf;
    }


    Decimal bandServicesSel = 0;

    if (servicesToAdd != null)
    {
        for (Service__c service : servicesToAdd)
        {
            if (service.IsSelected__c)
                bandServicesSel += 1;
        }
    }

        showPageMessage = false;
        pageMessage = '';

    if (!String.isBlank(qotId)) { 
        qot = [select Id, Pricebook2Id, Name from Quote where Id = :qotId];

    }
    else if (!isVoiceBeingAdded)
    {
        if (qot.Name == null)
            qot.Name = 'No Name';
        qot.BillingCity = city;
        qot.BillingState = state ;
        qot.BillingPostalCode = zip ;

        qot.BillingStreet = addressLine1 + ' ' + unitType + ' ' + unitValue ;
        qot.ShippingCity =  account.ShippingCity; 
        qot.ShippingCountry = account.ShippingCountry;
        qot.ShippingStreet = account.ShippingStreet;
        qot.ShippingState = account.ShippingState;
        qot.ShippingPostalCode = account.ShippingPostalCode;


        insert qot;
        url = '/apex/QuotePDF?id=' + qot.Id;
    }

    List<PricebookEntry> products = [Select Id, ProductCode , IsActive, Product2Id, UnitPrice, Name from PricebookEntry where Pricebook2Id =: qot.Pricebook2Id];

    if (servicesToAdd != null)
    {
        System.debug('I am inside the Service and service has been added 1');
        for (Service__c service : servicesToAdd)
        {
             System.debug('I am inside the Service and service has been added 2' + servicesToAdd );
            if (service.IsSelected__c)
            {
                 System.debug('I am inside the Service and service has been added 3 service.IsSelected__c' );

                for (PricebookEntry entry : products)
                {
                    System.debug('entry.ProductCode Counter' + entry.ProductCode);
                    if (entry.ProductCode == 'internetAccessWizard')

                    {



                        QuoteLineItem quoteLineItem = new QuoteLineItem();
                        quoteLineItem.QuoteId = qot.Id;
                        quoteLineItem.PricebookEntryId = entry.Id;
                        quoteLineItem.Product2Id = entry.Product2Id;
                        quoteLineItem.Quantity = 1;
                        quoteLineItem.UnitPrice = service.Price__c;
                                                   quoteLineItem.Enter_Activation__c = service.SetupPrice__c;
                        quoteLineItem.Activation_Fee_CheckBox__c = true;
                        quoteLineItem.Term_Area__c = service.ContractLength__c;
                        System.debug(' Contract Term ' +  quoteLineItem.Term_Area__c );



                        if(service.SubType__c.contains('test')){
                            quoteLineItem.Internet_Service_Fee__c = 2.88;
                            quoteLineItem.Internet_Service_Fee_CheckBox__c = true;
                        }
                        else{

                            quoteLineItem.It_HAS_FSLS_checkBox__c = true;


                        }



                        insert quoteLineItem;

                    }
                }



                bandServicesSel += 1;
            }
        }
    }


   return Page.PBXOrderingQuotePdf;
}
Unit Test
 
static testmethod void selectBandwidth_Test(){
     OpportunityController controller = new OpportunityController();
     controller.BandwidthQualified = false;

    Product2 prod = new Product2();
    prod.Name = 'Laptop X200'; 
    prod.IsActive = true;
    prod.ProductCode  = 'Feature';

    insert prod;

        id customPB = Test.getStandardPricebookId();

    Opportunity opp = new Opportunity();
    opp.Name = 'Test';
    opp.StageName='Quote Sent';
    opp.CloseDate = system.today();
    opp.Pricebook2Id = customPB;
    insert opp;

    Quote quote = new Quote();
    quote.Name='test';
    quote.Opportunityid = opp.id;     
    quote.ExpirationDate = date.today()+30;        
    quote.Pricebook2Id = customPB;

    //insert quote;

    controller.isVoiceBeingAdded = false;






    PricebookEntry customPrice = new PricebookEntry(
        Pricebook2Id = customPB, Product2Id = prod.Id,
        UnitPrice = 12000, IsActive = true);

    insert customPrice;

    controller.qot = quote;
     controller.selectBandwidth();
 }


I am not sure what else to add
Hi!
Can i reRender the operation into a Field? Like this

<strong>$</strong> <apex:outputText value="{0, number, ####,###.00}">
<apex:param value="{!total + total*Cotizaci_n__c.Porcentaje_de_utilidad__c/100}"/>
               <apex:actionSupport reRender="{!Cotizaci_n__c.Gran_Total__c}"/> 
            </apex:outputText>
I have the problem that my editable table does not update when I hit the "save" button. I tried inline editing and normal editing, nothing would save. Although I referred to a standard controller, I prefer the solution with a custom controller.
 
<apex:page standardController="Dev_Request__c" extensions="tableDevRequest_edit">
    <apex:form >
        <apex:pageblock mode="inlineEdit"> 
            <apex:pageMessages />  
            <apex:pageBlockButtons > 
            <!--<apex:commandButton value="Save" action="{!saveTable}" id="saveButton" rendered="{!editTable==true}" immediate="true"/>-->
            <apex:commandButton value="Save" action="{!saveTable}" id="saveButton" immediate="true"/>
            <apex:commandButton id="cancelButton" value="Cancel"/> 
            </apex:pageBlockButtons>  

             <apex:pageblocktable value="{!lstDevRequest_edit}"  var="item">
                    <apex:column headerValue="Dev Request Name"><apex:actionRegion ><apex:outputField value="{!item.Name}"><apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" /></apex:outputField></apex:actionRegion></apex:column>
                    <apex:column headerValue="Id"><apex:outputField value="{!item.Id}"/></apex:column>
                    <apex:column headerValue="Status"><apex:inputField value="{!item.Status__c}"/></apex:column>
                    <apex:column headerValue="Start Date"><apex:inputField value="{!item.Start_Date__c}"/></apex:column>
                    <apex:column headerValue="Due Date QA"><apex:inputField value="{!item.Due_Date_QA__c}"/></apex:column>
                    <apex:column headerValue="Estimated Hours"><apex:inputField value="{!item.Estimated_Hours__c}"/></apex:column>
                    <apex:column headerValue="Assignee"><apex:inputField value="{!item.Assignee__c}"/></apex:column>
                    <apex:column headerValue="Overview"><apex:inputField value="{!item.Overview__c}"/></apex:column>
             </apex:pageblocktable>

        </apex:pageblock>
    </apex:form>
 
public with sharing class tableDevRequest_edit {

   public List<Dev_Request__c> lstDevRequest_edit {get;set;}

    public tableDevRequest_edit(ApexPages.StandardController controller) {
        lstDevRequest_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c from Dev_Request__c];
    }

    public PageReference saveTable() {
        try {
            update lstDevRequest_edit;
        }   
        catch(Exception e){
            System.debug('Exception occurred '+String.valueOf(e));
        }
        return NULL;
    }     
}

Thank you for helping!
Hello all,
I have implemented a custom Javascript button called "Send Email" under Activity history. When a user clicks this button a new popup window should open that enables the user to send an e-mail. The JS code also displays the default from address, to address and template for the user. The new requirement is that after the user clicks the "Send" button, the popup window should auto-close. Find the code used to open the pop-up window below.

[window.open("/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&p2_lkid={!Case.ContactId}&p26=xxx@xxx.com&template_id=xxxxxxxxxxxxxx&retURL=%{!Case.Id}","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, width=800, height=650");
Could someone please suggest on how to auto-close this pop-up window?


 
Dear All,

I'm trying to pass UTM Parameters into hidden fields in my VF page. I'm not able to populate these fields at all. Could someone help out?

Visualforce Page:
 
<apex:page standardController="contact" extensions="FormController" showHeader="false" sidebar="false" standardStylesheets="false" > 
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-90589553-1', 'auto');
  ga('send', 'pageview');

</script>

 <script type="text/javascript">
// Parse the URL
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Give the URL parameters variable names
var source = getParameterByName('utm_source');
var medium = getParameterByName('utm_medium');
var campaign = getParameterByName('utm_campaign');

// Put the variable names into the hidden fields in the form.
document.getElementsById("txt_source").value = source;
document.getElementsById("txt_medium").value = medium;
document.getElementsById("txt_campaign").value = campaign;

</script>

<script type="text/javascript">
//allows number and hyphen only 
function inputLimiter(e,allow) {
            var AllowableCharacters = '';

            if (allow == 'Letters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';}
            if (allow == 'Numbers'){AllowableCharacters='1234567890';}
            if (allow == 'NameCharacters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.\'';}
            if (allow == 'NameCharactersAndNumbers'){AllowableCharacters='1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-\'';}
            if (allow == 'Currency'){AllowableCharacters='1234567890.';}

            var k = document.all?parseInt(e.keyCode): parseInt(e.which);
            if (k!=13 && k!=8 && k!=0){
                if ((e.ctrlKey==false) && (e.altKey==false)) {
                return (AllowableCharacters.indexOf(String.fromCharCode(k))!=-1);
                } else {
                return true;
                }
            } else {
                return true;
            }
        } 
</script>



 <apex:form style="background-color:white">
 <a class="button" href="http://www.omniyat.com/project/thesterling/" target="_blank" style="background-color:black;font-weight:normal; size:14pt font-family:Verdana;">LEARN MORE</a>
  <div class="header">
   
 <a href = "http://www.omniyat.com/project/thesterling/" target="_blank"><img src = "https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000EjgQ&oid=00D7E0000000gNx&lastMod=1484130597000" align="left" />
 </a>
 
 </div>
 </apex:form>

 <br/>
 <br/>
 <br/>
 <br/>
 <br/>

 <apex:form style="background-image: url('https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000EjwE&oid=00D7E0000000gNx&lastMod=1484176938000');background-size:cover ">

 <body>
 
<br/>

  <div align = "right" Style="margin-right: 5cm;font-family:Verdana;font-size:16pt;">REGISTER FOR MORE INFO</div>
 <div align = "right" Style="margin-right: 4cm;">
<apex:panelGrid columns="1" > 
 
 <apex:inputfield styleclass="in" value="{!con.FirstName}"  html-placeholder="&nbsp;First Name&#8727;" style="width: 360px; height: 40px" /> 
 <apex:outputText value="{!inputTextErrorMessage}" rendered="{!IF(con.FirstName = '', true, false)}" style="color:red"/>
 <br/>
 <apex:inputField styleclass="in" value="{!con.LastName__c}" html-placeholder="&nbsp;Last Name&#8727;" style="width: 360px; height: 40px" /> 
  <apex:outputText value="{!inputTextErrorMessage2}" rendered="{!IF(con.LastName__c = '', true, false)}" style="color:red"/><br/>
 </apex:panelGrid>

  <apex:panelGrid columns="2" > 
  <apex:inputField styleclass="in" value="{!con.Country_Code__c}" style="width: 120px; height: 40px" />
  
 
 <apex:inputField styleclass="in" value="{!con.ContactPhone__c}" onkeypress="return inputLimiter(event,'Numbers');" id="Phone" html-placeholder="&nbsp;Mobile Number&#8727;" style="width: 235px; height: 40px" />
 </apex:panelGrid>
 <apex:outputText value="{!inputTextErrorMessage4}" rendered="{!IF(OR(con.ContactPhone__c = null,con.Country_Code__c = 'CountryCode*'), true, false)}"  style="color:red"/><br/>
 <apex:panelGrid columns="1" > 
 <apex:inputField styleclass="in" value="{!con.email}" html-placeholder="&nbsp;Email Address&#8727;" style="width: 360px; height: 40px" /> 
 <apex:outputText value="{!inputTextErrorMessage5}" rendered="{!IF(con.email = '', true, false)}" style="color:red"/><br/>
 <apex:inputField styleclass="in" value="{!con.Nationality__c}" html-placeholder="&nbsp;Nationality&#8727;" style="width: 364px; height: 40px"/>
 <apex:outputText value="{!inputTextErrorMessage6}" rendered="{!IF(con.Nationality__c = 'Nationality*', true, false)}" style="color:red"/><br/>
 <apex:inputField styleclass="in" value="{!con.Preferred_Time_to_Call__c}" style="width: 364px; height: 40px"/>
 <apex:inputHidden value="{!con.Visitor_ID__c}" />
 <apex:inputHidden value="{!con.Source__c}" id="txt_source" />
 <apex:inputHidden value="{!con.Campaign__c}" id="txt_campaign_name"/>
 <apex:inputHidden value="{!con.Content__c}" id="txt_content" />
  <apex:inputHidden value="{!con.Medium__c}" id="txt_medium" />
 <apex:inputHidden value="{!con.Count_of_Sessions__c}" />
 <apex:inputHidden value="{!con.Count_of_Pageviews__c}"/>


 <br/>
  <div class="g-recaptcha" data-sitekey='6LfhchEUAAAAADq1zE8wGqviN92b2IemvHSEmvuK'></div>
        <script src='https://www.google.com/recaptcha/api.js'></script>
         <apex:outputText value="{!inputTextErrorMessage3}" style="color:red"/>   
        <br/>               
        
 
 </apex:panelGrid> 
 
<span style="color:black;font-size:16pt;margin-right: 3cm;font-weight:bold;font-family:Verdana;">AGENT&nbsp;&nbsp;&nbsp; 
<apex:inputCheckbox value="{!con.Agent__c}" styleClass="myCheckBox" /></span> 
<apex:commandButton style=" margin-right: 1cm;; background:#c00;width:75px;height:30px;color:white;font-size:12pt;" action="{!submit}" value="Submit" /></div>

 <p></p><br/><br/>
 <script src='https://www.google.com/recaptcha/api.js'></script> 
 </body>
 </apex:form> 
 <br/>
 <apex:form >
 <img src="https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000EjvL&oid=00D7E0000000gNx&lastMod=1484163217000" style="width:100%"/>
 </apex:form> 
 <br/>
<center> <h2>Visit Sterling show apartment on level 26, One by Omniyat Tower, Business Bay</h2></center>
  <apex:form >
  <apex:panelGrid columns="3" > 
 <img src="https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000EjvQ&oid=00D7E0000000gNx&lastMod=1484164048000" style="width:33%"/>
 <img src="https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000Ejva&oid=00D7E0000000gNx&lastMod=1484164450000" style="width:33%"/>
 <img src="https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000EjvV&oid=00D7E0000000gNx&lastMod=1484164361000" style="width:33%"/>
 </apex:panelGrid> 
 </apex:form> <br/>
 <apex:form >
 <img src = "https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000Ejvf&oid=00D7E0000000gNx&lastMod=1484167712000"  style="width:100%"/>

 
 </apex:form>
 


 
<center><img src="https://c.cs86.content.force.com/servlet/servlet.ImageServer?id=0157E000000Ei3I&oid=00D7E0000000gNx&lastMod=1484172389000"/>
</center>
<center>
<p3>For further information, contact one of our sales executives or <br/>
call us on 800 666 or email at sales@omniyat.com</p3><br/></center>
<br/>
 
   <script src='https://www.google.com/recaptcha/api.js'></script> 
   <style> 
   h1
   { 
   color:white; 
   font-size:18pt; 
   } 
     h2
   { 
   align:center;
   color:grey; 
   font-size:18pt; 
   }
    h3
   { 
   align:right;
   color:black; 
   font-size:16pt; 
   }
   p
   { 
   color:black; 
   font-size:18pt; 
   }
   p5
   { 
   color:red; 
   font-size:10pt; 
   }
   p3
   { 
   color:black; 
   font-size:14pt; 
    text-align: center;
   }
   .in
   {
   
   font-size:10pt;
   color:white;
   width:82%;
   background-color:black;
   } 
   label
   {
   display: block;
   width: 150px;
   color:#ffffff;
   font-family:"Verdana"
   }
   .button {
    display: block;
    width: 115px;
    height: 25px;
    background: #4E9CAF;
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    color: white;
    font-weight: bold;
     float:right;
}
   input[type=checkbox] 
   { 
   border: 0px;
   width: 2%; 
   height: 2em; 
   background-color: #ffa500; 
   } 
   @-ms-viewport{
  width: device-width;
}

header {
background-color:white;
                               
                           }
 

}
   </style>
   </apex:page>


Thanks,

Avinash

I'm building a flow that is going to call on a tiny bit of Apex where I need it to delete the Email Campaign record once it's greater than 90 days old. I copied and modified from the original apex replacing quotes with my object. I'm getting error messages for illeglal variables around the salesfusion_web_campaign. Anyone spot what I'm doing wrong?

Here's the article I'm using as a guide: https://automationchampion.com/tag/auto-delete-record-using-process-builder/

ORIGINAL APEX>
public class DeleteUnacceptedQuotes
{
    @InvocableMethod
    public static void QuoteDelete(List<Id> OpportunityIds)
    {
        List<Quote> Quotes =[select id from quote
                          where Opportunity.id in :OpportunityIds
                       and Status != 'Accepted'];
        delete Quotes;
   }
}

MY CUSTOM APEX VERSION 1>
public class DeleteEmailCampaigns
{
   @InvocableMethod
   public static void WebCampaignDelete(List<Id> salesfusion__Web_Campaign__c.Ids)
   {
       List<Web_Campaign__c> Web_Campaign__c =[select id from Web_Campaign__c
                         where salesfusion__Web_Campaign__c.id in :salesfusion__Web_Campaign__c.Ids
                      and Days_Since_Creation__c > 90];
       delete Web_Campaign__c;
  }
}

MY CUSTOM APEX VERSION 2>
public class DeleteEmailCampaigns
{
   @InvocableMethod
   public static void WebCampaignDelete(List<Id> salesfusion__Web_Campaign__cIds)
   {
       List<Web_Campaign__c> Web_Campaign__c =[select id from Web_Campaign__c
                         where salesfusion__Web_Campaign__c.id in :salesfusion__Web_Campaign__cIds
                      and Days_Since_Creation__c > 90];
       delete Web_Campaign__c;
  }
}

Hi Everyone!

I am facing the above provided of exception in PROD but not in Sandbox. Initially i thought this might be because of couple of things.

1. Writing Queries inside loop.
2. Record's Data problem.

I thoroughly checked the code and i was not able to see any queries inside the loop.
If i think recurrsion is going on, this has to be done in sandbox also, but the exception is not reproducable in Sandbox.
Could some one help me on this situation, am i missing any thing to crossverify, that will be so great.

Thanks!
Srinivas
 
LIMIT
LIMIT is an optional clause that can be added to a SELECT statement of a SOQL query to specify the maximum number of rows to return.
The syntax for LIMIT is:
view sourceprint?
1SELECT ***fieldList***
2FROM objectType
3[WHERE conditionExpression]
4  [LIMIT numberOfRows]
For example:
view sourceprint?
1SELECT Name
2FROM Account
3WHERE Industry = 'Media' LIMIT 125
This query returns the first 125 Account records whose Industry is Media.
You can use LIMIT with count() as the fieldList to count up to the maximum specified.
You can't use a LIMIT clause in a query that uses an aggregate function, but does not use a GROUP BY clause. For example, the following query is invalid:
view sourceprint?
1SELECT MAX(CreatedDate)
2FROM Account LIMIT 1
hi, i am new in salesforce. I want to know that how we can write triggers in android studio. As i am already done with soql with android studio. Please help me out in this.