Nerd @ Work

When Salesforce is life!

Page 2 of 16

[Salesforce / Mobile] How to go mobile with Salesforce – Part 2

 
The second part of the guest post about Salesforce mobile adoption by our friend Barbora at Resco.net, who will analyze the issues to avoid when planning Salesforce mobile.

Barbora Piatrova (marketing specialist at Resco) takes her passion for digital marketing & Mobile CRM everywhere she goes. Currently, she’s involved in creating & mastering content strategy at resco.net – one of the leading companies in the world for Mobile CRM. She is now actively also discovering and participating in new thriving communities for Salesforce enthusiasts.


Issues to avoid when mobilizing your Salesforce data

Are you on edge when it comes to mobilizing Salesforce data to your users? Going mobile was never as easy as it is today. But is it secure and safe?

Well, it can be. If you choose the best possible scenario & set the right strategy. The goal is to get your sleek & robust Salesforce organization into phone and tablet – without losing the tools you know and prefer. And at the same time – gaining the productivity perks of native mobility as an extra.

Do you want to get your field reps prepped for a full-fledged mobile experience? Then be aware of the following issues. They cannot occur in your new application for Salesforce.

Integration & supported licenses

ISSUE: The app does not tie neatly into your Salesforce ecosystem and/or does not work with all the Salesforce licenses starting from the most basic one (Salesforce Essentials).

Platform availability

ISSUE: The app is not available on all major operating systems, for example it works only on iOS, Android, excluding Windows.

Security

ISSUE: Mobile data storage is protected, but only by user’s PIN. This means that if the user session (automatic logout after a few minutes) and app protection APIs are missing, the application and hence user data are not truly protected. All of this must be developed from the ground up. This requires complex engineering with a high risk attached to even a smallest oversight.

Offline syncing

ISSUE: The user is not able to determine what functions and formulas will operate when the app is being used offline.

ISSUE: The admin cannot regulate when and what is available for users to sync (manual & background sync, delayed publishes of Salesforce schema changes, etc.).

ISSUE: The app doesn’t allow sync of data when online for later offline backup or it syncs very slow in general.

Offline experience

ISSUE: The app is not reliable in offline mode, runs slowly and does not allow users to go offline for days without losing any of the previous work and data.

ISSUE: Admins and users can’t directly see how is the business logic mapped to the app execution.

ISSUE: When multiple users aren’t able to access, edit or change the same data offline.

ISSUE: Users are not able to configure offline datasets within the app or affiliated configuration tool.

Look ‘n feel to an end user

ISSUE: UI is not advanced and is out-of-date – the app lacks slick animations, static forms, sliding menus, interactive videos, scrolling text, interactive charts, tables, reports, and more.

Reputation & brand recognition

ISSUE: The app does not seem trustworthy, tested and proven. It doesn’t have the best reputation, bad ratings and reviews, customers that have bad experiences and do not recommend it.

Enterprise readiness

ISSUE: Your company purchases a mobile solution for Salesforce, but still doesn’t achieve the anticipated ROI. One of the reasons? It was simply not prepared for a change. Either you did not choose an app suitable for your business conditions or you did not set the right strategy, did not integrate it with your existing tools properly or did not involve your employees enough.

User adoption

ISSUE: The company does not involve users in any decision making processes, provide sufficient training, the app that doesn’t make their job any easier, because it is not easy to use, interactive and user friendly.

User tracking, audit and analytics

ISSUE: Admins are not able to track sales guys routes and locations during deployment to check compliance-GPS requirement. There is no on-site reporting or offline reports and alike features included in the app.

Flexibility in customizations & branding

ISSUE: It requires coding skills and it is not easy for a regular user to create custom objects, set rules and the functionality of objects. There are limited options to design the app for a company or even customer branding, limited object management for sales reps, and more.

Multimedia capturing

ISSUE: When all the data (photos, multimedia, geo-location services) are not captured locally. Data should be relevant to the app that is integrated with your device. It should not only enable you to capture, but to work with them – especially allow for real-time picture editing during visits and make it visible on the customer visit report.

Productivity

ISSUE: The productivity features have limitations or aren’t a part of the solution at all. Hence, the app doesn’t stress the functionalities to simplify the job of the remote workers. For example, users cannot update information on the go, and the mobile interface is not a simple action-based function, there is no easy access to notes or contact information. What else shouldn’t be missing? Contact import, calls, maps, email, push notifications, reminders, and similar.

Coverage

ISSUE: Losing connection with our product catalogue in the middle of a visit can be catastrophic and may even affect the relationship you have built with your customer. Therefore, you should be ready to always have the information available without depending on the cellular or internet connection.

Integrations

ISSUE: The more 3rd party tools and service integrations – the better. Companies increasingly demand more specific solutions to run their businesses smoother, easier and faster. If the app works as a single unit that does not efficiently communicate with external tools, it is not a suitable enterprise solution.

Language

ISSUE: Users do not have the opportunity to choose the app’s language according to the region/location, business unit or user role.

Price vs. App functionality

ISSUE: The app comes with one or more of the above-mentioned issues, and on top of that, it’s pricey? Then it may not be worth your time, money, and frustration.
If you want to mobilize Salesforce without having to run to any of such issues, here is a place to start: www.resco.net/salesforce.

[Salesforce / Mobile] How to go mobile with Salesforce – Part 1

 
A new high level guest blog about Salesforce mobile adoption by our friend Barbora at Resco.net, who will analyze the main problems and issues related to going mobile.
This is the part 1 of the article…stay tuned for the second part!

Barbora Piatrova (marketing specialist at Resco) takes her passion for digital marketing & Mobile CRM everywhere she goes. Currently, she’s involved in creating & mastering content strategy at resco.net – one of the leading companies in the world for Mobile CRM. She is now actively also discovering and participating in new thriving communities for Salesforce enthusiasts.


15 mobile native features to never forget when mobilizing your Salesforce data

Mobile led initiatives are transforming every business sphere. According to GSMA Intelligence, many mobile users exceeded 5 billion in March 2018. We get work done directly from phone or tablet. Various companies utilizing Salesforce love the ability of running their business while on-the-road.

Having access to all the Salesforce data via mobile device delivers a new kind of customer experience. This experience is of uttermost importance, especially for the companies that have large teams of sales & field service guys. Mobilizing Salesforce simply contributes to each sales and service rep’s productivity.

Mobilizing Salesforce for sales & field service

Mobile devices are built differently than desktop. On phones and tablets, native mobile apps use operating systems provided frameworks to lay out the UI. User interface is different with a native app than a web, and so is the user experience. And yet, you can still provide your field service & sales team with a unified experience with their Salesforce organization on any device.

How?

With an application that offers an ultimate mobile experience that is not weaker, nor poorer than the experience with desktop and fully integrates all your Salesforce desktop data. All of this with one application, without a need to download tens of 3rd party AppExchange apps.

Every Salesforce field user needs a complete CRM and customization capability available out-of-the box to their mobile device/tablet. A higher user adoption will only be achieved if an employee, customer or even partner gets to work with their Salesforce organization on phone/tablet as they know it. This way, they can do the majority of their business right in the field, plus take advantage of mobile-native features.

Salesforce experience + mobile-native features

What do we mean by saying ‘mobile-native features’?

Here is a list of productivity features to accelerate business process. What’s their biggest added value? You won’t find them within Salesforce desktop solution. However, everything you’ve been used to seeing and doing on your PC, you can find on your phone and more.

Imagine you had a mobile application with all your Salesforce data. And think of all the mobile-first functionalities that could simplify your work. Now, have you ever stumbled upon to what lengths could you take your Salesforce data if you had them in the palm of your hand? Just picture, you’d be able to benefit from:

  1. FULL OFFLINE ACCESS
    • access to anything anywhere without connectivity, even for days
    • continuous work with no interruptions, with no data loss
  2. GPS LOCATION and NAVIGATION
    • daily routes at a glance
    • all activities tracked with GPS coordinates
  3. ROUTE PLANNING
    • activities & routes planned on the map, distance calculation
    • user location and tracking
  4. PICTURE CAPTURING & EDITING
    • direct picture taking with built-in camera
    • photo editing (rotate, crop, highlight) on spot
  5. VOICE & VIDEO RECORDING
    • direct video documentation
    • voice recording attached to any Salesforce record
  6. BARCODE & QR CODE SCANNING
    • product information always available & quickly accessible
    • QR codes scanning to avoid manual link typing
  7. BUSINESS CARD SCANNING
    • text transcripts from a business card to a mobile device
    • faster creation of new contacts/leads
  8. PHONE CALLS FROM THE APP & CALL TRACKING
    • received, outgoing calls directly from the app for Salesforce
    • automatic call tracking

*Offline: Note, that rep on the go needs access to an entire CRM database, hence he/she needs true offline. True offline means a strongly encrypted local database on the device, and goes far beyond being able to scroll through the 15 most recently viewed (cached) contacts.

To name a few more, with advanced mobile solution, you can get:

  • CALL & SMS IMPORT, ADVANCED LOGIN (via fingerprint, NFC, QR code)
  • NATIVE APP ON ALL MOBILE PLATFORMS (iOS, Android, Windows)
  • SUPERIOR PERFORMANCE & RESPONSIVENESS
  • CONTACT IMPORT IN-THE-FIELD
  • FAST NOTE TAKING
  • PUSH NOTIFICATIONS

A holistic enterprise mobile strategy helps organizations and its field reps to have all the information in one place – to access, update, and interact with client data via mobile devices.

Mobile apps that integrate Salesforce data, allow its field users to: take action while on-the-go, speed up their operations and business thanks to a fast-mobile performance, and work with real-time sales/field service data. Working with accurate data helps reps sell smarter, find new opportunities faster, view and manage sales pipeline, be better prepared for meetings, responsive to customers, show the latest promotional offer, and more.

Curious where to find an all-in-one application that will smoothly integrate with Salesforce and help you enhance your business processes?
Reach out to mobile experts at [email protected].

[Salesforce / MuleSoft] My first Mule ESB flow

Another trailblazer joins Nerd at Work crew!
His name is Christian Tinghino and his first post is about a brand new addition to the Salesforce platform: MuleSoft.
He’s been helped by another awesome trailblazer, Ivano Guerini.

Christian Tinghino is a Senior Salesforce.com Developer at WebResults, part of Engineering Group.
He started working in 2012, moving his first steps on the Salesforce.com platform in 2014 coding in Apex and Visualforce.
Since 2015 he works in WebResults, fully focused on the development of managed packages and Lightning components.
As all enthusiast developers, he’s fascinated by innovative, challenging and strategic solutions. Owns two Salesforce.com certifications, writes blog posts on bugcoder.it, and saves the world from time to time.

Ivano Guerini is a Salesforce Senior Developer at Webresults, part of Engineering Group since 2015.
He started my career on Salesforce during his university studies and based his final thesis on it.
He’s passionate about technology and development, in his spare time he enjoys developing applications mainly on Node.js.


Few days ago the great news: Salesforce signed an agreement to acquire MuleSoft, a company that provides integration software (link).

SAN FRANCISCO, March 20, 2018 PRNewswire — Salesforce (NYSE: CRM), the global leader in CRM, and MuleSoft (NYSE: MULE), the provider of one of the world’s leading platforms for building application networks, have entered into a definitive agreement under which Salesforce will acquire MuleSoft for an enterprise value of approximately $6.5 billion.

As Salesforce.com developers and nerds we are excited by these news… so me and my colleague Ivano felt we had to take a look at Mule ESB 

Sample use case

For our tests, we want to migrate Salesforce accounts from an organization to another (Sf-to-Sf). Migrated records should dynamically receive the correct Record Type Id once in the destination org, in order to grant a correct mapping.

The flow should manage both existing and new accounts, inserting and updating records based on the presence in the destination org. For this reason, the support for the UPSERT operation is definitely a good thing.

Setup

Since we just want to evaluate the integration capability with Salesforce, we went with the on-premise Enterprise Edition (EE). This has a Salesforce connector that is not available in the Community Edition (CE). For the records, you can also choose a “Anypoint cloud” version.

Mule EE is delivered as Eclipse plugin, so you have to install the Java JDK, download and extract Eclipse. From eclipse, press Help > Install new software to add sites from that contain the runtime:

Some things never change: if you are/were a Java developer, you’ll feel comfortable with this procedure. Just install the EE runtime and Anypoint studio and you’re ready to create your Mule Project via the Eclipse interface.

When installed, a palette contains available components, connectors, transformers and so on. To use them you need to drag-and-drop it on the flow:

 Step 1 – Start flow

Mule works with flows: sets of components, transformers and connectors used to fulfil an “integration need”. Components can communicate passing payloads, reading/writing flow variables accessible by other components in the same flow. You can create custom components and transformers using Java, Javascript etc. A session context is also present, but stores variables and information beyond flows executions.

Always start from the beginning: how the flow starts?
For our test, we want to use the HTTP Listener connector to trigger the flow
http://localhost:8081/start-flow

To to this, drag the HTTP component at the beginning of the flow:

Step 2 – Retrieve origin accounts

Mule automatically connects “blocks” (components) in a flow sequence, so you just need to put a block after another to build your flow.

Drag the Salesforce connector after the HTTP Listener, so that we can query Accounts from the origin org.

To connect with the org, we need to define a configuration. The cool thing is that once a connection is configured, you can reference it just using the Name:

To query accounts from the origin org, set the Salesforce component to execute a query operation, you can be supported by a query builder tool:

Then, we assign the query result (the component payload) to a flow variable called originAccounts, using the Variable component:

Step 3 – Retrieve destination Record Types

Define a different Salesforce configuration to connect to the destination Org (as for the step 2).

Then, drag again the Salesforce component to query Account Record Types, and then store the result in a flow variable. The procedure is similar to the step 2.

Step 4 – Accounts transformation

Now we have to map different fields and apply the correct Record Type ID. We can accomplish this by using custom code and different languages.

Honestly, I had problems with Javascript because of some data type incompatibilities on Iterators. Anyway, everything worked as expected with Java, so I created a class called CustomTransformer:

The class should extend the Mule AbstractMessageTransformer class, and override the transformerMessage method, storing the result into a flow variable. For example, our flow puts the ExternalCode__c field into the ExternalId__c field, reset some fields and apply the new RecordTypeId

@Override
public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException {
 
   ConsumerIterator rts = (ConsumerIterator)message.getInvocationProperty("destinationRecordTypes");
   ConsumerIterator accs = (ConsumerIterator)message.getInvocationProperty("originAccounts");
 
   HashMap<Object,Object> rtMap = new HashMap<Object,Object>();
   while (rts != null && rts.hasNext()) {
     HashMap rt = rts.next();
     rtMap.put(rt.get("DeveloperName"), rt.get("Id"));
   }
 
   List newAccs = new ArrayList();
   while (accs != null && accs.hasNext()) {
     HashMap acc = accs.next();
     if(acc.containsKey("RecordType") && acc.get("RecordType") != null) {
       HashMap newAcc = new HashMap(acc);
       String devname = (String) ((HashMap)newAcc.get("RecordType")).get("DeveloperName");
       newAcc.put("Id", null);
       newAcc.put("RecordType", null);
       newAcc.put("ExternalId__c", newAcc.remove("ExternalCode__c"));
       newAcc.put("RecordTypeId", rtMap.get(devname));
       newAccs.add(newAcc);
     }
   }
   message.setInvocationProperty("destinationAccounts", newAccs);
   return newAccs;
}

Step 5 – Upsert accounts

We can now proceed with the upsert operation on the destination org. We can thus use the previously configured credentials to perform the Upsert operation, defining the external id field.

Then with a combination of Foreach and Logger components it is possible to parse and inspect the upsert result in the Mule console log. After that, a transformation into a String allows to print the result to the HTTP listener page. This is not mandatory, but allows us to see how the flow run.

Done!

The full flow should look like this:

You can run a local Mule instance by pressing the “run project” button in Eclipse. To execute the flow, just open the HTTP URL defined in the step 1 and look at the upsert result directly from your page!

This is an example:

[Salesforce / AppExchange series] BeeFree: responsive Email templates

This week’s new post is dedicated to a new AppExchange app, meant to give us an awesome edge in Salesforce and that is creating beautiful, responsive Email Templates with a simple drag-n-drop editor.

Thanks to our week’s guest blogger Jitender Padda.

Jitender is the founder of CodeJinn and also an avid Salesforce developer who is always looking for innovative ways to make our lives easier on Salesforce.


The Challenge – Designing Elegant Responsive Emails

When it comes to designing perfect, responsive emails one has to make sure that it runs smoothly on all devices and this requires a team of professional Designers to toil endlessly to ensure that they create the perfect email which provides a rich and soothing vision to your customers. After all, it is one of you’re primary modes of communication with you’re audience and it needs to be done just right!

The Native Solution – Salesforce Email Editor

Let’s face the truth, even though we voted on this idea to have an improved email editor more than 1000 times, we still haven’t gotten what we would expect from a modern email editor. And now with the new Salesforce Marketing cloud, which does offer an enhanced native Email editor, it is highly unlikely we will see something like a drag-n-drop editor in our Sales Cloud or other Salesforce products. And thus we are forced to use custom HTML or visualforce which is quite time consuming and requires some technical knowledge.

Our Solution – BeeFree to the rescue

BeeFree is actually a third party app offered by MailUp. It provides you the easiest, quickest way to design elegant, mobile responsive emails. All we did was integrate it with Salesforce and now all you need to do is install the app and in a few simple steps all of you’re users (no coding required) can get access to the editor which will allow them to quickly create an awesome looking email template. Once you’re done, you can now use it with workflows, mass emails or however you like! And best of all, as the name implies, it’s free 🙂

Features

  1. It features a drag-and-drop interface that enables anyone to create a beautiful email message.
  2. It creates emails that adapt automatically to small screens, such as that of a smartphone.
  3. Once the message has been created, you can be preview, test, and save it as a custom email template.
  4. It allows you to access Merge fields inside the Editor.
  5. Save Special Links to be used directly by dragging them in to the Editor
  6. You can use BeeFree Email templates with Mass Emails.

Here is the link – https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000E1lGQUAZ and just so you know, we are currently in the middle of the Security Review process so we should be listed publicly soon. And this one is for the community, thank you for you’re awesome reviews, it keeps us going 🙂

[Salesforce / API] Bulk API 2.0 quick & dirty!

I introduce you our week’s trailblazer Claudio Marzorati.

Claudio is a Salesforce Developer @ PwC Italy (Milan) with 2 years of experience. He worked with different retails that allowed him to increase his technical background on several aspects.
From analysis, to development, to the direct relationship with the customer, nothing is left to chance.
Other passions are running and travels!

Enjoy his quick & dirty post about Bulk API 2.0.


Since the introduction in the Winter ’18 (API version 41.0), managing bulk transactions became easier (official documentation here).

The flow to manage a job became quicker with less steps to process the set of records. To better understand the main features, here is an overview of the process for creating and managing a job with Bulk API 1.0.

If you work with few records, you won’t have many problems, but with large amount of data…it’s another story!

Working with API 1.0 means that you will follow many steps to achieve the goal.

At first you have to authenticate yourself against Salesforce to obtain a valid session ID, e.g. using SOAP APIs.

Next important thing you have to consider is that you need to pre-process your data to create N separated batches, because in this version you haven’t an automatic process that analyze and slice the data.

Here are the main manual operations:

  1. Divide the data not to reach the batch size limit
  2. In each batch there can’t be concurrent operations that can lock a record
  3. Need to customize the header with compression or PK Chunking

You can spend a lot of time on step 2, but unlikely in Bulk API 1.0, in Bulk API 2.0 all you have to do is to upload your data and Salesforce worries about all pre-processing.

With Bulk API 2.0 you have to specify few simple steps and your job will be processed.

Below I report a simple schema with all the API 2.0 available. (The dashed component are optional and you can skip them)

I’ll provide you a quick example to start learning to use Bulk API 2.0.

We always start with a:

URL:
    https://{instance}.salesforce.com/services/oauth2/token?grant_type=password&client_id={client_id}
    &client_secret={client_secret}&username={user}&password={password+SecurityToken}

METHOD:   
    POST

To get more insights of how to get all the pieces of the call, refer to this blog post (search for OAuth Password Flow).

The response gives you the access_token (known as session id) that you need in all subsequent Bulk API 2.0 calls and the instance_url to call against:

{
  "access_token":"00D6E0000000xxx!ARIAQL7GNMpk...",
  "instance_url": "https://cs85.salesforce.com",
  "id": "https://test.salesforce.com/id/00D6E0000000XXXXXX/0056E000002LXXXXXXX",
  "token_type": "Bearer",
  "issued_at": "1520445583894",
  "signature": "rHVTsVcvZkrogMNNzxH7GpfKFlkGIHGLySS/jsVhhWc=
}

Let’s create a Job:

URL:   
   https://{instance}.salesforce.com/services/data/41.0/jobs/ingest

METHOD:   
   POST

HEADERS:   
   Content-Type: text/csv
   Authorization:Bearer {session_id}

BODY
{

  "columnDelimiter" : "COMMA",  Optional
  "externalIdFieldName": "",  Required for upsert operations
  "lineEnding": "CRLF",  Optional
  "operation": "upsert",  Required
  "object": "Account",  Required
  "contentType": "csv"     Optional
}

The response gives you back the Salesforce ID of the new batch and other configurations details:

{
   "id": "7500Y000009MxxXQAS",
   ...
}

Now put your data inside the job, paying attention to the schema/format previously defined (separator and line ending):

URL:   
   https://{instance}.salesforce.com/services/data/41.0/jobs/ingest/{jobID}/batches

METHOD:  
   PUT

HEADERS:   
   Content-Type: text/csv
   Authorization:Bearer {session_id}

BODY
   your csv input

The response has status code 201 Created if the data is compliant with the specified job configuration.

When your data is fully uploaded you can finally close your job:

URL:   
   https://{instance}.salesforce.com/services/data/41.0/jobs/ingest/{jobID}

METHOD:  
   PATCH

HEADERS:   
   Content-Type: text/csv
   Authorization:Bearer {session_id}

BODY
   {
      "state" : "UploadComplete"
   }

From now on your job will be processed, depending on your org’s queue.

If you want to check succesfull, failed or unprocessed records you can use this call:

URL:  
    https://{instance}.salesforce.com/services/async/41.0/job/{job_id}/{successfulResults|failedResults|unprocessedRecords}/

METHOD:  
   GET

HEADERS:   
   Authorization:Bearer {session_id}

The response will show the record of the csv in the requested state.

As shown Bulk API 2.0 highly simplifies the creation of bulk jobs…now it’s your turn to experiment these new APIs!

[Salesforce / Apex] Forceea data factory framework: a new approach to an old problem

This week’s guest post is a cool technical post about Apex Tests by Nikos Mitrakis.

Apex Tests are perceived as the hated necessity by most Salesforce developers: they are really important to keep high code quality levels but they are not the most fun part of coding with Salesforce.

I casually discovered Nikos through his GitHub page: I had a read at this Forceea Apex Test Framework, and I asked him to write a post to describe this cool piece of Salesforce tech.

Nikos has started his Salesforce journey in 2014. He started with Salesforce as a hobby (which still remains) and his wife continously threatens him with divorce if he doesn’t stop playing with his various Orgs all the time.
He has a Physics degree, a Microsoft SQL Server BI certification and a few Salesforce certifications. He likes writing code and discoverig how huge the Salesforce ecosystem is. He adores talking about his personal projects, he likes good sci-fi films, he’s been working with a Mac for more than a year, and he started the Salesforce Developer Group in Greece in 2016 (admittedly without much success).
Nikos is working as a Salesforce Developer at the Johnson & Johnson EMEA Development Center in Ireland. If he wasn’t a Salesforce Developer, he’d like to be a Developer in Salesforce.


What is a Data Factory?

Generally speaking, a Data Factory is a set of tools that generate and insert data. It’s very important when you develop a test method in an Apex Test Class, since you usually have to insert records to complete the testing. Using a Data Factory you make your life easier and your work more productive!

A Data Factory is also required when you want to test a report, a trigger/class or another process under Large Data Volumes (e.g. how fast is our report when there are 1 million records?), for User Acceptance testing (UAT), and for training – when you don’t want to create a Full Sandbox or when you want to create data which don’t exist in the production system yet.

What is Forceea and how I can install it?

Forceea (forˈsēa) is a data factory framework for Salesforce and an open source project (https://github.com/nmitrakis/Forceea) in GitHub. It’s a framework, because it gives the programmatic tools for a developer (or administrator, why not?) to easily generate, insert and delete SObject records.

“Yet another data factory?” you may say. Well, not at all!

But first let’s see how you install it.

When you download the files, your installation depends on your preference: classic metadata or DX? For the first option, you may want use the Ant (the build files are included) or the CLI, for example with

sfdx force:mdapi:deploy -u <OrgAlias> -d <folder> -w 5).

For DX, I suggest the CLI, using the command

 sfdx force:source:push -u <OrgAlias>

How can I generate the data I want?

OK, you have installed the framework. Now what?

I think the better way to understand how it works is by example: suppose you want to insert 100 Opportunity records and in your Org the Opportunity object has the additional required custom field MyField__c (which is a lookup to the custom object MyObject__c). Of course the Opportunity has its own required fields (like Stage).

The first step is to create an FObject:

FObject myObj = new FObject(Opportunity, 100);

Next, you declare the field definitions. A field definition uses a descriptive “language” to define what kind of data you want to create for this particular field. This language is called SDDL (Sample Data Definition Language). Don’t be afraid! It’s not a new programming language and it’s very easy to learn.

Let’s start with the first field you want to define, which is the Record Type (API name: RecordTypeId). Do you want your records to have a specific record type (let’s say BigDeal)? Then give this field definition:

myObj.setDefinition('RecordTypeId', 'static value(BigDeal)');

static here is the command and value is the parameter. The static command creates (what else?) static values, that is values which are the same in every record you create.

Do you want a random record type? Then you need the following definition:

obj.setDefinition('RecordTypeId', 'random type(picklist)');

The random command does exactly what you understood, it’s a really powerful command and you can even decide that every time you get the same (but random) data!

But wait! I hear you saying that the Record Type field is not a picklist field, and of course you’re right (it’s a Lookup)! Forceea handles this “special” field as a picklist field, making things easier for you. Say “Thank you 4ca”..

So, we move to our next field, which is the Close Date (API name CloseDate). This has a Date type, and let’s suppose you want it to have random Date values from this year:

myObj.setDefinition('CloseDate', 'random type(date) from(2018-01-01) to(2018-12-31)');

The type parameter is the boss here – it defines what kind of data you get. Give type(Boolean) and you get random True/False values. Give type(phone) and you have random phone numbers, etc

The Amount is a currency, so you decide to take random values from 100,000 to 1,000,000 and round these values to the nearest thousand. Difficult? No, it’s very easy!

myObj.setDefinition('Amount', 'random type(number) from(100000) to(1000000) scale(-3)');

Every opportunity that respect’s itself should have an Account, so you decide that the AccountId field will take an ID from any random Account, but you’ll get accounts without two specific Industry values. You asked for it, you get it:

myObj.setDefinition('AccountId', 'random lookup(Account) field(Industry) except(Banking,Chemicals) source(forceea)

I think the above definition needs some clarifications. The lookup(Account) instructs the framework to fetch records from the Account object and the field(Industry) except(…) to get only records for which the Industry field has any value except “Banking” and “Chemicals”.

But what is source(forceea)? This parameter defines the “source” of the lookup object’s records:

  • If it’s source(salesforce), the framework will query the Salesforce database and get the lookup records.
  • If it’s source(forceea) and the lookup object has been previously created (in the same context/transaction), it gets the records from there (which of course is much faster).
  • If it’s source(forceea) and the lookup object hasn’t been created (or the records have been inserted and deleted), it inserts some records of this lookup object.

Now that you have the opportunity account, don’t forget the opportunity Name (API name Name). Let’ say you want it to have the format <AccountName> – Opportunity for <Random text (with words) from 15 to 30 chars>

So, what is our definition? Well, we don’t have one, but 3 definitions to deliver this:

myObj.setDefinition('Name', 'copy field(AccountId) from(Account.Name)');

This definition gets the Name of the related account.

myObj.setDefinition('Name', 'static value(" – Opportunity for ")');

As you see, this is just a simple text value.

myObj.setDefinition('Name', 'random type(text) minlength(15) maxlength(30)');

And finally, we get our random text with “Latinoid” random words, like “Partem inermis ius impedit eam”

Keep in mind that with the random type(text) definition, the first character of the text is always a capital and the same word is never repeated twice in a row.

Your next field is Lead Source (which is a picklist field with the API name LeadSource), and here you want to have any declared picklist value except from “Partner” and “Other”:

myObj.setDefinition('LeadSource', 'random type(picklist) except(Partner, Other)');

If you wanted these two values only, you could give the definition:

myObj.setDefinition('LeadSource', 'random type(list) value(Partner, Other)');

or if you needed just a specific picklist value:

myObj.setDefinition('LeadSource', 'static value(Partner)');

Now you’ve finished with your field definitions, but remember that we haven’t defined all required fields (like Stage or myField__c). Of course you don’t have to worry about that, because the framework automatically identifies and defines all required fields. There are specific rules for setting the suitable field definition, but (without going to many details) we could briefly say that the field definition for a required field depends on the field data type, the SObject and the field name. So, after defining your fields, Forceea will define all required fields you didn’t define, like Stage or myField__c.

If you need to make some changes in the created records (for example to update a field with some complex calculations), you can get the opportunities with:

List<Opportunity> myRecords = (List<Opportunity>) myObj.getRecords();

Then do your changes, e.g.

for (Opportunity objRecord : myRecords) {
 objRecord.Amount = … // your changes here
}

and just insert the amended records with

myObj.insertRecords(true);

Forceea has many other field definitions, to create random real first and last names (with male and female names), real postal addresses (address, city, postal code, state, country), URLs, email addresses, phone numbers, Boolean values and Datetime values. And don’t forget that it supports BLOBs (e.g. to create email attachments).

It also provides definitions with the serial command (e.g. serial type(number) from(1) step(1.5) scale(2)) to create serial integer, decimal, currency, percentage, date and datetime values.

As you understand, there are many methods to

  • get or delete field definitions
  • create records from a specific serial number (very useful when you insert records with the serial command in different transactions)
  • insert records in groups (a valuable tool for your test methods)
  • define the Verbose mode (how many debug logs you get)
  • get the errors (yes, there is a detailed error system)

The framework handles field dependencies (dependent picklists) and it protects you from doing errors like defining the wrong definition for a specific field data type or defining multiple definitions for a field (e.g. Date) which can have only one.

How can I see the framework’s messages?

Forceea doesn’t have a UI (for the moment). The framework uses Debug Log to post its messages, which show

  • The errors during the process
  • The process milestones completed
  • The data of the first created records

Here is a sample output, just to get an idea of what this looks like (please note that the field definitions in this sample are not the field definitions you used previously).Keep in mind that you have many options to reduce the quantity of logs, for example to get almost nothing on a production system (which by the way is accomplished using a Custom Metadata type).

What’s next?

When you use Forceea in a test method, you really don’t need to create many records, so the 10,000ms CPU limit isn’t an actual problem. Of course you can use the framework to insert records in a sandbox or developer Org when you execute an Apex script in the Anonymous Windows, which of course has the same 10,000ms limit. But when you want to populate a sandbox with 1,000,000 of Accounts, this is another story..

This story is a major part of the next upcoming release (v1.3). The functionality is called Async, it can insert or delete many objects in one transaction, and when you insert objects or delete 1 object it’s surprisingly fast! I have inserted 500,000 of a custom object (without any validation rules, triggers, processes, etc) in 40s! Of course its speed mainly depends on the triggers, etc you have in your actual Org, which may slow down the process significantly (that’s life..)

Anything else?

Yes! I invite everyone to have a look at the detailed User Guide (http://bit.ly/Forceea12_UserGuide) and try the framework.

And I’d like to say a big THANKS to Enrico for hosting this post.

[AppExchange series / Salesforce] Field Dumper – Extract Data Model to Excel

 
This week’s guest post has been written by the guys from P0P, who just made a simple yet really usefull app to extract your org’s metadata.

P0P is a new Scottish software house focused on delivering admin focused Salesforce Apps that make working with Salesforce that a bit easier.  Field Dumper is their first AppExchange offering and was released in November 2017.


Thanks to Enrico for allowing us to introduce to you our ‘Field Dumper‘ application.
Available for free on the AppExchange, it’s a simple and quick tool that allows you to easily extract your Salesforce data model into an Excel workbook.

Background

Simple really – Schema information is available within Salesforce but it is scattered over multiple different pages and it can be time consuming  to navigate, collate and analyse.

That information can be much easier to work with once extracted to Excel.

Sure, for the developer and administrator there are other tools that can access this metadata (workbench, IDE plugins etc) but having a single document can be handy.
It is a great reference for a whole range of different tasks – getting the field api names when writing SOQL, for spell checking help text or for helping with problem analysis for example.

Frequently either non-Salesforce or less technical Salesforce users require visibility of the data model – integrators, business analysts, auditors, reviewers, documentors – and this is a great way of providing a quick offline snap-shot document for them.

Information is simple to access with each object displayed on a separate Excel Sheet within the workbook.   Multiple standard and custom objects can be extracted into one workbook.  Field API names, field labels, help text and field types are just a scroll or search away and Excel is already a tool these users are comfortable using.

Challenges

A simple concept, but we hope that we executed it well – some thought had to be put into the implementation and design.

A single Workbook:

Outputting multiple separate excel files for each object would just complicate and confuse things so coding effort was put into outputting a single multisheet excel workbook, having a separate sheet / tab for each object.  The solution required visualforce renderAs outputting a xml formatted document rather than the more well known contentType="application/vnd.ms-excel#SalesForceExport.xls"

Large Orgs and Salesforce Limits:

Effort needed to be spent to ensure the app worked for the largest of Salesforce orgs.  An Unlimited edition org can have 2000 custom objects, each with 800 custom field.  There are also over 400 standard object in an org.  The volume of text in help and formula fields can vary.  The app is not artificially restricted to the number of objects that can be exported but we do have to work within Salesforce limits.

It is intensive to collect metadata and produce an output document.  Schema describe calls are used for each object and then looped to list out each field.
The fields output include Name, API Name, Type (text, datetime, lookup etc), Formula Text, Help Text, Size and optionally Picklist values.

With potentially high volumes of meta data, it is impossible, even following best practices, to extract everything to one massive spreadsheet without breaching various Salesforce limits (and the spreadsheet would be unwieldy too).
In benchmark testing we were able to use the app to extract upto 150 objects to a single file but you mileage may vary.

A input interface was built featuring a multi-picklist interface to allow the user to select the specific custom or standard objects they require to export.
If limits are hit, a smaller set of objects can be selected.  If a user has a really big schema they could chunk it to produce multiple extracts.

We thought the focus would be on exporting the common standard objects you could add custom fields to and your custom objects, but after some early feedback, we added an option on the UI to allow object selection from all of the standard objects too.

Reception

We were not sure what the uptake or reception of the application when we launched at the end of 2017 would be, but we have been pleasantly surprised.    We have had several really nice 5 star reviews and great feedback and we are glad that we have been able to supply a tool that has been useful to a wide variety of Salesforce end users.  Thanks to all our downloaders and reviewers.

Please check it out for Free Data Dumper on the AppExchange and let us know what you think!  Thanks for you support.

 

 

 

[Salesforce / Ohana Community Italia] Part 1: Salesforce Community on Slack workspace

For those of you who has no idea of what the Ohana Community Italia is, please refer to this post I wrote in the late December 2017.

Long story short, we are building our own nation wide Salesforce community…

This is a handy GitHub repository with all the code needed to follow this article.

I want to document the build of this community, in terms of all the actions we’ll take to create all the little pieces.

Hopefully, we’ll create a public repository with all the code and stuff, so anyone could create what we are doing!

The Community

The idea is to build a Salesforce Community inside a dedicated ORG in order to easy communication and sharing of ideas between italian trailblazers.

Thanks to Nino Guarnacci, our amazing sponsor from Salesforce Italy, we have a dedicated Salesforce DE ORG with all the necessary licenses.

This requires to:

  • choose the best Salesforce Community for our needs
  • configure all the features of the community
  • create a registration page
  • cover of the base topics for the start up

This is not a simple task, I don’t mean technically, but in terms of time.

That’s why we decided at first to freeze the building of the community in a Salesforce ORG (that is actually been built on the background) and speed up the process of putting together people using a more common and well known tool, configuring a Slack workspace.

At the time of writing the Ohana Community Italia is live at italia.ohana.community and its topics are publicly available, although it’s been constantly improved day by day (let’s say we are on Beta).

ohana-community-italy.slack.com

Slack is a great tool for collaboration and it seemed a cool way to start.

That’s why we created the Ohana Community Italy Slack workspace.

The configuration of the workspace is quite simple, we have administrators and users, with different powers (it depends on how much power you want to give to your users):

But how do you get on the Slack community?

We decided to leave the invitation private at first.

Invitation happens in 2 ways:

  • Direct invitation by an admin
  • Form compilation of an invitation request

Web-To-Case invitation form

The idea is to create a new Case when a new trailblazer wants to join, using the web-to-lead feature (a pretty standard feature), that automatically generates a Case from a web form, exposed pubblicly on a Force.com site.

We took the auto-generated HTML form from the Salesforce setup and customized it based on our needs:

There is no need to enter in the details of this configuration, as there is plenty of stuff out there (Salesforce docs enter in enough details to get started).

Refer to the Subscribe.page on the repository.

Send invitation to Slack

And now?

Someone must send an email to invite the person who succesfully created a new Case on the ORG.

For the first times of the life of the Slack community we are handling this by hand, but we should soon automate this in a Case trigger (TO DO).

To send invitation links to specific email addresses we need:

      A Slack app linked to your slack workspace
      A page in the Case layout with a button to make the call
      The right REST commands to trigger the invitation email

Create a Slack App

Jump to https://api.slack.com/apps:

Create a new app and link it to a workspace (in this example I’m using my own personal Slack instance):

Espand Add features and functionality section and hit Permissions. Scroll down and add the Admin scope:

Now that you have at least one scope, you can install the app on your workspace:

Last thing to do, is generate a quick and dirty legacy token with full super powers on https://api.slack.com/custom-integrations/legacy-tokens:

Copy this token for next configuration.

A button to invite them all

A new VF page will be put inside the Case using the layout editor.
Refer to the OhanaCommunityInvitation.page on the repository.

This page simply takes a case (of a certain Record Type, Community_Management), and by pressing the Invite to Slack button makes a call to Slack to actually send the invitation email.

Take the SlackUtils class and update the oauthToken property placing the OAuth Slack legacy token generated in the previous section:

public class SlackUtils {
    /*
     * OAuth token for admin tasks took from https://api.slack.com/custom-integrations/legacy-tokens
     * TODO: replace with Custom Setting or Oauth Call
     */
    public static String oauthToken{
        get{
            return 'xoxp-XXXXXXX-XXXXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXX';
        }
    }

This class contains the main actions will be using for communicate with Slack.

You also need to enable the Slack API endpoint, you can easily do it using a Named Credential:

The invitation email is not a documented REST method, but I found a solution in Stack Overflow thread.

If the invitation is sent sucessfully, the case is automatically closed.
If the case is closed you still have a chance to re-send the email, using the resend=true parameter to the call.

Slack bot says: “Hey there’s a Case awaiting for an invitation!”

Invitation are not currently sent automatically, so we need a way to notify the administrators of the community so they can push the button (before you say a word…I know this is not the most comfortable flow).

We’ve built a scheduled Apex process that sends a notification every morning in a specific Slack channel: although this is not so comfortable, I admit I wanted to do this to write something with a bot from Salesforce to Slack!

The code is in the NotifyNewUsersOnSlackSch class and you should update the ohanaServiceChannel property to change the channel name.
In the SlackUtils class you can also change the Bot name and icon (the URL must be available pubblicly).

What’s next

Next steps are enable automatic Slack invitations on Case creation (the job is needed in case of errors or connection problems) and finally publish the Salesforce Community…but it is another story!

Remember to star the GitHub repository with all the code needed to follow this article.

Join the Ohana Community Italia, but you should at least say Hello in Italian!

New year, new style (⌐■_■)

Welcome to the new Nerd at Work!


It took me 5 years but finally this blog has been completely rebranded and moved to WordPress.

I thank Davide D’Annibale for helping me customizing this theme and drawing the funny graphics (with my BIG face).

Yes, that’s so…my face is supposed to be the main logo of the blog

My Big Face

Funny, uh?

Uncomfortable? Quite, I know…

I can’t wait to read your opinions about this and any suggestion to make this blog awesomer!

I also want to thank the great trailblazers who help me by writing amazing and original guest posts: hope this page will contains tens of people!

Do you want to be a guest blogger for Nerd at Work?

Contact me!

Last, the sponsors page will contain the sponsors of this blog, who will help me to keep this blog up and running!

Do you want to be a sponsor of Nerd at Work?

Contact me to see your awesome company/app on the main page!

Remember to subscribe from the sidebar form!

New posts on the next weeks! Keep enjoying!

[Salesforce / AppExchange Series] Streamline Project Management with Cloud Coach Milestones

This week’s AppExchange hero is Brandi Johson, marketing consultant at Cloud Coach, who is going to present us Cloud Coach Milestones, the ideal tool for simple task and project management on the Salesforce platform.

Brandi Johnson is a marketing consultant and certified Salesforce admin. She focuses on helping clients create effective marketing strategies and leverage the right marketing technology to meet their unique business needs.

Cloud Coach specializes in enterprise-class project, PSA & PPM software built for businesses that want to make strategic investments in their success. With our unique four-tier approach to project management solutions, as your business grows, Cloud Coach can grow with you. Learn more at CloudCoach.com.

Wouldn’t it be nice if everything you had to do at work was easy?
Then they may not have to call it work!
As businesses grow, the challenges they face get more complex – especially when it comes to working with your team to accomplish your goals.

One critical example of this is new customer onboarding.
Whether you’re in SaaS, professional services, or manufacturing, having a streamlined customer onboarding program is vital to your success.
A strong customer onboarding program helps you increase customer satisfaction and reduce churn. Plus, it reduces the stress on your team as they’re moving through the process.

Let’s take a look at Serenity Software – a B2B SaaS company. They’ve nailed their sales process leveraging Salesforce. But once a new customer signs on, the wheels start to come off the process. Emails fly back and forth between the account executive and customer support team trying to track down the details needed and sharing status updates.

The customer success manager keeps shared spreadsheets for each of the clients that they’re working with.

Unfortunately, the team isn’t great about keeping them up-to-date with status updates – leading, of course – to more emails.
They also tried using Trello to keep track of their projects, but they had the same problems: nobody wanted to log into yet another system to see what they needed to work on or post status updates.

Finally, the customer success manager discovered Cloud Coach Milestones in the Salesforce AppExchange. In minutes, she was able to start organizing her customer onboarding projects and increasing collaboration with her team.

She started by creating a template from the spreadsheet she had been using. It was easy to add additional details to each task using subtasks, and assign the work out to her team. Plus, Cloud Coach Milestones put everything into an easy-to-use Gantt chart so she can see at a glance how long everything each tasks takes, and when things are running behind.

Serenity Software took streamlining their projects a step further, and leveraged Salesforce Process Builder to automate their project creation.

Now, whenever an opportunity is marked as Closed-Won, a new project is automatically created leveraging the template the Customer Success Manager created.

Those new projects are automatically connected to the account, so everyone has a 360° view of the customer and the project while its in-progress.

With Cloud Coach Milestones, Serenity Software streamlined their project management processes.

They have happier clients, faster onboarding, and better team communication.

Since all of their projects are in Salesforce where they’re already managing the rest of their business, they can see all of their important business KPIs on centralized dashboards.

No data imports, no APIs.

Could Cloud Coach Milestones work for your business?

If you run projects, then yes, it could.

Plus, you can get started in less than 10 minutes.

Step 1: Install Cloud Coach Milestones from the Salesforce AppExchange. Of course, we recommend installing into your Sandbox, not your production org.

Step 2: Check out the getting started videos. When you visit the Cloud Coach Milestones App, you’ll see a tab for “Getting Started.” These videos give you a great overview of Cloud Coach Milestones in action, and help you answer a ton of questions before they get asked.

Step 3: Create a project. Before you start sharing Cloud Coach Milestones with your team or customizing, I recommend that you build your own simple project. This helps you see how Cloud Coach Milestones works out of the box so you can make better choices about integration and customization.

Step 4: Customize your projects. Since Cloud Coach Milestones is built on the Salesforce platform, you can do a lot of customization on your projects to meet your business needs. For example, you may want a field to identify what type of project your team is doing for a client. Choices would be onboarding, maintenance, or special request. By adding a field on the project object, you can add this customization in minutes.

Step 5: Integrate with your existing objects and processes. Out of the box, Cloud Coach Milestones has lookup relationships to Opportunities, Accounts, Cases, and Campaigns. To associate projects with another object (custom or standard), create a new custom lookup field that points to the Cloud Coach Milestones object. Then, add the Milestones related list the page layout, and any projects you launch from that list will be visible on the project.

With Process Builder, you can automatically create projects from your business best-practice templates. The Cloud Coach Milestones Knowledge Base has details on how to autocreate projects with Cloud Coach Milestones and lots more.

Step 6: Assign permission sets to the users that need access to Cloud Coach Milestones. There is no limit to the number of users within your org who can use Milestones. Just like everything else about Cloud Coach Milestones, security was designed with simplicity in mind. There are only two permission sets you need to work with:

  • CCMI | Minimum User Permissions – grants a user access to all standard Milestones functionality and views. A user with this permission set assigned can create their own projects, view projects that aren’t their own, and manage their tasks and projects.
  • CCMI | Admin Permissions – permits exactly the same functionality but also includes the ability to load sample data. This is useful for Partners or Users who need to demo or test the product but do not want to spend time creating sample projects.

You’re never alone when you’re working with Cloud Coach Milestones. In addition to the extensive knowledge base that’s growing every week, we offer a free 30-minute onboarding consultation for new installs, and weekly open forum webinars to answer your questions.

Ready to get started with Cloud Coach Milestones? Just head over to the Salesforce AppExchange and click “Get It Now” to get started!

And it’s available on Salesforce Lightning and Classic!

Page 2 of 16

Powered by WordPress & Theme by Anders Norén