Search

Friday, 22 May 2015

More Salesforce Spring 15 Release

Set Up Test Data for an Entire Test Class 
Use test setup methods (methods that are annotated with @testSetup) to create test records once and then access them in every test method in the test class. Test setup methods can be time-saving when you need to create reference or prerequisite data for all test methods, or a common set of records that all test methods operate on.

@testSetup static void setup() {
// Create common test accounts
List<Account> testAccts = new List<Account>();

for(Integer i=0;i<2;i++) {
testAccts.add(new Account(Name = 'TestAcct'+i));
}

insert testAccts;
}

//The Accounts created in setup() are automatically available in testMethod1() and testMethod2() which makes our test methods easier to make and the tests will run faster and more efficient

static void testMethod1() {
}

static void testMethod2() {
}


Chain More Jobs with Queueable Apex 
Queueable Apex was introduced in Winter ’15 and enables you to easily start and manage asynchronous processes. Previously, you could chain a queueable job to another job only once. You can now chain a job to another job an unlimited number of times. For Developer Edition and Trial organizations, your chain can have up to five queueable jobs.

public class AsyncExecutionExample implements Queueable {

public void execute(QueueableContext context) {
// Your processing logic here
// Chain this job to next job by submitting the next job

System.enqueueJob(new SecondJob());  //2nd job queued
}

}

More Salesforce Spring 15 Release

Import Accounts and Contacts with Ease
Your Name > My Settings > Import > Import My Accounts & Contacts,
and import from loads of source outlook, linkedin, excel, yahoo, zoho etc

Educate Users with Salesforce Adoption Manager
send tips by email to users to encourage good working processes

Call an Apex Method from a Process
When no other process action can get the job done, add customized functionality to your Salesforce processes by calling an Apex
method.
To call an Apex method, add the Call Apex action to your process and select an Apex class with an invocable method.

Monitor Your Users’ Login and Logout Activity
This could be used to identify user activity and if a user is getting most out of Salesforce and possibly identify user to remove and save on licenses.

ISVs
Streamline Managed Packages by Deleting Unused Components

Develop Deployable Custom Metadata Types (Pilot)
You can now create custom metadata types and can then create custom metadata that uses these
types’ characteristics. ISVs and enterprise IT departments have in the past emulated custom metadata
types by using list custom settings and in some cases custom objects, but the rows on these items
are data, not metadata, and data can’t be deployed to different organizations.

Also, other features....

Mass Submit for Approval

Creation of Any Object via Workflow Rule - using the new Process Builder

Submit for Approval Through Workflow Rules - using the new Process Builder

Apex Called by Workflow

Allow Changes in Formula Field Value to Trigger Workflow

Implement an "Apex Queue" for Async Processing - Create your own queues for whatever you like

Submit More Batch Jobs with Apex Flex Queue (Generally Available) - Now allows potentially unlimited sequential batches to run

Whats good about Salesforce Spring 15 Release


Open CTI
http://releasenotes.docs.salesforce.com/spring15/spring15/release-notes/rn_open_cti.htm
I'd expect the likes of New Voice Media are not going to be happy about this, but now developers will be able to easily integrate with whatever CTI system you like.

Outages and business continuity
http://releasenotes.docs.salesforce.com/spring15/spring15/release-notes/rn_organization_sync.htm
This uses the Salesforce to Salesforce fetaure
Some of the issues I see with this Salesforce to Salesforce only works from a Production /Dev to Production / Dev org, so you wont be able to copy data to say your full sandbox. So you will need a separate Production / Dev org which has the same size of data storage as your Production org, which means a lot of extra cost.
You will also need to make sure that all your meta data is up-to-date across both orgs and to constantly be updating Salesforce to Salesforce subscribe settings. Otherwise your data will not transfer across correctly. All of which will introduce extra work for your company to maintain.
But on a positive note, if you can easily select specific records / objects and export subsets of data then this could be beneficial
For good business continuity do use the current Data Export ability that can schedule objects to be exported in a csv file


Important Fix
A useful feature was released in winter 15 that allows you to Deploy without deleting Scheduled jobs by ticking a box in  Deployment Settings
For some orgs when you go to Deployment Settings you will see Insufficient Privileges
This is a known error but there is a workaround here
https://success.salesforce.com/issues_view?id=a1p30000000eJZlAAM

Quick Deploy
Also I can confirm that Quick Deploy now fully works and is a great addition for deployments

Tuesday, 15 July 2014

Frameworks or Processes


Frameworks or Processes

I was discussing our processes at work 1 day with my manager, Bruce Heard. You notice I automatically said processes. The question is do we have processes or frameworks. Bruce said to me, “if you stood in front of a classroom and write a load of facts on a whiteboard the pupils will remember about 10℅ of what you said. If instead you tell them the subject and that they must use the tools available, eg the internet, books etc to find out what they can about the subject. The pupils will ultimately remember more and learn more.” This principal can be extended to the workplace by providing not a hard rigid set of rules but a more flexible framework to allow the employee some degrees of freedom to investigate, experiment, adapt and learn.

First a business needs to decide if to adopt a Framework or Process approach.
Whichever you choose between using Frameworks or Processes which will be specific to your business its important to have a coherent approach throughout your business so if its Frameworks or Processes it should be a value held throughout your business so all departments fully adopt the approach selected.
Now its equally important for your Frameworks or Processes to evolve but its equally important that your Frameworks dont become Processes or vice versa, to ensure this doesnt happen its necessary to define what your business defines as a Framework and a Process, which will be specific for your business.
This will allow you to govern your Frameworks or Processes and ensure that they don’t gravitate too far away from becoming its opposite force.

Your business should continually monitor your Frameworks or Processes, whichever you have selected as your core value for your business to ensure that they remain steadfast to their definition. A department should be accountable to ensuring all departments adhere to this, if you like, internal auditors of your Frameworks or Processes ( whichever is selected for your business )
It is imperative that each department buys into the core values because if some departments adopt a Framework approach and other departments Processes, since departments rarely act as silos in a business or shouldn’t act as silos and should communicate across their borders you will consequently develop poor communications and tensions will arise between departments

A separate dimension that we’ve not discussed are the tools to use which act as enablers for your Frameworks or Processes. You should have a consistent approach to the tools you use and the tools should be specified in your Frameworks or Processes. Defining tools to use ensures a consistent approach. If tools are not specified in your then the user can select any tool they wish to do their work
which may not be safe, may not following industry standards, could cause issues when you are being audited, may not be efficient, may result in losing business ISO accreditations, difficult to manage, train and support etc

When would you use a Framework or Process. To answer this there are a few things to take into account. If you adopt Frameworks you would not make statements, such as "click here now click there, enter this and then jump up and down", you simply state read this article in the event you need to do X, in other words signpost the user and let them go and work it out for themselves exactly what they need to do.
For processes, you will consider every possibility without the possibility of any other permutation and specifically state the steps the user needs to perform which could be references to other articles and online tutorials etc but the difference to frameworks is that all possibilities are considered and accounted for with a process to explain to the reader what they should do in such events.

Frameworks foster an environment of creativity, empowers employees, saves time in producing exhaustive reams of process material and is more adaptable, and makes employees accountable as they cannot hide behind a process and blame the process when something goes wrong; they know what their role is, they know what their duties are and they are given the tools, training and a framework to achieve their duties.
Frameworks work well in ever changing environments, but not as well in environments were control is necessary where consequences of error is catastrophic.

Processes allow strict control with little chance of anomalies occurring. In businesses were roles and responsibilities and duties rarely change, well defined processes can work well and where it is 100% critical that an exact process is followed; organisations such as hospitals, military and where the consequences of deviating from a strict set of processes can result in catastrophic failure.


Processes can lead to personnel avoiding accountability when errors occur because they are able to blame the process. The only exception for this is if the organisation does not adopt good tools to support the framework, and doesn't allow freedom to develop and experiment with the framework.

Wednesday, 4 June 2014

Self Evolving Software

SES has been launched on the AppExchange.


SES is simply the holy grail of software development, the ability for a computer program to understand what is required in English and hunt down functions in the codebase to fulfill a particular requirement.

Development teams commonly duplicate code because they are not aware that the same function has already been developed by another developer, this may be in the same organization or not. Every time this happens an organization loses money in costly developers time and also by unnecessarily delaying IT projects.

Duplicating code causes other issues such as unit tests have to be created twice and in cloud environments like Salesforce additional unit tests results in longer deployment times to Production, and finally Salesforce is limited to 3,000,000 characters of code so less code will be available.

SES literally automates the processes of finding relevant functions from the codebase and creating the code using these functions to fulfill the business requirement.

By utilizing crowd sourcing software development in SES is a catalyst to faster, more accurate and efficient software development. 

https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5NNmEAN

Saturday, 10 May 2014

Insert Related Test Data Quick and Easy

We all spend a lot of time making test data for our unit tests, especially when linking multiple objects together.
The function below shows you how you can create a json object, upload it as a StaticResource and then run the following code which will automatically create your test data, all objects linked together as expected.
Instead of it taking you hours making code to create test data this function will take less than 15 minutes and all you will need is around 3 lines of code to upload as much data as you like.
You can also use the same function to prime your sandboxes with specific data that it needs to operate correctly, or your training and test environments with data to fullfil the operations your users need to do.



There are a few additional changes I do want to make to the code, but overall the code works fine

Code will be uploaded soon

Friday, 26 April 2013

Managed Package Issues

Unit tests do not run when you install a managed package, but the code coverage of the unit tests of a managed package do affect the overall coverage of your entire unit test coverage.

Unit tests in a managed package can fail when you install a package and still the package will install, but when a package is being created all unit tests need to pass in the org that the package is created.

So unit tests of a managed package must be written well creating their own test data etc, because otherwise all other unit tests in an org may have coverage over 75% but code cannot be deployed because unit tests in managed packages are much lower than 75%