Get default currency ISO Code in Salesforce multicurrency organization

Here I have found a way to get default currency ISO Code in Salesforce multicurrency organization

We just have to execute the following query

SELECT IsoCode
FROM CurrencyType
WHERE IsCorporate = true
Advertisements
Posted in salesforce, Uncategorized | Leave a comment

Ranked 9212 on Google Code Jam QR 2018

There were interesting problems for C and D which I failed to solve.

Especially problem D since this was just stereometry problem. At least small set I knew how to solve, however I received wrong answer verdict, which is strange. Maybe it is related to that I was rotating cube counterclockwise

D - counterclockwise

and I had a matrix

-cos alpha, sin alpha, 0.5

-sin alpha, -cos alpha, 0.5

0 0 .5

while everyone else was rotating cube clockwise

D-clockwise

This would be strange if this was the only reason I got “wrong answer” verdict.

This was my code to solve problem D https://gist.github.com/Patlatus/f2f003864251549d3ba6f63cc2a09239

and this was my code to solve problem C https://gist.github.com/Patlatus/a4353dd67e49d235745aeb83b9e1d66e – this one received “Time limit error”.

 

Posted in Uncategorized | Tagged , , , | Leave a comment

Uletas Gamma 1.1 and 1.0.1 Release Notes

I have noticed some errors coming to my personal email from users who use my ULETAS Gamma package.
ULETAS is acronym and stands for User Licenses Email Threshold Alerts Simplification.

So, uletas is a simple package for configuring user licenses email threshold alerts.

I decided to investigate the error and require users to populate email for error notifications to prevent all of these errors flowing to my email.

Also I decided to create a repository on GitHub to track issues I fix in new versions of this package. I didn’t intent initially to support this package but since users are using it and are apparently facing issues I guess this might be worth to at least provide an option to log errors and to provide at least some limited or partial support of this package.

So I am releasing a new version of package including two changes.

Uletas Gamma 1.1 and 1.0.1 Release Notes

The basic version of this packages contains one app consisting of several tabs:

  1. User Licensing Settings tab – main tab of this package, used to manage default settings, to edit, activate or deactivate User License Email Threshold Alerts.
  2. User Licenses Extended tab – auxiliary custom object tab with extracted users Licenses records. May be useful for administrators.
  3. User License Email Alert tab – auxiliary custom object tab with user license email threshold alert records. May be useful for administrators.

Install link

To install on productions or developer editions link.

To install on sandboxes link.

Post Install Instructions

Link to page on production-like organizations.

Link to page on sandboxes.

Step 1

Please go to User Licensing settings page and configure the package.
1. Decide if you want to check or uncheck checkbox which defines if email alert is sent only on the first time when threshold is reached or everytime after user activation or deactivation happens after threshold is reached and remaining user license number is less than threshold. If checkbox is checked then subsequent emails are sent. If checkbox is unchecked then email is sent only once per threshold crossing.

2. Since version 1.1 and 1.0.1 it is required to populate error notification recipient email for collecting errors if any happen during package business logic execution. Users will not be able to save settings, activate or edit threshold alerts without specifying error notification recipient email.

Click “Save Settings” button to apply your selected configuration settings.

Step 2

All your users license list should be retrieved automatically. In case if this didn’t happen or if you believe the records are outdated, feel free to click “Recalculate Users Licenses” button to retrieve your available users license list again.

Step 3

Once you have successfully retrieved list of your available user licenses, you can activate and edit Threshold email alert when the number of licenses approaches threshold.
Please click “Activate” or “Edit” link on the right from user license usage you would like to track. If you don’t see popup window it may be blocked by browser, please check that you have unblocked popup windows. On the popup window you can easily populate threshold and email recipient or recipients.

Since version 1.1 and 1.0.1, it is required to populate at least one email recipient for Selected Recipients list on the User Licenses Email Threshold Alerts Settings page. User will not be able to save threshold alerts settings without specifying at least one selected recipient.

Step 4

Once you have successfully completed previous three steps, this means you have successfully configured ULETAS package for your organization. In you face any obstacles feel free to contact package creator or first you might want to reread release notes.

Enjoy.

Change List

In version 1.1 and 1.0.1, the following changes were added.

Error notification email input box should be required on settings page

Future method should not be called from a future or batch method

Selected Recipients should be required on User License Email Threshold Alert Settings page

Also, in version 1.1, default Install and Uninstall Handlers were added.

Also, in version 1.1, configure custom link is added to redirect user to settings page on configure button click.

Thanks for your attention. I have pushed a new version to every organization using version 1.0 of my package on 19 March 2018. Please let me know if you see any issues.

Posted in uletas | Tagged , , , , | Leave a comment

Minimum and maximum valid dates in Salesforce

What are the minimum and maximum valid dates in Salesforce?

I spend a long time to find this place in the documentation

   Minimum and Maximum Dates
Only dates within a certain range are valid. The earliest valid date is 1700-01-01T00:00:00Z GMT, or just after midnight on January 1, 1700. The latest valid date is 4000-12-31T00:00:00Z GMT, or just after midnight on December 31, 4000. These values are offset by your time zone. For example, in the Pacific time zone, the earliest valid date is 1699-12-31T16:00:00, or 4:00 PM on December 31, 1699.

Posted in salesforce, Uncategorized | Tagged , , , , , | Leave a comment

Comparison between Worklow, Process Builder, Visual Workflow and Approvals

I remember when I previous time was looking through this table it looked different.

Automation Tool Features

Here’s the breakdown of all the features and actions that are supported in each of our automation tools. Use it to figure out which tool is best for your business needs.

Process Builder Visual Workflow Workflow Approvals
Complexity Multiple if/then statements Complex A single if/then statement A single if/then statement
Visual designer check icon indicating true check icon indicating true
Browser support All (Chrome recommended) All (Safari not recommended) All All
Starts when
  • Record is changed
  • Invoked by another process
  • Platform event occurs
  • User clicks button or link
  • User accesses Lightning page, Community page, Visualforce page, or custom tab
  • User accesses item in a utility bar
  • Process starts
  • Apex is called
Record is changed
  • User clicks button or link
  • Process or flow starts that includes a Submit for Approval action
  • Apex is called
Supports time-based actions check icon indicating true check icon indicating true check icon indicating true
Supports user interaction check icon indicating true
Supported Actions
Call Apex code check icon indicating true check icon indicating true
Create records check icon indicating true check icon indicating true Tasks only Tasks only
Invoke processes check icon indicating true
Delete records check icon indicating true
Launch a flow check icon indicating true check icon indicating true check icon indicating true(Pilot)1
Post to Chatter check icon indicating true check icon indicating true
Send email check icon indicating true(Email alerts only) check icon indicating true check icon indicating true(Email alerts only) check icon indicating true(Email alerts only)
Send outbound messages without code check icon indicating true check icon indicating true
Submit for approval check icon indicating true check icon indicating true
Update fields Any related record Any record The record or its parent The record or its parent

1The Process Builder has superseded flow trigger workflow actions, previously available in a pilot program. Orgs that are using flow trigger workflow actions can continue to create and edit them, but they aren’t available for new orgs.

Posted in Uncategorized | Leave a comment

No Average option in Salesforce Rollup Field

I never paid much attention to Rollup field functionality since in most cases we needed rollup fields on lookup relationships and for that we had to use either custom Apex logic or third-party packages.

And now I looked and found that there is really no Average option in Salesforce rollup field definition! I always believed there are there Min, Max, Avg, Count, Sum.

noAVG

There is even an idea to add it.

Posted in Uncategorized | Leave a comment

Salesforce Apex Code to get users which have Customize Application permission

Sometimes we need to know which users can be considered admins. For example, which users have Customize Application permission

 

select AssigneeId, Assignee.Name, Assignee.ProfileId, Assignee.Profile.Name from PermissionSetAssignment where PermissionSet.PermissionsCustomizeApplication = true

Posted in Uncategorized | Leave a comment