Add Navigation Controls Using sforce.one

Connect your page to the Salesforce1 navigation system by using sforce.one navigation functions.

Visualforce pages running in Salesforce1 often have to interact with or link to other pages in the application. Common navigation functions are available through the sforce.one object, a JavaScript utility library automatically made available when running inSalesforce1.

  1. Open the Developer Console and click File | Open, then open your page.
  2. At the bottom of the script block, before the closing </script> tag, add the following code to your page.
    ul.addEventListener("click", function(e) {
    sforce.one.navigateToSObject(e.target.getAttribute("data-id"));
    });
  3. Reload the app and view your changes.

Your mini app doesn’t look different at first. But try tapping an account. You’ll navigate to the account’s detail page, where you can view the account, the account feed, and so on. What’s more, by using sforce.one to navigate forward, you can also use the Salesforce1 back arrow to navigate back to where you started—your Latest Accounts page. Cool!

The navigation functions provided by sforce.one let you tie your custom app functionality into the overallSalesforce1 navigation system. This lets your pages behave just like built-in functionality when it comes to navigation. You can use different sforce.one functions to navigate to individual records, to specific feeds or feed items, to lists and related lists, and even to general URLs. See this unit’s resources for more details on this useful library.

 

Where to place Validation code in an Apex Trigger?

Quite often when i answer questions on Salesforce StackExchange they prompt me to consider future blog posts. This question has been sat on my blog list for a while and i’m finally going to tackle the ‘performing validation in the after‘ comment in this short blog post, so here goes!


Salesforce offers Apex developers two phases within an Apex Trigger, before and after. Most examples i see tend to perform validation code in the before phase of the trigger, even the Salesforce examples show this. However there can be implications with this, that is not at first that obvious. Lets look at an example, first here is my object…

Now the Apex Trigger doing some validation…

trigger LifeTheUniverseAndEverythingTrigger1 on LifeTheUniverseAndEverything__c
   (before insert) {
 
    // Make sure if there is an answer given its always 42!
    for(LifeTheUniverseAndEverything__c record : Trigger.new) {
        if(record.Answer__c!=null && record.Answer__c != 42) {
            record.Answer__c.addError('Answer is not 42!');
        }
    }
}

Cloud Computing

Next-generation data center management - the business case behind data center strategies is changing. Data centers represent a very logical starting point for a new consumer of cloud services, with relatively low risk and potentially significant cost savings and efficiency gains. Transitioning existing systems to the cloud offers opportunity to outsource non-core functions for most businesses. At the same time, it provides experience with a cloud-oriented way of organizing and accessing digital technology that is necessary to build out a roadmap for sensible cloud adoption. ōArchitectural planning, simplification, and transformation – Moving IT platforms to the clouds represents the next logical step in a serviceoriented world, and Build v. Buy v. Lease is the new decision framework in service selection within this context. Understanding the level of cloud and internal company maturity will guide decisions such as How and When to leverage cloud services to support core as well as non-core business capabilities, and how software assets should interoperate to provision business functionality. It is also critical in this step to give explicit focus to policy-based architectures that support agility and innovation.

Policy-oriented business and risk management – Policy within and across organization boundaries has traditionally been embedded within enterprise IT platforms and applications. However scaling businesses globally will require implementing new ways to combine and harmonize policies within and across external process networks and value chains. It will become increasingly critical for companies to establish clear and explicit definitions of governance, policy (regulatory, security, privacy, etc) and SLAs if they are to operate effectively with diverse entities in the cloud.

Cloud management – To conduct business within a cloud (recognizing what is available today), it is important for cloud consumers and providers to align on graduated SLAs and corresponding pricing models. Maturing cloud capabilities into more advanced offerings, such as virtual supply chains, requires support for fully abstracted, policy-driven interactions across clouds. This is a big jump, and it will become a major challenge for the cloud providers to adequately model, expose and extend policies in order to provide integrated services across distributed and heterogeneous business processes and infrastructure. The data associated with these business processes and infrastructure will need to be managed appropriately to address and mitigate various risks from a security, privacy, and regulatory compliance perspective. This is particularly important as intellectual property, customer, employee, and business partner data flows across clouds and along virtual supply chains.