When Salesforce is life!

Month: March 2018

[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!

Powered by WordPress & Theme by Anders Norén