• tomster
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hello,

With Spring 16, there are new functionalities for offline mode (as per release readiness videos). Our org is at Spring 16 already but the Salesforce1 app doesn't seem to have anytihing new for offline. Do we need to wait for an upgrade for Salesforce1 for these new features to take effect?

Thanks
Hello,

Has anyone ever experienced this? When running a batch class, the query fetches 9200 rows (sometimes over 10000 so this is why I'm using batch). I then proceed to loop and insert in a custom object. But everytime the insert is missing 200 rows (size of scope) so 9000 rows are inserted instead of 9200. If I put the scope to 500, then 500 rows are missing. When I debug, I notice that the first SerialBatchApexRangeChunkHandler is always empty as if the execute doesn't happen until the 2nd pass. Another thing that I noticed is that for lower row counts like 2000, this behavior doesn't happen and all iterations are there. I've tried to schedule the batch and also ran it manually but both have same behavior. Why is this happening? Thanks.  Here is the code:
 
global class ScheduledOpportunityTrend_Batch implements Database.Batchable<sObject> {
	String query;
   
    global ScheduledOpportunityTrend_Batch() {
        if(Test.isRunningTest()){
             query ='Select id,Name, Opportunity.Account.name, Opportunity.amount, Opportunity.CloseDate,Opportunity.CreatedDate, Opportunity.DateClosed__c, Opportunity.Name, ProductCode, Product_Code_Entry__c, Opportunity.Account.Territory__c, convertCurrency(TotalPrice), Opportunity.currencyisocode,Opportunity.id, OpportunityLineItem.Product2.Business_Unit__c from OpportunityLineItem where InQuote__c = true and OpportunityLineItem.Product2.Business_Unit__c = \'Optical\' and Opportunity.IsClosed = false ORDER BY Opportunity.Name limit 100'; 
        } else{
             query ='Select id,Name, Opportunity.Account.name, Opportunity.amount, Opportunity.CloseDate,Opportunity.CreatedDate, Opportunity.DateClosed__c, Opportunity.Name, ProductCode, Product_Code_Entry__c, Opportunity.Account.Territory__c, convertCurrency(TotalPrice), Opportunity.currencyisocode,Opportunity.id, OpportunityLineItem.Product2.Business_Unit__c from OpportunityLineItem where InQuote__c = true and OpportunityLineItem.Product2.Business_Unit__c = \'Optical\' and Opportunity.IsClosed = false ORDER BY Opportunity.Name'; 
        }
   }

    
    global Database.querylocator start(Database.BatchableContext BC){
        //Get the opportunities for Simulator that are open. We don't take into account any dates. We fetch everything.
        return Database.getQueryLocator(query);
    }
 
    global void execute(Database.BatchableContext BC, List<OpportunityLineItem> scope){
  		
         List<SnapshotOpportunityTrend__c> ObjecttoInsert = new List<SnapshotOpportunityTrend__c>();
       
        for(OpportunityLineItem s :  scope){
            //create object and set all the fields in object
                SnapshotOpportunityTrend__c SnapObject = new SnapshotOpportunityTrend__c();
                
                snapObject.Business_Unit__c = s.Product2.Business_Unit__c;
                snapObject.Opportunity_Id__c = s.Opportunity.id;
                snapObject.Opportunity__c = s.Opportunity.id;
                SnapObject.Account_Name__c = s.Opportunity.Account.name;
                SnapObject.Amount__c = s.Opportunity.amount;
                SnapObject.Amount_Currency__c = s.Opportunity.amount;
                SnapObject.Closed_Date__c = s.Opportunity.CloseDate;
                SnapObject.Created_Date__c = s.Opportunity.CreatedDate.date();
                SnapObject.Date_Closed__c = s.Opportunity.DateClosed__c;
                SnapObject.Opportunity_Name__c = s.Opportunity.Name;
                SnapObject.Product_Code__c = s.ProductCode;
                SnapObject.Product_Code_Entry__c = s.Product_Code_Entry__c;
                SnapObject.Territory__c = s.Opportunity.Account.Territory__c;
                SnapObject.Total_Price__c = s.TotalPrice;
                SnapObject.Total_Price_Currency__c = s.TotalPrice;
                    
                    ObjecttoInsert.add(SnapObject);

            system.debug('aaaaaaaa: ' + ObjecttoInsert.size());
           		
       }
 				
 			try{
                //insert list containing all lines
                insert ObjecttoInsert;
            }catch(Exception e) {
                System.debug('An exception occurred: ' + e.getMessage());
            }

    }
     
    global void finish(Database.BatchableContext BC){
        AsyncApexJob a = 
           [SELECT Id, Status, NumberOfErrors, JobItemsProcessed,
            TotalJobItems, CreatedBy.Email
            FROM AsyncApexJob WHERE Id =
            :BC.getJobId()];
                          
       // Send an email to the Apex job's submitter 
       //   notifying of job completion. 
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       String[] toAddresses = new String[] {a.CreatedBy.Email};
       mail.setToAddresses(toAddresses);
       mail.setSubject('SnapObject: ' + a.Status);
       mail.setPlainTextBody
       (query + ' : ' + a.TotalJobItems +
       ' batches with '+ a.NumberOfErrors + ' failures.' );
       Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

 
Hello,

I've read that in Salesforce1, we should avoid using the <apex:form>. In the same documents, they write that we should try using <apex:input> rather than <apex:inputField>. However, both <apex:input> and <apex:inputField> need <apex:form> to be used. (apex:inputField must occur between <apex:form></apex:form> tags)

When I use <apex:form> with javascript remoting, they seem to come into conflict with each other. The event from the function(result, event)  simply never runs and so any logic beyond that point is impossible. I would normally use sforce.one.navigateToSObject('{!Lead.Id}','detail') to redirect at this point.

If I remove the <apex:form> tags, then the code works fine every time.

My dilema: How to reuse Visualforce components like picklists (would be more scalable if adding choices in a picklist would automatically be added in the Salesforce1 picklist too) and also be able to use javascript remoting to be able to redirect pages.

Have anyone had this problem? Would anyone know what the best practices here would be? Thanks!

References
http://www.slideshare.net/developerforce/visualforce-in-salesforce1-1-1
Hello, 

I need to update a campaign custom field when a new member joins the campaign. Has anyone ever tried this?

Thanks

Ok this new developer console is just driving me nutts. With no plugins, cleared out all cache tried in mutlple browsers and the speed is rubbish. But now we can't even load some logs!! they never load up and it says eg:

 

Error: Open request failed

1853395889-5586 (2050760807)

 

in a box.

 

ARGH! any ideas?!?

It's gotten to the point where I've logged off, rebooted, and I still can't open it up because the last log it tried to load freezes my browser. I effectively cannot access any log messages from my code because the most recent logfile was too large, and the majority of those messages are about heap allocation (which I, as a user of the platform and not a Salesforce.com employee, care nothing about).

 

I'm now trying to look into reducing the size of these logs with filters, but the fact that I have to do this in order to keep my browser from crashing is ridiculous. It's always been slow, but it's never been this bad before.

 

Salesforce employees: can you PLEASE provide options (preferably set as the default) to hide log messages not created with System.debug()? These log files are simply too big to deal with in a browser.

 

</rant>

 

I've been trying to track down a bug in my application for the past few hours, but can't get anywhere because I can't see my app's output. This is rather frustrating, and the last time I asked here about how to filter out irrelevant log messages I was told to use Ctrl+F, which obviously doesn't work in a crashing browser.

 

Any tips or pieces of advice are welcome.