by Niklas Waller on December 30, 2010
in SQL
I have been working with pretty large pieces of SQL code and now as the code would grow bigger I realize the need of being able to use a global variable for the cases when I need to modify a string that is being used in many different pieces of code.
So for example if I need to do this comparison in several SQL code blocks:
left(a.createddate,10) > “2010-06-25”
and I use the same date in many code blocks, then it would be better if I could use a global variable that I could change in one place only.
This is easily accomplished. Define the global variable and execute:
Set @startDate = "2010-06-25";
Then use it like this:
left(a.createddate,10) > @startDate
Tagged as:
global,
mysql,
sql,
variable
by Sven R. Ohlson on December 27, 2010
in Pictogram

A lot of X-mas spirit is in the air at this time of year. Christmas in shopping-windows, offices, streets and at home – all over there is Christmas in the air. And here in Stockholm I must say it is a lot of snow all over the place… really makes the Christmas feeling grow.
I have been at a few nice friends and have eaten lots of nice food. Everything from traditional ham to super-nice turkey and Christmas cake… a favourite of mine.
Enjoy the little pictogram of a tree that also has a bit of a black arrow feeling to it. The X is the Christmas star and also X as in X-mas.
Merry X-mas everyone
Tagged as:
christmas,
xmas

So now we have just had christmas 2010. It was a great christmas, especially for the kids, and it’s still not over. Today we were out in the snow and had a great time and also doing only-fun things indoors and eating lots of candy.
Tomorrow we are off to see grandmother, it will be great. Just hope the weather will not stop us.
The photo today shows a closeup of our christmas tree with some beautiful christmas tree balls that my wife has a thing for. She can buy millions of them and these are two of them 
Merry Christmas to all of you!
Tagged as:
christmas,
tree balls,
xmas
In your Salesforce org you have a sharing model. Generally speaking it’s first the OWD (Organization Wide Defaults) which specifies the default acccess to the org objects. Sharing rules can be added on top of this to widen the access rights to specified groups and roles. And then we have the settings on the profiles that can be used as a complement or sometimes override the sharing model.
Our org already contains many profiles and sharing rules for several objects. A few days ago I was performing a test migration. The sharing settings is a very important issue since we will be having different business segments that cannot under any circumstances access each others data. And now several days later when taking a closer look at it I noticed that the needed access restriction wasn’t working. A way to analyse this is to check the sharing settings for an object and try to find out why.
The problem we had was on the opportunity. First I checked the sharing on the Account (press the sharing button below the related lists). There were several rules in action here. Most of them reflected existing sharing rules or owner circumstances. One of them however said ‘Associated record owner or sharing’ as the sharing reason. When clicking on this reason I was taken to the opportunity list of the account, i.e. a list of opportunities which was the reason for this rule.
The next step was to look at the sharing for one of these opportunities. There were several rules in action here too, most of them reflected also here by existing sharing rules or other owner circumstances. One of them said ‘Manual Sharing’. This is the rule causing the account rule reason specified above. This rule clearly gave access to a group of users that shouldn’t have it.
Now, there are several reasons to how this rule was created.
- Someone has added it manually to the opportunity. This was not the case however. All my newly migrated opportunities had this issue.
- Apex Sharing. This is only possible on custom objects though and the opportunity is not a custom object.
- Apex coding. This was the reason. One of the triggers on the opportunity used a method in an apex class which created an instance of the object, giving access to one of the groups which shouldn’t have it for this business segment. The solutions here is hence to add a condition to the class that checks which business segment it is and act different depending on this.
Might be interesting for someone who gets the same problem. This might sound easy but it was hard to find.
Tagged as:
object,
opportunityshare,
owd,
profile,
salesforce,
sharing,
sharing rule
by Sven R. Ohlson on December 20, 2010
in Pictogram

I took a picture that I posted yesterday of a light bulb – the typical symbol for an idea. Maybe even a great idea. So this time I made a light-bulb pictogram to symbolize the idea I’m working on now. Or rather it is actually a concept more or less – a new design and concept for a new product. All this is nice to put together under the uniting symbol – The bulb.
It is nice to think of things that have to do with work and design when you, for example, are out shovelling snow… and as you might know there has been a lot of snow lately. I must have been out at least five times today! And every time I come back out – it looks like nobody has been shovelling any snow for ages. Good exercise and the landscape looks incredible – like a landscape from a winter story-book or fairy-tale!
Tagged as:
bulb,
idea,
pictogram

Today I have been down by the boat with my father. Now one can wonder if it isn´t a bit late and a bit to much ice. Well – the truth of the matter a was that it was a bit thick I must say. We almost got stuck up on the ice. So we had to surrender to winter and keep the boat at the jetty.
The thing is that I was thinking while driving through the ice… And I got lots of new ideas and thoughts that rushed through my head. Maybe not all of them solutions to world peace – but solutions to what I have to design later on this week. I got a hectic week ahead of me – before Christmas and all… Well it is great to have lots of work and I enjoy that I must say.
I´m just saying that I thought of the bulb I took a picture of earlier this week. The symbol of ideas and creativity. Very commonly used but still a very clear symbol that you have ideas spinning in your head. I must say that I am glad there is! Everything that turns up in front of you – events or things can give you inspiration and motivation to keep on going and create new designs and ideas.
So I would recommend all you boat owners that it is a bit late to get the boat out of the water right now. We will have to try again later this spring.
Tagged as:
boat,
bulb,
idea
I was migrating data from a legacy system to our Salesforce ORG using the Apex Data Loader. Data was migrated to different objects like Account and Opportunity and for each of these a recordtypeid was specified. It worked out just fine! Then suddenly for the Case object I bumped into an error message for all records that I tried to upsert.
Record Type Id: id value not valid for the users profile
I have seen this error message before and also posted about it. My guess was therefore that the owner (user) of the ownerid specified for the case didn’t have the record type enabled for his profile. However this was not the case.
After quite some time reading and testing my colleague found the answer – the record type also has to be enabled for the profile of the user that does the data loading, i.e. the user who creates the case. When enabling the Case Recordtypes for my own profile everything started working again!
Tagged as:
data loader,
profile,
recordtype,
salesforce
by Sven R. Ohlson on December 13, 2010
in Logotypes

When one designs logotypes or pictograms it is often so that the symbol can have several meanings or hidden messages. Either intentionally or by chance. If the message is easy to be misstaken with a similar brand or something that looks funny or bad it could be a good idea to rethink the design a bit.
This time the design could be a chair with to round lamps hanging beside it. Or a cocktail-glass… Or even a bear-nose and eyes. What do you see?
Tagged as:
bear,
chair,
cocktail

This is a photo from the beginning of our ballon trip a couple of months ago. Me and the Mrs took a ride. We together with lots of other beginners got the chance to help preparing the balloon. Then we sat up in the balloon basket which had several areas. And after that we took off. The fire kept on from time to time to get the balloon on the right altitude. Apparently this has impact on the direction.
Great fun! I recommend it!
Tagged as:
balloon,
basket,
fire
I was deploying new Salesforce workflows via Eclipse from one sandbox to another and then I got this error for several of them. The number is a variable here of course.
salesforce Exceeded maximum number (10) of active workflows
The strange thing is that this is no limit. I have seen cases on the Internet with the number 70 here. I myself got other cases with 3. So I don’t know why this error message pops up but I know how to get around it – a workaround.
Modify the active tag of the workflows. I.e. set them to false, see below. I.e. this is done in the xml-representation of the workflows in Eclipse:
<active>false</active>
Then deploy to the other ORG. The workflows will get created. Now you modify the active flag back to true and deploy again.
Tagged as:
deploy,
eclipse,
salesforce,
workflows