Developer News and Useful Links from Dreamforce 14:

I’ll post a few things on Dreamforce 14 over the next few weeks, but a lot of very interesting things have been announced.

Trailhead

Announced this morning in the Developer Keynote, Trailhead is a new section in developer.salesforce.com that allows developers to get started on the platform. There’s already a lot there with the promise of a lot more.

https://developer.salesforce.com/trailhead

Lightning

The buzz word of the conference among developers, Lightning is a new set of meta data elements developers can create that essentially add custom capabilities to the setup menu. So, a developer can create a Lightning App containing components that can be then added to your Salesforce apps in the set up menu.

A lot of what has been shown shows it’s massive potential but it’s obvious that Salesforce are still finishing off so that all orgs can see it in Spring 15. Lightning is only available in Dev orgs in Winter 15 but to see where development is going is very interesting:
https://developer.salesforce.com/lightning
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/
http://www.salesforce.com/us/developer/docs/lightning/lightning.pdf

And you can win some money as early adopters via topcoder:

http://lightning.topcoder.com/

What is really interesting is that Salesforce are creating tools for development and setup in Lightning. Though only available by request, I have had a quick look at the new ‘Lightning Process Builder’ which will allow the creation of Visual Workflows (it has the best UI I’ve seen) and the ‘Lightning App Builder’ which will give Admins and Developers an easy way to ad Lightning Components and Apps to their UIs. The Process Builder looks pretty finished already and the App Buillder shows huge promise.

Heroku

Heroku DX was launched this week. Also a big push on easily creating heroku apps and sharing boilerplate applications.
https://buttons.heroku.com/
https://www.heroku.com/cx

Limits

I heard something at a presentation this morning that was news to me. [SAFE HARBOUR] DML limits will completely change in Spring 15. Instead of counting calls and records per transaction, the new limit will look at the length of time of the transaction (like CPU limit). Seems that this will become the norm for all limits.

Apex

[SAFE HARBOUR] again, but Apex developers could get more control over the order of execution of things than they had before and it sounded like this will happen next year. Lots of reading between lines here but it sounds great!

External Objects

Apart from Lightning, External Objects are the best thing I’ve seen this week. Retrieving data from an external database and treating it as a custom object in Salesforce. Very impressive.

Advertisements

Fix my first trigger!

I recently had a request from one of the Salesforce Administrators in my company to ‘fix’ a trigger he had stumbled upon that wasn’t doing what it was supposed to.

The requirement for the trigger was to update the ‘Last Meeting Date’ custom field added to the User standard object when a Meeting (custom object) record was created.

The initial state of the trigger is below and I was asked to fix it.

trigger updateLastMeetingDate on Meeting__c (After Insert) {

//Get a list of all Meetings that the trigger will run on
    List<Meeting__c> meetings = new List<Meeting__c>(); 
        meetings = Trigger.new;
    
//Get a list of all users
    List<User> UsersToUpdate = new List<User>(); 

//Run through each Meeting that the trigger is running against and get it's Owner's User Record ID, 
//then update the date on that record
    For(Meeting__c m:meetings){
        User U = [SELECT ID, Name, Last_Meeting_Date__c FROM User where ID=:m.OwnerID ];
        U.Last_Meeting_Date__c = Date.today();
    }   
    
    Update UsersToUpdate;
    
}

I have been showing this to my Apex students and one of them made a very elegant simple trigger. I’m adding spaces here just in case you want to try it before seeing his solution!

 

 

 

 

 

The Solution:

trigger updateLastMeetingDate on Meeting__c (After Insert) {
	Set<user> owners= new Set<user>();
	for(meeting__c m:trigger.new){
		owners.add(new user(id=m.ownerId,Last_Meeting_Date__c=Date.Today()));	
	}
	update owners;
}