Free JQuery Mobile Adoption Manager JavaScript Code

Written by ShamrockCRM on August 26, 2012 – 9:03 pm

This is Part 3 in the series of Salesforce.com HTML5 Mobile Development using VisualForce, APEX, JavaScript (JQuery Mobile) and HTML5.  I have already posted the code for the Visualforce as well as the APEX Controller.  This part in the series provides you with the JavaScript code to finalize everything.  The combination of all of this will show you how to implement this Adoption Manager AppExchange app for managing the adoption of your users.

A couple of notes here.  This code is certainly not optimized and certainly not prettied up.  A lot of the functions need to be merged into cleaner functions.  The memory usage could probably optimized a little better.  There are a couple of other things to play with as well.  This is basically a way to help you learn how to implement different features using Salesforce.com in HTML5 with JQuery mobile, such as querying profiles and dynamically populating a form picklist and displaying lists of users on the screen and activating/deactivating users, etc.  Take what you will from this, but it is a fully functional mobile app for you to hack and place into PhoneGap if you would like.

Salesforce JQuery Mobile

This code goes into the usermanager.resource static resource (after the break).
Read more »


Tags: , , , , , , , ,
Posted in Salesforce Mobile, VisualForce, Web Development | Comments Off on Free JQuery Mobile Adoption Manager JavaScript Code

Salesforce Mobile Dev Part 2 – APEX Controller

Written by ShamrockCRM on July 27, 2012 – 1:08 pm

Yesterday, I posted the VisualForce code for developing a mobile “insert user” page.  Today, I am posting the details on the APEX Controller required to perform the heavy lifting in Salesforce.

This APEX Class will perform a few tasks: 1) It will query the available Roles, User License types, and Profiles for population into the dropdown select lists. 2) Perform an “insert” of the new user into the database. 3) Return the DML error message if an error occurred (e.g. username already exists, etc.).

Currently, this code is only enabled to work with the “Salesforce” User License type. This could be enhanced to allow for Force.com platform licenses, Chatter licenses, etc.

global with sharing class usermanagerController {

    @RemoteAction
    global static String insertUser(String firstName, String lastName, String email, String profile, String role, String sendEmail) {
        try {
            String alias = firstName.substring(0, 2) + lastName.substring(0, 2) + email.substring(0, 2);
            User u = new User(IsActive = true, FirstName = firstName, LastName = lastName, Email = email, Username = email, ProfileId = profile, UserRoleId = role, Alias = alias, DefaultGroupNotificationFrequency = 'D', DigestFrequency = 'D', EmailEncodingKey = 'ISO-8859-1', LanguageLocaleKey = 'en_US', LocaleSidKey = 'en_US', TimeZoneSidKey = 'America/Los_Angeles', UserPermissionsCallCenterAutoLogin = false, UserPermissionsMarketingUser = false, UserPermissionsOfflineUser = false);

            if (sendEmail == 'on') {
                Database.DMLOptions dlo = new Database.DMLOptions();
                dlo.EmailHeader.triggerUserEmail = true;
                u.setOptions(dlo);
            }
            insert u;
        } catch (DmlException e) {
            return e.getDmlMessage(0);
        }
        return 'true';
    }

    @RemoteAction
    global static List < Profile > queryProfile() {
        //Only works for SFDC, enable later for Force.com with a dependent picklists in jquery
        ID salesforceUserLicense = [Select Id from UserLicense where Name = 'Salesforce'
        limit 1].Id;
        String profileQuery = 'Select Id, Name, UserLicenseId From Profile where UserType = \'Standard\' And UserLicenseId = :salesforceUserLicense ORDER BY Name ASC';
        List < Profile > p = Database.query(profileQuery);
        return p;
    }

    @RemoteAction
    global static List < UserRole > queryRole() {
        String roleQuery = 'Select Id, Name From UserRole where PortalType = \'None\' ORDER BY Name ASC';
        List < UserRole > r = Database.query(roleQuery);
        return r;
    }

    @RemoteAction
    global static List < UserLicense > queryUserLicense() {
        String ulQuery = 'Select Id, Name, LicenseDefinitionKey From UserLicense where Name =\'Salesforce\' limit 1';
        List < UserLicense > ul = Database.query(ulQuery);
        return ul;
    }
}

Next, I will post details on the JavaScript.


Tags: , , , , , , ,
Posted in Force.com User Adoption, HTML5, Salesforce Mobile, Salesforce.com | Comments Off on Salesforce Mobile Dev Part 2 – APEX Controller

Geolocation in Salesforce Mobile Apps

Written by ShamrockCRM on June 12, 2012 – 12:02 pm

There’s not very often that I am astounded by something VERY cool having to do with SOQL, but here’s a goodie.  Salesforce is providing the capability for mobile apps to search for records in the vicinity of the current mobile user in SOQL.  Take a look at this information:

 

Geolocation

This one might be news to many Force.com developers, but one of the most exciting new features in Summer ’12 (currently in Pilot) is the addition of a Geolocation custom field type. You can now geocode data in Force.com by adding latitude and longitude coordinates using that custom field type. Once the data is geocoded (say in the location__c field), you can then execute a SOQL query like the one below from the mobile application

SELECT caseNumber, location__latitude__s, location__longitude__s FROM Case
WHERE DISTANCE(location__c, GEOLOCATION(&lt;latitude and longitude coordinates of mobile device&gt;), 'mi') &lt;= 10

The above query will return all Case records that are within a 10 mile radius of the mobile device. We’ll be providing additional details and code samples on how to use the new geolocation field type (pilot) in the near future, but hopefully the snippet above demonstrates some of the power of this new feature.


Tags: , , , ,
Posted in Summer 2012 | Comments Off on Geolocation in Salesforce Mobile Apps

Salesforce for iPhone and iPad

Written by ShamrockCRM on December 21, 2011 – 9:03 am

Salesforce released iOS apps well before any glimpse of Android applications, so here is a quick preview of what is available from iTunes.Salesforce iPhone iPad Apps

Salesforce Mobile – the original iPhone app.  It is still VERY basic in the overall UI experience, but it will allows you to accomplish a lot.  Create/Edit/View your standard and custom objects.  View dashboards.  Log activities.  It is certainly not pretty, but if you have an iPhone (or even an iPad) and use Salesforce, this is a must.  It can even be used as a quick way to build very basic iPad applications, but it will not scale up in a pretty way.

Salesforce for iPhone

Salesforce Chatter – Works great for both the iPad and iPhone.  Outstanding collaboration app for your iOS devices.  I wish Chatter functionality was built directly into the Mobile app above, but I understand that they are marketing to more customers than just CRM and want a standalone product.  CRM feels neglected.

Salesforce Mobile Dashboards – Fairly straightforward and to the point.  View your dashboards on a big screen on the iPad.  Great standalone app to prevent confusing executives!

Salesforce Mobile Dashboards

 

Dragon for Salesforce – Free standalone app to utilize the Voice to Text features provided by Dragon software.  Who really wants to type about their site visit or call log on their tiny mobile phone keyboard when they can just speak.  Pretty nice.

Dragon Salesforce Mobile

I’m very excited for Touch.Salesforce.com and the mobile capabilities that should hopefully spur from the usage of HTML5.

 

 


Tags: , , , ,
Posted in Chatter, Salesforce Mobile | Comments Off on Salesforce for iPhone and iPad

Salesforce for Android – Mobile App and Chatter

Written by ShamrockCRM on December 20, 2011 – 5:35 pm

Salesforce Android App

How did I seem to miss this news.  There is a Salesforce app for Android now?  It seems so.  But of course, in typical Salesforce style, it is released with minimal features.  It is read only with no edit/create capabilities, very similar to the iPhone Salesforce Viewer app.  C’mon Salesforce!  Try it out here.

In addition to that, Salesforce Chatter has been released for Android and looks pretty great on tablets if you happen to have one.  Looks like Salesforce is finally giving Android a little love.

Chatter Android


Tags: , , ,
Posted in Google, Salesforce Mobile | Comments Off on Salesforce for Android – Mobile App and Chatter

Salesforce.com to SMS

Written by ShamrockCRM on July 12, 2009 – 12:37 pm

Have you ever wanted to notify your sales people in the field of new Salesforce.com leads, immediately using SMS text messages? Well, this is not actually as hard as you would imagine.

Imagine that you have a call center accepting incoming phone calls, filling in certain bits of important data in a Salesforce.com Web 2 Lead form and generating leads in the system. This data routes to the appropriate Salesforce.com user based on Lead Auto Assignment rules. This is fine, but the person does not have the ability to check Salesforce.com for new Leads constantly and would like to be auto notified by SMS. This can be done using “SMS Gateways.”  SMS Gateways are email addresses assigned to cell phone numbers that allow you to Email text messages to Users.

What we do in this situation is, upon creation and auto assignment of the Lead, we will fire off a workflow rule in Salesforce.com to send an email alert. This email alert will go out to this SMS Gateway email address. You will either need to assign the User’s email as the gateway email or have some kind of trigger to auto query the SMS Gateway email and assign it to the Lead record for easy emailing with the Email alert. *I could always assist with this if interested.* Use an email template to include vital Lead fields, such as why they are contacting you, name and phone number.

Below is the information on how to find the appropriate SMS Gateway. This is assigned by carrier. Try it out by sending a test email to yours! Remember, you are limited to 160 characters.

Alltel
1234567890@message.alltel.com
AT&T (formerly Cingular)
1234567890@txt.att.net
Boost Mobile
1234567890@myboostmobile.com
Nextel (now Sprint Nextel)
1234567890@messaging.nextel.com
Sprint PCS (now Sprint Nextel)
1234567890@messaging.sprintpcs.com
T-Mobile
1234567890@tmomail.net
US Cellular
1234567890@email.uscc.net
Verizon
1234567890@vtext.com
Virgin Mobile USA
1234567890@vmobl.com

If you need the gateways for the smaller US companies or International companies, email me and I will provide them for you.


Tags: , , , , ,
Posted in Business Analysis, Salesforce.com, workflows | 1 Comment »