GithubHelp home page GithubHelp logo

pombredanne / sf-user-license-analyzer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martyychang/sf-user-license-analyzer

0.0 1.0 0.0 160 KB

Create a matrix of allowed changes from one user license to another

Ruby 100.00%

sf-user-license-analyzer's Introduction

Note from the author

Please let me know if you run the scripts and produce new results, so that we can confirm the validity of what I originally published. It would be great if you can also share any contradictions or different results that you encounter, so that the Salesforce community can always have an accurate and up-to-date reference for managing user licenses.

How do I use the scripts?

Prerequisites

You should be comfortable with:

  • Downloading files
  • Creating and editing .csv files
  • Running commands in the Command Prompt (Windows) or the shell (*nix)

You'll also need to have on your computer:

  • A Salesforce org that allows you to create (not deploy) Apex. Typically this means a sandbox org or a Developer Edition org.
  • Ruby. If you're on Windows, make life simple and run RailsInstaller.
  • Nokogiri for Ruby
  • The scripts. Easiest way is to just download this repo as a .zip file and extract it to your computer

Step 1. List all licenses available to you for testing

The ruby folder contains a sample UserLicense.csv file, which should list every user license available in your org to use for testing. To avoid errors, you should generate this list from your org using SOQL.

SELECT Name FROM UserLicense ORDER BY Name

Make sure you leave the Name column header in the UserLicense.csv file. The script assumes that this header is present and will skip the first row when executing.

Step 2. Create profiles in your org for testing purposes

TIP: All of the test profiles created have names that begin with "ApexUnit". If this will conflict with a real naming convention in your org, please abort this exercise.

Since you can't actually create profiles in Apex tests (at least in Winter '14 and API 29.0), you will need to create real profiles that will only be used for testing purposes.

This part should be pretty painless:

  1. Launch a command line interface (e.g., Command Prompt, Terminal)
  2. Change to the ruby folder for this project
  3. > ruby create_new_profiles_package.rb
  4. Log into Workbench. You can skip this step and use any other Metadata API-compatible deployment tool if you want, but these instructions are written assuming you will use Workbench.
  5. Hover over the migration nav header, then click Deploy
  6. Select the "ApexUnit Profiles Package __.zip" file that was generated by the script, which should be in the same ruby folder
  7. Mark these checkboxes: Rollback On Error; Single Package; Run All Tests
  8. Click Next, then click Deploy

Step 3. Run the test and save the test log

TIP: As noted as a prerequisite, you must be able to create Apex in your org, because the test class used here cannot be deployed to a production org.

  1. Create a UserLicenseTest Apex class in your org, using the code from the src/classes/UserLicenseTest.class file
  2. Open the Developer Console in Salesforce
  3. Run the tests contained in the UserLicenseTest class
  4. Open the test results and download the log file

Step 4. Create a CSV file of the results

You're almost done! This last part is a bit tedious but manageable.

  1. Open the log file
  2. Find the USER_DEBUG line that contains the raw CSV output of the results
  3. Copy all of the raw CSV output, then paste it into a new text file
  4. Save the text file as a .csv file
  5. Open the .csv file in Excel, pretty it up, and distribute!

Again, if you do succeed in running this script in your org, many people will appreciate your sharing the results back with the community.

sf-user-license-analyzer's People

Contributors

martyychang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.