• 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
Here is my code, but it does not fire.

apex:page standardController="Opportunity"> <script src="/soap/ajax/10.0/connection.js"> </script > <script src="/soap/ajax/10.0/apex.js"> </script > <body onload="init()"/> <script type="text/javascript"> Function init() { alert("1") } { var p = new sforce.SObject('opportunity'); p.id = document.getElementById; var fulldate = (today.getMonth()+1)+'/'+today.getDate()+'/'+today.getFullYear(); var OppDateRaw = (new Date('{p.CloseDate}')); var formattedOppDate = (OppDateRaw.getMonth()+1) + '/'+OppDateRaw.getDate()+'/'+OppDateRaw.getFullYear(); if( formattedOppDate < fulldate) { alert("Close date cannot be in the past"); } else { if("{p.AMS_Order_Processing_Stage__c}" === "Approved" ) { p.AMS_Order_Processing_Stage__c = "Submitted to Order Processing"; result = sforce.connection.update([p]); location.reload(true); } else { alert("This opportunity has not been approved."); } } } window.history.back() } </script> </apex:page>
I have this following class that i want to deploy but i keep getting this error: List index out of bounds: 1 Trigger.NoteOnContentDocument: line 9, column 1: [] 

Could anyno help please with my code:
trigger NoteOnContentDocument on ContentDocument (before delete) {
    for (ContentDocument c : Trigger.old){          
        List<ContentDocumentLink> links = [
            SELECT LinkedEntityId 
            FROM ContentDocumentLink 
            WHERE ContentDocumentId= :c.Id
        ];
     if(!links.isEmpty()){
        if (Approval.isLocked(links.get(1).LinkedEntityId)){
      c.addError('Approval pending. You do not have the permission to edit/delete this note, please contact your administrator.');
	}  
   }	
  }
}

 

Hi

We've got a VS page which is going to be used on a public Site. It's accessible for the custom object it was created for.

However there is also a lookup to Account object and this is where the issues begin. 

We need the site URL to be able to include Account ID as a part of it (randomUrl.com/randomID) which would be read in as the input for this Account ID lookup field. 

However currently it's not even displaying the page if anything related to Account is added to site's controller extension. It requests authorization, even though Guest User has been given access to Account and Custom Object. 

What is missing? 

public with sharing class myControllerTest 
{
    public Feedback_Form__c feedback {get;set;}
    public Account account {get; set;}
        
    public myControllerTest(ApexPages.StandardController controller) 
    {
    
    Id accountId = apexpages.currentpage().getparameters().get('id');
    account = [SELECT Id, Name FROM Account WHERE Id =: accountId]; 
    
     feedback = new Feedback_Form__c();
     feedback.Account__c = account.Id;
    }
    public void submit() 
    {
        System.Debug('FEEDBACK: ' + feedback);
    }
}
Hello,

I have a web page which i want be visible from salesforce.

How can i acheive it ?
  • January 19, 2017
  • Like
  • 0
I am using the following query to show accountids . How do I modify it to show account name instead? 

SELECT  accountid, Count(id) FROM Contact WHERE Email=null GROUP BY accountid LIMIT 1000
Hi,

FOr now we have hardcoded credentials that are used to connect to an external endpoint. We have to generate a customized body in json so we are unable to use named credentials and any other out of box way so we had to create an apex class. However we are storing the values in the code.

What is the recommended way to store and retrieve the credentials so that they are in a secure location outside of the apex code?
  • January 13, 2017
  • Like
  • 0
Looking for a way to query by change set name to get a listing of all the components contained in an outbound or inbound change set. I cannot find any documentation. Surely something like this exists but I don't know the object name of it these could even be queried. Thank you!
 
Hi,

How can i activate the save button on visualforce page in SF1App with my javascript method?

Is it also possible to change the text on the cancel button? Instead of cancel i would like to call it 'back'.

Regards,

Sergio
Hi everyone 
are there something wrong with "Data Import Wizard" in SalesForce.com, cause we just can import our data with Data Loader, is Data Import Wizard is the weak point of Salesforce?
Best
Alf
Hi,
     I have VF page is accessing the share point website in iFrame. Currently, it is showing exception message and asking user to open link in new browser window. I am getting problem in latest chrome and IE browsers. could you help me to solve the above problem? 


Thanks.
--sreeni
global class LightningForgotPasswordController {

    public LightningForgotPasswordController() {

    }

    @AuraEnabled
    public static String forgotPassowrd(String username, String checkEmailUrl) {
        try {
            Site.forgotPassword(username);
            ApexPages.PageReference checkEmailRef = new PageReference(checkEmailUrl);
            if(!Site.isValidUsername(username)) {
                return Label.Site.invalid_email;
            }
            aura.redirect(checkEmailRef);
            return null;
        }
        catch (Exception ex) {
            return ex.getMessage();
        }
    }

}
We just implemented NetSuite with the Celigo Connector. However, when opportunities are synced to Netsuite via the connector, the opportunitie no longer show up in the developer console. I'm running the SOQL query: SELECT SUM(Amount) FROM Opportunity WHERE CloseDate = THIS_MONTH AND StageName='Closed–Won'. Is there a setting that needs changing in order for this to not happen?

I am working with fields in Salesforce CPQ, though I figure all of the custom objects contained in it should respond to Apex as any others would. For some reason though, every time I try to reference a field on a product referenced by one of the custom objects, all fields related to that product show as null. I'm probably making some really obvious mistake. Please take a look:

public without sharing class QuoteLineHandler {
	public static void HandleBeforeDelete(){
		// Removes the Product type of all "Mosca Model" quote line items from the "Product Names" field on quote level

List<SBQQ__QuoteLine__c> quoteLineList = new List<SBQQ__QuoteLine__c>();
		List<Id> productIds = new List<Id>();
		// Add all relevant lines to list for further processing
		for(SBQQ__QuoteLine__c delQuoteLine : (List<SBQQ__QuoteLine__c>)Trigger.old){
			quoteLineList.add(delQuoteLine);
			productIds.add(delQuoteLine.SBQQ__Product__c);
		}

		List<Product2> productList = [Select Id,Name,Product_Type__c
										From Product2
									   Where Id In :productIds];		
		System.debug('productList query size is ' +productList.size()+ ' and product list = ' +productList);				   			   

		for(SBQQ__QuoteLine__c ql : quoteLineList){
			System.debug('checking if quoteline product name is null. Cover thy bases lest ye should receive a null-pointer exception.');
			System.debug('ql.SBQQ__Product__c = '+ql.SBQQ__Product__c+ ' AKA ' + ql.SBQQ__Product__r.Name);
			System.debug('ql.Id = ' +ql.Id);
			if(ql.SBQQ__Product__r.Name != null){
                System.debug('This code is never reached. Product name is always null.");
            }
        }
    }
}
As the last debug says, my null check never passes. My product's name is always null in spite of the fact that it shows in my query as having a name. Help would be greatly appreciated. 
Hello,

I have a community , there are already roles implemented, but i dont find them when i try to search, i want to edit the roles
 
  • January 05, 2017
  • Like
  • 0
Hi
 
I am trying to build a table of data in a page to show the list of policies details from the Account. Policy__c is the Custom Object.
However, it always show "Invalid field Policy__c for SObject Account.

I did try to modify <apex:pageBlockTable value="{! Account.Policy__c}" var="Policy"> to <apex:pageBlockTable value="{! Account.Policy__r}" var="Policy">, it doesn't work. the error message became  "Invalid field Policy__r for SObject Account.

How can I access the Custom Object from Standard Object? Thanks.
 .
 
<apex:page sidebar="false" standardController="Account">
    
    <apex:pageBlock title="Policy Detials">

   	<apex:pageBlockTable value="{! Account.Policy__c}" var="Policy">
     		 <apex:column value="{! Policy.Insurance_Company__c}"/>
      		<apex:column value="{! Policy.Name}"/>
                <apex:column value="{! Policy.Commencement_Date__c}"/>
 	</apex:pageBlockTable>

    </apex:pageBlock>
</apex:page>

 
Hi,

I am using an <apex:iframe src="/001/e" scrolling="true" id="theIframe"/> tag in my visualforce page but it is showing Load denied by X-Frame-Options: https://eu6.salesforce.com/001/e does not permit cross-origin framing. error .

Can anyone help me to include standard page in visualforce page.

Thanks,
Rohitash
Hi,  I have written a vf page and a custom controller to use the page on my home page as a  home page component. So I am not really passing any ID to the vf page. It just uses a table to display some values on the home page as the current user. How do I write a test class for this? Please advice me.
public with sharing class FinancialCashAudit {
    public List<Cash_Audit__c> cashAudit{get; set;}
    public List<Cash_Audit__c> cashAuditlist;
    public Integer counter = 0;
    public Integer list_size = 5;
    public Integer total_size;
    private List<Id> ophier;
    public FinancialCashAudit(){
        ophier = new List<Id>();
        for(User_Access__c use : [select id, Operational_Hierarchy__c from User_Access__c where User__c = :UserInfo.getUserId() and active__c = true]){
            ophier.add(use.Operational_Hierarchy__c);
        }
        cashAudit = [select name, Operational_Hierarchy__c, Operational_Hierarchy__r.Name,
                    Submitted_By__c, Submitted_By__r.Name, Submitted_Date__c from Cash_Audit__c
                    where Operational_Hierarchy__c IN :ophier ];
        total_size  = cashAudit.size();
        
    }
    public List<Cash_Audit__c> getcashAuditlist(){
        cashAuditlist = [select name, Operational_Hierarchy__c, Operational_Hierarchy__r.Name,
                    Submitted_By__c, Submitted_By__r.Name, Submitted_Date__c from Cash_Audit__c
                    where Operational_Hierarchy__c IN :ophier ORDER BY Submitted_Date__c DESC  LIMIT: list_size OFFSET : counter];
        return cashAuditlist;
    }
    public PageReference Beginning(){
        counter = 0;
        System.debug('Counter is '+counter);
        getcashAuditlist();
        return null;
    }
    public PageReference Previous(){
        counter -= list_size;
        System.debug('Counter is '+counter);
        getcashAuditlist();
        return null;
    }
    public PageReference Next(){
        counter += list_size;
        System.debug('Counter is '+counter);
        getcashAuditlist();
        return null;
    }
    public pageReference End(){
        counter = total_size - math.mod(total_size, list_size);
        System.debug('Counter is '+counter);
        getcashAuditlist();
        return null;
    }
     public Boolean getDisablePrevious(){
        if(counter==0) return true;
        else return false;
    }
    public Boolean getDisableNext(){
        if((counter + list_size) > total_size) return true;
        else return false;
    }
    public Integer getPageNumber(){
        if(math.mod(counter, list_size)>0){
            return counter/list_size + 1;
        }else{
            return counter/list_size ;
        }
    }
    public Integer getTotalPages(){
        
            return (total_size/list_size);
        
    }
   
    
}
This controller displays all the cash audits with operational hierarchy. the way it is shared is there is a object called User Access which has fields User and  operational_hierarchy. Please give me some idea on how to start on this.
Thank you
 
I'm seeing the following error message when checking the challenge:

--- snip ---

Challenge Not yet complete... here's what's wrong: 
The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.

--- snip ---

However, if I run ParkLocator country method from execute anonymous I get the list of parks back as expected, so the code is definitely using the SOAP service.  Also, if I remove the remote site setting for the endpoint then the challenge check fails as the SOAP endpoint is not authorized. I've also tried changing the name of the method to check that the challenge is definitely executing my code, and it fails if the name is other than 'country.

I can't see what I am missing here, but obviously I don't know what is being checked to determine if the SOAP endpoint is called. I've been seeing this for a couple of hours now and I've tried re-implementing in a different org with no success.
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG

I'm creating a small barcode scanner app using the latest mobile sdk (based on cordova 2.3.0).  Once I've dropped the .mm, .cpp and .h files into the Plugins directory, the build fails on the following line of the scanner code:

 

#import <Cordova/CDVPlugin.h>

 

saying that CDVPlugin can't be found.  The only way that I've been able to get the Xcode compiler to be able to see this file is to copy it from the SalesforceHybridSDK.framework/Headers folder and drop it into the Plugins folder.  The knock-on effects of this are that I have to copy most of the other header files across as well.

 

This works, but it feels wrong - I'm sure there's something obvious that I've missed.

 

Has anybody had any luck using the InAppBrowser?  According to the cordova docs, this is available in 2.3.0 and it appears in my config.xml.  The docs say that if I execute JavaScript of the form:

 

window.open('http://www.google.co.uk', '_blank', 'location=yes')

 then it should open the page in the InAppBrowser, leaving my existing app alone.  I've tried every combination I can think of and tinkered with the whitelisting, but all to no avail - every page opens in the cordova webview.

 

I'm trying to get this working so that I can open a PDF file via a link from my app and have a way to close it down and return to my app.  At the moment, when I open the PDF, I have no way to get back to my app.  I can workaround this to a degree using an iframe or object tag, but the interaction with the file for scrolling etc is very slow.

 

 

Hi all,

 

We have a public site where all pages are available to the guest user profile.  When accessing this site through the browser, we've never seen an authorization required page.  However, when google bots attempt to crawl the site we get intermittent 401 Authorization Required responses.  

 

I've tried hitting the site from seoconsultants check header tool, and I get intermittent 401 and 302 responses.  The 302 that I've just received is saying that the page has been moved to : cust_maint/site_down/maintenance.html.   Web analyzer gives the same results, yet using fiddler shows that the browsers are receiving nothing but 200 responses.

 

Has anyone else seen behaviour like this?  Its proving difficult to track down as every time I raise a case with support, they close it saying they don't support the google client.  However, that's not the issue here - I need to understand why the Salesforce server is returning the responses that it is.

 

 

 

 

Is anyone else having problems upgrading managed packages at the moment?

 

I've just completed a fairly large chunk of changes to our managed packages and have successfully uploaded to the App Exchange.  We have trialfore set up for our package, so I've created a new trial and attempted to upgrade the managed package to the latest version, which fails with an error similar to the following each time:

 

Error Number: 1663381573-11307 (983782282)

 

The first two parts of the error number change each time I attempt the upgrade, but the bracketed number (presumably the actual error code) stays the same.

 

I've then installed the trial version of the package into a brand new dev org and hit the same problem when upgrading, same bracketed error message too.

 

As I had made a large number of changes, I uninstalled everything from my dev org and went back to an earlier version of the package, and then attempted to upgrade to the next in sequence, which had very few changes and has worked in the past, but the same error code.  Once again, I can install the entire package into an empty dev org fine, but I don't appear to be able to upgrade under any circumstances.

 

I've been banging my head against this for the last 18 hours or thereabouts, so if anyone has any tips or tricks I'd be very keen to hear.

I have a VF page that contains an actionpoller to refresh a section every 'n' seconds.  In order to let the user know that this is happening, I'm using an actionstatus with start/stop attributes to invoke javascript functions.

 

I've found that while this works fine in Chrome and Firefox, IE 7 and 8 throw errors.  I've managed to dwindle this down to the following page:

 

 

 

<apex:page tabstyle="Account" showheader="false" standardstylesheets="true">
   <script>
      function start()
      {
         alert("Starting");
      }
   
      function stop()
      {
         alert("Stopping");
      }
   </script>   

<!--    <h1>Poller Test</h1> -->

   <apex:form >
      <apex:actionStatus id="sref"
                onstart="start()" onstop="stop()"/> 
   
      <apex:actionPoller interval="10" rerender="status" status="sref"/>

      <apex:outputPanel id="status">
          Here is the panel
      </apex:outputPanel>
   </apex:form>
</apex:page>

 

When I access this page in IE, I get JavaScript errors that 

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
Timestamp: Tue, 3 Aug 2010 10:37:26 UTC
Message: 'window.document.getElementById(...)' is null or not an object
Line: 17
Char: 1
Code: 0
Message: 'window.document.getElementById(...)' is null or not an object
Line: 19
Char: 1
Code: 0

 

'window.document.getElementById(...)' is null or not an object'.  If I remove the comment around the line:

 

 

<!--    <h1>Poller Test</h1> -->

 

 

Then it works fine for IE.  

 

It appears that inserting some regular HTML in between the javascript and apex:form components fixes it, but I've no idea why.  

 

Any suggestions as to what is causing this (I've already drawn the obvious conclusion that its an IE bug!)

 

 

I'm using the apex InputFile standard component to allow users to attach images to one of my custom objects.

 

There seems to be a limit on the file name size, but I can't find anything in the docs or force sites to confirm this.

 

If the file name is greater than 81 characters, I get redirected to the salesforce "an error has occurred" page, but I don't get any warning emails etc., nor can I trap this error as it is happening before hitting my controller. 

 

Has anyone else seen this?

Has anyone had any luck unit testing against information in the history table for an object?

 

We have a custom history popup, similar to the SF history display, but generated from scratch in a VisualForce controller.

 

I'm attempting to write some unit tests for the controller.  I am creating and updating an object of a type which has history tracking turned on, but I never get any entries in the history table.  I'm assuming that this is because the history table is populated from a trigger or similar when the transaction commits, and the transaction is rolled back in test mode.

 

I'm going to restructure to the code to get around this from the coverage point of view, but before I do that I'd appreciate it if anyone could confirm that this is the case.

I'm having some problems searching one of my custom object types using SOSL.

 

The type in question is the detail on a master-detail relationship, and I'm searching for a string that I know is present in a TextArea, but I don't get any matches.

 

 

It seems likely that its to do with the master-detail relationship, as I can search for text that appears in TextArea fields on other objects and it works fine every time.

 

Has anybody else seen this type of behaviour?

I'm encountering some rather odd behaviour with a SOQL query involving a join to a junction object.

 

I have two custom objects, Custom_a__c and Custom_b__c and a junction object for modelling a multi-multi relationship between them.

 

I have a list of ids for Custom_b__c objects that should exclude their associated Custom_a__c objects from availability.

 

The code in question is as follows:

 

List<Custom_a__c> available=[select id, Name from Custom_a__c where id NOT IN (select Custom_a__c from A_to_B_Association__c where Custom_b__c IN :excludeIds ) ];

 

 

I have a number of unit tests that check all the edge cases for this, and they are initially all working when run from the Force IDE or online.

 

However, after a period of time they will all suddenly fail.  I have plenty of debug in the unit tests that shows my test data is not changing between runs.  Even stranger, if I add an additional whitespace entry to the code above and save it back, the next run of the unit tests works fine. 

 

I also have another version of this code that carries out the same processing, but splits the SOQL into two queries, and the unit tests for this version never fail.

 

Has anybody else experienced this behaviour?  I've been looking through all the documentation and I can't see anything that is wrong with the SOQL.  I'm wondering if there are issues around using fields in the where clause of a join that aren't retrieved in the select, although that wouldn't explain why it works for a while and then goes wrong.

 

 

I'm seeing the following error message when checking the challenge:

--- snip ---

Challenge Not yet complete... here's what's wrong: 
The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.

--- snip ---

However, if I run ParkLocator country method from execute anonymous I get the list of parks back as expected, so the code is definitely using the SOAP service.  Also, if I remove the remote site setting for the endpoint then the challenge check fails as the SOAP endpoint is not authorized. I've also tried changing the name of the method to check that the challenge is definitely executing my code, and it fails if the name is other than 'country.

I can't see what I am missing here, but obviously I don't know what is being checked to determine if the SOAP endpoint is called. I've been seeing this for a couple of hours now and I've tried re-implementing in a different org with no success.
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG
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!
  • January 23, 2017
  • Like
  • 0
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
 
  • January 20, 2017
  • Like
  • 0
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. 

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

Is possible use apex:detail with different page layout? Because now is shown page layout which is assignment to record type and I want have some related lists, fields on my custom Visual force page and all on standard page of object.

I know that I can use fields and apex:relatedList, but I am searching for the simplest solution, which can customer manage (without edit of code he can not add other relatedList)

  • February 04, 2013
  • Like
  • 2