Modify multiple profiles in Salesforce

by Niklas Waller on January 26, 2012

in Salesforce

When you are working with profiles and access rights in a Salesforce organization or when you are developing new functionality or modifying existing, you will sooner or later need to modify the profiles.

Example:
Assume you have created new functionality which includes a new custom object. You will need to give the profiles access to this new object.

If you have a large organization there could be quite a lot of profiles. So start by creating a profile view that lists the profile settings that you want to modify. See this post for more info on how to do that.

So let’s look at the same screen shot as in the referred post.

Create profile view

 

Let’s say want to modify the delete access for all custom profiles

1. Start by selecting the check boxes for the custom profiles.

2. Then double-click in the column “Opportunity: Delete” in any of the selected rows.

3. You will see this screen

Modify profiles settings
The check box “Opportunity: Delete” is unchecked since this is what we want to do. In the middle you see what this change means, i.e. settings that will be disabled as a consequence.

At the bottom you can choose to perform the action for the row that you clicked on only or check “All 3 selected records” to perform the action on all custom profiles.

You will be redirected back to the profile view and can instantly see that the custom profiles have lost their delete access to the Opportunity object.

I have written about this before, but I think this is more detailed and easier to read.

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

Mafia prohibition theme for the party

by Sven R. Ohlson on January 24, 2012

in Illustration

Maffia and prohibition theme for your party

The other week I made a few sketches for an invitation to a party. The theme was prohibition and mafia from the 1930:ties. The dress-code – had to be something from that era. To inspire the guests I did a few sketches of clothes and look from that time. Here a male in a suit and hat.

Party on!

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

Winter in Nyckelviken

by Niklas Waller on January 22, 2012

in Photography

Winter in Nyckelviken

It’s really nice to take those walk in the winter when there is absolutely calm and quite and white. This view is from Nyckelviken in Nacka towards Lidingö. Picture taken during a sunday walk.

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

Creating profile views in Salesforce

by Niklas Waller on January 19, 2012

in Salesforce

It happens quite often both as an admin and as a developer that you need to check profile access. One way to do this is to open each profile one at a time to check for for example each profile’s access to a specific object. This could be a quite tiresome work especially if you have a large and complex org with many profiles.

At these times I always create a profile view which gives me a view of exactly what I want to see all at once. And its very simple to do too.

So here’s how to do it:

1. First make sure that you can create profile list views. Goto Administration Setup -> Customize -> User Interface. The checkbox ‘Enable Enhanced Profile List Views’ should be checked.

Enable Enhanced Profile List Views

2. Open up the User Profiles view (Administration Setup -> Manage Users -> Profiles). All profiles are listed here and you can see the default view ‘All Profiles’.

3. Now, if you want to see the profile’s access rights for the opportunity object for example you start by creating a new view. Click ‘Create New View’.

4. Name the view something, e.g. ‘Opportunity Access’.

5. Filters can be added, this is optional though. But assume you have a lot of custom profiles that are prefixed with “MyCompany: “. If I only want to see them I can add the filter with Setting “Profile Name” starts with “MyCompany: “.

6. In step 3 you specify what you want to see in the view. In this case add:
Opportunity: Read
Opportunity: Create
Opportunity: Edit
Opportunity: Delete

7. Now choose the new view ‘Opportunity Access’ in the select list of the profile page. As you can see you get a good overview and can make further decisions based on this.

Create profile view

 

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

After sketch – The fat bird

by Sven R. Ohlson on January 17, 2012

in Cartoons

After sketch... The fat bird

I was just at a good meeting with one of my clients. Some more fun projects and designs to do.

I then came back to the office and got started right away. While drawing a few sketches I thought I might take a detour and so this bird came up. A little bit of excess sketches I would call it. You know – you are so eager to get things down on paper and into your computer or where ever you are doing your designs for the moment… You just have to draw a few extra things after you got your idea on paper… so this time – A Fat bird!

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

Moon pool

by Sven R. Ohlson on January 15, 2012

in Photography

Moon and a game of pool

Yesterday evening I was off to play some pool with some good old friends. We go way back and thought it was about time to play some pool again. Before a tradition – now not so often…

Really nice time!

When I took a walk home I saw the moon light up the road I was walking on. Like an eye looking down. Makes the walk very pleasant when it is lit up by moonlight.

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

On a visualforce page I want to display notes  from an opportunity. To accomplish this I need a VF-page and an extension class (apex).

Part of VF-page that displays the notes:

<apex:outputPanel>
 <apex:pageBlock title="Notes" mode="maindetail">
  <apex:pageBlockTable value="{!MainOppNotes}" var="n">
   <apex:column headerValue="Action" width="5%">
    <apex:commandLink action="{!viewNote}" id="viewNote"
value="View" styleClass="actionLink">
     <apex:param name="noteId" assignTo="{!noteId}" value="{!n.Id}" />
    </apex:commandLink>
   </apex:column>
   <apex:column headerValue="Name" width="65%">{!n.Title}</apex:column>
   <apex:column headerValue="Last Modified" width="30%">
    <apex:outputtext value="{!n.LastModifiedByName}" />,&nbsp;
    <apex:outputtext value="{!n.LastModifiedDateStr}" />
   </apex:column>
  </apex:pageBlockTable>
 </apex:pageBlock>
</apex:outputPanel>

The getMainOppNotes method from the extension class:

// Get notes from the main opportunity.
public List<RetObject> getMainOppNotes() {
 List<RetObject> rtObjs = new List<RetObject>();
 RetObject rt = new RetObject();
 List<Note> mainOppNotes = 
[select Id, Title, LastModifiedDate, LastModifiedById 
from Note where ParentId = :mainOppId];

 for (Note n : mainOppNotes) {
  rt = new RetObject();
  rt.Id = n.Id;
  rt.Title = n.Title;
  rt.LastModifiedDate = n.LastModifiedDate;
  rt.LastModifiedByName = userMap.get(n.LastModifiedById);
  rtObjs.add(rt);
 }
 rt = null;

 return rtObjs;
}

In the method above there is first a SOQL-query to get all notes for a specific opportunity. I want to return Id, Title, LastModifiedDate and LastModifiedBy name for the Note. Since Note has a field LastModifiedById we can only get the id which is not very readable.

A solution to this is to create an wrapper class to the extension class which can be used as an internal object that can hold all the values I wan’t to return to the VF-page. In this case it is called RetObject.

For each Note an instance of RetObject is created and put in a list of the RetObject type. The method is set to return a list of this type and that is what is done when the looping has finished.

The RetObject type contains 4 fields. One is the LastModifiedByName. All fields except this field get their values from a Note. The LastModifiedByName field gets its value from the user map. The usermap consists of a map of type String and Id and contains all active users in the org. This way we can do a quick lookup using the LastModifiedById from the Note.

The user map is created in the constructor and is defined as a private class attribute:

// Create user map
List<User> users = [select id,name from User where isActive = true];
userMap = new Map<ID, String>();

for (User u : users) {
 userMap.put(u.id, u.name);
}

The wrapper class looks like this:

// Wrapper class. Used to return a set of information to 
// display to the user on the VF-page
public class RetObject {
 public RetObject() {}

 public ID Id {get; set;}
 public String Name {get; set;}
 public String Title{get; set; }
 public Datetime LastModifieddate {get; set; }
 public String LastModifiedDateStr {get {
  return LastModifieddate.format('yyyy-MM-dd hh:mm');
 } set; }
 public String LastModifiedByName {get; set;}
}

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

What do you see?

by Sven R. Ohlson on January 9, 2012

in Photography

Spilled coffee on the table - come up with new ideas

Monday meeting and ideas flowing over the conference-table. Great morning and start of the week. Scribbling on paper and notebooks, googling to look at facts and picture references… Waving of hands and suddenly a coffee-cup was hit – and spilled on the table.

And look! Is it a man, a rabbits head if you turn it upside down… Or is it… well it could be anything.

Enjoy the week! And fill it with creativity.

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

The Steam Train

by Niklas Waller on January 8, 2012

in Photography

Steam Train

In a former post I wrote about ice sculpting in Nynäshamn and that we took the steam train to get there.

I also took a picture of the train at the Stockholm train station. It is quite charmful to see this and to ride them although the trip was a little bit too long for the kids.

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment

In the former post I briefly described the Cloud-Based Flow Designer. In this article I will show how to create a simple flow using the Cloud-Based Flow Designer in Salesforce with Apex plug-ins. The plug-in will take a name from the user and display it back backwards.

Create the flow
  • Start by creating a flow (App Setup -> Create -> Workflow & Approvals -> Flows).
  • You can see all your flows in this list. Press ‘New Flow’. If you already have one, press ‘Open’.
Design the flow
The start screen
  • Drag a screen element from the Palette to the canvas.
  • Name it (Get Name).
  • Add a field (Name, textbox).
  • Set it as the start element in the flow. Click the arrow in the upper right corner so that it becomes green.
The end screen
  • Drag a screen element from the Palette to the canvas.
  • Name it (Result).
  • Click on ‘Display Text’ on the ‘Add a Field’ tab. This is the output text field of the screen. Note the name of this field. Mine is named ‘NameBackwardsResult’.
  • As the output, select ‘SCREEN INPUT FIELDS’ as resource and choose the already defined ‘Name’ field.
  • It should now say ‘{!Name} backwards is’.
  • We will come back to this one a bit later.
  • Save flow.
Create an Apex Plug-in

We need to use some Apex now to do the actual work of creating the name input string backwards. For this you need to use Eclipse and the Force.com IDE. I assume you have knowledge of this.

Create a new Apex class. The class should implement the the two methods invoke and describe of the Process.Plugin interface.
The describe method names the plugin and defines input and output parameters.
The invoke method does the actual work. It gets the input parameters, does some calculations and return something.
Once this class has been created this way it will be visible in the Palette tab of the Flow Designer . The tag defined in the describe method is the name of the section and the name defined is the name of the actual plugin. See ‘Name Backwards’ and ‘nameBackwardsPlugin’ in the screenshot below.

 

My Apex class called FlowTest is implemented like this.
global class FlowTest implements Process.Plugin {

// Invoke method
global Process.PluginResult invoke(Process.PluginRequest request) {
String name = (String) request.inputParameters.get('name');
String nameBackwards = '';

try {
String[] nameList = new String[name.length()];
Integer counter = 0;

for (Integer i=name.length()-1; i>=0; i--) {
nameList[counter] = name.substring(i, i+1);
counter++;
}

for (Integer j=0; j<=nameList.size(); j++) {
nameBackwards+=nameList[j];
}

} catch (Exception e) {
System.debug(e);
}

Map<String,Object> result = new Map<String,Object>();

// Add value to output parameter and return.
result.put('result', nameBackwards);
return new Process.PluginResult(result);
}

// Describe method. Returns the describe information for the interface
global Process.PluginDescribeResult describe() {
Process.PluginDescribeResult result = new Process.PluginDescribeResult();
result.Name = 'nameBackwardsPlugin';
result.Tag = 'Name Backwards';

result.inputParameters = new
List<Process.PluginDescribeResult.InputParameter> {
new Process.PluginDescribeResult.InputParameter('name',
Process.PluginDescribeResult.ParameterType.STRING, true)
};

result.outputParameters =
new List<Process.PluginDescribeResult.OutputParameter> {
new Process.PluginDescribeResult.OutputParameter('result',
Process.PluginDescribeResult.ParameterType.STRING)
};

return result;
}
}

You can have several input- and output arguments. Just define any extra input- and output parameters to the inputParameter and outputParameter lists in the describe method. Create new strings to get extra input parameters in the invoke method and add more key-values in the map for the output parameters in the invoke method.

Add plug-in to flow
Open up the flow again. If it was already open you probably need to refresh it or close and open it again.

Now click the Resources tab and double-click on variables. You are going to create a variable that will be assigned the output value of the plugin. My is named ‘NameBackwards’ and is of type text.

In the Palette you should now see the plugin as described in the screenshot above. Drag the nameBackwardsPlugin to the canvas. Mine is named ‘Calculate Name Backwards’. You will have to define inputs and outputs to the plugin corresponding to what you have just coded in the Apex plugin. So in this case the input would be the screen input field ‘Name’ and the output would be the variable ‘NameBackwards’ you just created.

Back to the end screen
Open up the end screen by double clicking it and go to the ‘Field Settings’ tab. Select resources and variables and ‘NameBackwards’ and add to the end of the output string. It should now read ‘{!Name} backwards is {!NameBackwards}!’.

See the Resources tab to see what we have created so far.

Finish the flow
Just add connectors between the elements and you’re done. Click a diamond for an element, hold the mouse button down and release it when you are in a receiving  elements diamond.

The flow is done. Save and Run to test it. You can also put the flow in a Visualforce page. This would be the code for doing that. ‘Play_with_Name’ below is the name of the flow.

<apex:page>
<h1>Your name backwards!</h1>
<flow:interview name="Play_with_Name"></flow:interview>
</apex:page>

Running the flow
Opening the new Visualforce page and running the flow will result in these screens.

Good Luck!

Share and Enjoy:

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • email
  • Google Buzz
  • RSS
  • Slashdot
  • Technorati
  • Add to favorites
  • DZone
  • LinkedIn
  • MySpace
  • Tumblr

Be the first to comment