Saturday, October 25, 2014

Dreamforce 2014 Round-up / Summary

This was my first time attending Dreamforce and subsequently presenting there as well. I focused primarily on the development side of things, so spent most of my time around Moscone West.

I've collected some of my session notes and general conference thoughts here. Content here will evolve over time as I collate all my notes etc...


Sessions

Introducing VF Fiddle

Presenter: @EvilN8. Session Video

As you may know, I'm an active member of the Salesforce StackExchange site. I find the format useful for asking and answering Salesforce specific questions. One of the time consuming things about the site is trying to replicate an askers environment and then communicating the solution back in the answer.

VF Fiddle is similar in concept to JSFiddle and allows for quick deployment of Visualforce markup, the Apex controller, CSS and Javascript to a Dev Org. https://vffiddle.herokuapp.com/


External Objects - Magical External Objects: Seamless Integration is Here

Presenters: Agustina Garcia Peralta and Andrew Fawcett. Session Video

a.k.a Salesforce1 Platform Connect a.k.a. Lightning Connect

External Objects allow you to view and search data from an external system as though is was a native custom object without actually loading all the data into Salesforce.

Configured under Build > Develop > External Objects and ExternalDataSource.

The main advantage of not storing the data in a custom object is that it does not count against the Org storage limits and you don't need to try and keep the data in sync. At this stage data can't be updated in the data source.

Odata Odata limits apply on single round trip size - 4 MB. Total size of continuation links is 8MB.

There is also a pilot Apex Connector API with classes extending DataSource.Connection and DataSource.Provider

Can you query the data in Apex and SOQL? Yes
Used as field relationship? Yes, with some limits - Can't be used in a Master-Detail relationship.
Are updates from Salesforce synced back? Read Only at this stage.

Where a standard custom object has the __c suffix, external objects have the __x suffix.

Limited to 100 External objects per org.

Access External Data with Salesforce1 Platform Connect


Apex Tips And Tricks

Presenter: Gonzalo Abruna. Session Video

SOQL queries often take up most of the CPU time.

The Developer Console Execution Overviews Timeline is a great way to check a transaction to see where the performance issues are. Open the Apex log and use Debug > Switch Perspective > All or Analysis.


Message Queuing - Building a Messaging Framework on the Salesforce1 Platform

Presenter: @anup Slides

An alternative to using Outbound messages using a custom queue implementation. Independent batches that monitor a message queue and invoke the applicable service handle to send the message out and process the response.

   

Build Your Own Platform on Force.com

Presenters: Mac Anderson, Avrom Roy-Faderman, Aaron Slettehaugh. Session Video

This session will provide an overview of Platform on the Platform, including demonstrations by sfdc partners of features built with the first of our three major features: Custom Metadata. Custom Metadata are similar to List Custom Settings except that the records can be packaged, installed, deployed and managed as metadata. We will show how for the first time, sfdc customers and partners will be able to create their own metadata records and your own platform.

__mdt suffix


Proxly - Speed Up Your Force.com Development and Go Localhost

Use local resources for JavaScript and CSS references to speed up development. https://github.com/dnakov/proxly


Flex Queue - Apex Flex Queue: Batch Apex Liberated

Presenter: @CarolEnLaNube. Session Video

Current Situation:

  • @Future No Job ID - returns void - can't monitor - must be static - primitive data types
  • Batch Jobs - returns ID that can be monitored, recursive calls, only 5 active jobs, can't be ordered.
  • Schedule Jobs

Flex Queue - combines best parts of @Future and Batch

Batch Jobs : With FlexQue.

More that 5 Apex Jobs in the Apex Jobs Table
5 Apex Jobs Processing + 95 Apex Jobs in Holding

Can you reorder Jobs from code or give them a priority? Appears not.
Can't abort holding jobs using the UI, need to use System abort.

Queueable interface and QueueableContext in execute. Provides a middle ground between Batch jobs and @future
Supports more than just primitive arguments that @future methods do.
Less overhead than a Batch job as there is no start method to go through the aync queue.
System.enqueueJob() - returns Job ID. So you can monitor progress.
Can be chained together, which future jobs can't be.
Can have 50 Queueable jobs.


Interactive Apex Debugging

Presenter: Josh Kaplan. Session Video.

Due sometime in 2015 as an Eclipse plugin. Sounds like it will be a paid SKU for a sandbox org.


Meet the Developers

Presenters: Steven Tamm, Gregory Fee, Phil Calvin, Doug Chasman

A great session where you can ask questions of the Salesforce developers.


Lightning


Sessions I want to catch up on (among others)

  • Catch Bugs Early with Apex Diagnostic Code
    Ridding your Apex code of pesty bugs improves the quality of your Salesforce implementation and increases the predictability of your application's success. Catching those bugs early saves time and money and having the proper skills to do so when you start development saves even more. Join us as we cover contract programming, assertions, and enhanced logging and notification.
  • A Deep Dive into Debugging Applications on the Salesforce1 Platform
  • Building Machine Learning Systems with Apex
  • Faster SOQL? Yes, Please Slides

FinancialForce DevTalks DF14 - Apex Unit Testing with ApexMocks Framework

I was surprised to hear about the meetup scheduled during Dreamforce. It was a really interesting session on a mocking framework called ApexMocks.


Presenting - Using the Tooling API to Generate Apex SOAP Web Service Clients

I gave a breakout presentation on the WSDL2Apex component of the FuseIT SFDC Explorer that increases support for calling SOAP based web services. See Dreamforce 2014 Presentation - Improved Apex support for SOAP based web services, which includes the session video and slides.


Miscellaneous Notes

Salesforce StackExchange

I had a number of shirts to give out, which was easily accomplished on the first day. It's a great way to get talking to people.

Breakfast, Lunch on site

The on site breakfast on the Monday was a selection of fruit and granola (muesli with more sugar or other sweeteners) bars. Lunch was no longer available in Moscone West or the Yerba Buena Gardens around 12:30 pm on the Monday. Subsequent days I had better luck with the Moscone West expo area around 11:30am. It tended to be prepackaged, so you could grab something and eat it later easily enough.

Gala

There was a choice between Bruno Mars and Cake. The food options were really good inside were Cake were playing.

Taking notes

I'd recently picked up a Surface 2 and already had the type keyboard acccessory to use with it. Combined in Onenote it worked well as an all day not taking device. I was also able to use it to complete some of the labs using Salesforce from the built in IE browser. There were a few qwirks with using the developer console.

Uber

Salesforce gave out a coupon code for first time users of Uber with the $30 credit for the first trip. I set this up with Uber on my phone before leaving New Zealand using my local credit card and cell phone number. On arriving in San Francisco I picked up an AT&T SIM card to avoid excessive international roaming charges. When I tried to book my first Uber ride they sent a confirmations SMS text message to my NZ cell phone number, which I wasn't able to receive due to switching SIM cards. I could have swapped the SIM cards to get the message, but found it too much of a hassle to try and accomplish in the street. My phone needs a pin or similar to pop the SIM card out. So, moral of the story, wait to register for Uber until you get your local SIM if you are going to switch.

Accommodation

I was fortunate enough to have booked accommodation early through the Dreamforce website so I was walking distance to the conference.

One surprise here was the payment going through my personal credit card that I presented at check-in for incidentals rather than the company credit card that was used on the Dreamforce website to request the accommodation.

Tourist Travels

Being my first trip to San Francisco I wanted to get out and do some touristy things. I'd recommend:

  • Hire a bike and ride over the Golden Gate Bride to Sausalito or further on to the Red Woods. I made a day of it and cycled back as well. If I'd known it was there I would have visited the Bay Model Visitor Center.
  • The Alcatraz audio tour.
  • Coit Tower - some good view over the city and harbour.

Thursday, October 23, 2014

Importing the Salesforce Winter 15 Partner API to .NET

After updating the Partner API to v32.0 from v31.0 I started getting the following SGEN compilation errors:

  1. System.InvalidOperationException: Unable to generate a temporary class (result=1).
  2. error CS0029: Cannot implicitly convert type 'XYZ.SalesforcePartner.ListViewRecordColumn' to 'XYZ.SalesforcePartner.ListViewRecordColumn[]'

The new ListViewRecord and ListViewRecordColumn complexTypes from the v32.0 wsdl:

            <complexType name="ListViewRecord">
                <sequence>
                    <element name="columns"                  type="tns:ListViewRecordColumn" maxOccurs="unbounded"/>
                </sequence>
            </complexType>

            <complexType name="ListViewRecordColumn">
                <sequence>
                    <element name="fieldNameOrPath"          type="xsd:string"/>
                    <element name="value"                    type="xsd:string" nillable="true"/>
                </sequence>
            </complexType>

The problem appears in the generated Reference.cs with the ExecuteListViewResult.records multidimensional array return type.

        /// 
        [System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn), IsNullable=false)]
        public ListViewRecordColumn[][] records {
            get {
                return this.recordsField;
            }
            set {
                this.recordsField = value;
            }
        }

The XmlArrayItemAttribute typeof(ListViewRecordColumn) should be typeof(ListViewRecordColumn[]). After changing this manually the web reference compiled again.

        /// 
        [System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn[]), IsNullable=false)]
        public ListViewRecordColumn[][] records {
            get {
                return this.recordsField;
            }
            set {
                this.recordsField = value;
            }
        }

See also:

Wednesday, October 8, 2014

How to contribute to the Salesforce WSDL2Apex project

WSDL2Apex is a Salesforce tool for converting a web services WSDL file into Apex classes that can make the required SOAP callouts and then process the responses. Internally the callouts are made using the Apex class WebServiceInvoke. In September 2014 it was released as an open source project.

I'll cover setting up a development environment to build it and then contribute those changes back in this post. It is loosely based on Peter Knolle's Extending the Force.com IDE article.

  • Clone the project repository from GitHub. The Fork button on the web page made me a clone easily enough at https://github.com/FishOfPrey/WSDL2Apex
  • If you don't have it already, get the Java Development Kit 7. For me this installed as %Program Files%\Java\jdk1.7.0_67.
  • Add the Java 7 JDK bin to the PATH.
    ...\WSDL2Apex\WSDL2Apex-master\target>SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.7.0_67\bin
  • Get Apache Maven 3.2.2 to manage the builds and test runs.
  • Setup the Maven PATH requirements as per the Installation instructions.
    > SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_67

    Note the absence of surrounding double quotes. With quotes I was getting the message "Files was unexpected at this time."
    > SET PATH=%PATH%;D:\Development\Maven\apache-maven-3.2.3\bin
  • Package it up, including running the test cases:
    >mvn install package
  • Run WSDL2Apex from the command line:
    ...\WSDL2Apex\WSDL2Apex-master\target>java -jar WSDL2Apex-1.0.jar "C:\PathTo\WSDLs\WithLimitElement.xml" outputDir yes

You will need to submit a Contributor's License Agreement before Salesforce can accept your pull requests. The form is available on the Contributing Code page.

It is licensed under the Eclipse Public License (EPL) v1.0. Eclipse Public License (EPL) Frequently Asked Questions is a useful resource.

See also: