Pages

Friday, June 24, 2016

Salesforce Change Set


List of Component Type available in Change Set:
  • Action
  • Action Link Group Template
  • Apex Class
  • Apex Sharing Reason
  • Apex Trigger
  • App
  • Approval Process
  • Assignment Rule
  • Auth. Provider
  • Auto-Response Rule
  • Button or Link
  • CORS Whitelist Origin
  • Call Center
  • Communication Channel Layout
  • Compact Layout
  • Custom Console Component
  • Custom Field
  • Custom Label
  • Custom Metadata Type
  • Custom Object
  • Custom Permission
  • Custom Report Type
  • Custom Setting
  • Dashboard
  • Dataflow
  • Document
  • Email Template
  • Escalation Rule
  • External Data Source
  • Feed Filter
  • Field Set
  • Flow Definition
  • Folder
  • Global Picklist
  • Group
  • Home Page Component
  • Home Page Layout
  • Language Translation
  • Letterhead
  • Lightning Component Bundle
  • Lightning Page
  • List View
  • Matching Rule
  • Name Credential
  • Opportunity Split Type
  • Page Layout
  • Permission Set
  • Platform Cache Partition
  • Post Templates
  • Queue
  • Record Type
  • Remote Site
  • Report
  • Reporting Snapshot
  • Role
  • S-Control
  • Send Action
  • Sharing Criteria Rule
  • Sharing Owner Rule
  • Sharing Territory Rule
  • Site.com
  • Static Resource
  • Tab
  • User Provisioning Config
  • Validation Rule
  • Visualforce Component
  • Visualforce Page
  • Workflow Email Alert
  • Workflow Field Update
  • Workflow Outbound Message
  • Workflow Rule
  • Workflow Task
  • Zone
The one in purple is just to mark new components added since Summer'15 release.

Note:

Search Layouts is not available as independent Component in Change Set, but when you deploy the object, all Search Layouts for that object is included.

For Custom Settings, you need to re-create or export/import (e.g. using Data Loader) the data set/values in the target org, Change Set will only deploy the Custom Setting shell.

Custom Fields from Custom Settings will be treat as per normal Custom Fields from object.

The components available for a change set vary by edition. Some components require corresponding features to be enabled in your organization, such as: Sharing Territory Rule will not available if Territory  is not enabled. 

If you create or modify components that are not available in a change set, you can't send those components from one organization to another in a change set. In this case, migrate the changes manually by repeating the steps you performed when you created or modified the component.

List Views are visible to all users when you deploy a change set. Change the visibility in the destination organization as necessary. See more information related to List View for change set here List View not visible in Change Set.

Deployed custom tabs are hidden by default for all users. They’re visible only if the change set also contains profiles that set the visibility property appropriately. Professional Edition organizations are an exception—deployed custom tabs in those organizations are always visible by default.


Reference:

Friday, June 10, 2016

Salesforce: Convert Multi-Select Picklist to Text


Multi-Select Picklist is nice for user to use in Salesforce user interface, but there are many limitations for admin to use this type of field, because it support limited functions compare to other fields type.

More than a year ago, we blog about How to sort Multi-Select Picklist in View? This blog will share about how to convert Multi-Select Picklist to Text, so you can use it in many areas.

As of now (Summer '16 release), multi-select picklist only support following functions:
  • INCLUDES()
  • ISBLANK()
  • ISNULL()
  • ISCHANGED() - only in assignment rules, validation rules, workflow field updates, and workflow rules in which the evaluation criteria is set to Evaluate the rule when a record is: created, and every time it’s edited.
  • PRIORVALUE()only in assignment rules, validation rules, workflow field updates, and workflow rules in which the evaluation criteria is set to Evaluate the rule when a record is: created, and every time it’s edited.

With a simple formula field return text format, you can get the multi-select picklist values in Text.
Let say you have a custom multi-select picklist field called Country__c with 5 values. Here is the formula:
 IF( INCLUDES(Country__, 'Singapore'), 'Singapore,', null) +   
 IF( INCLUDES(Country__, 'Indonesia'), 'Indonesia,', null) +   
 IF( INCLUDES(Country__, 'Malaysia'), 'Malaysia,', null) +   
 IF( INCLUDES(Country__, 'China'), 'China,', null) +   
 IF( INCLUDES(Country__, 'Japan'), 'Japan,', null)   


Reference: Tips for Working with Picklist and Multi-Select Picklist Formula Fields


Thursday, June 9, 2016

Salesforce System Status Alert with IFTTT

Salesforce Trusthttp://trust.salesforce.com is the main area to monitor if any issues happened with your Salesforce org, but you need to know what is your Salesforce instance, for production instance, it start with NAxx, EUxx, and APxx, while CSxx for sandbox instances.

It is a good idea to have central place to monitor all instances, or your specific instances. For this blog I'll use sample instance NA17. We'll not always keep monitor that website - http://trust.salesforce.com/trust/instances/NA17, but I expect that Salesforce Trust will email me directly if any post related to my instance.

Solution: because Salesforce Trust also publish RSS feed, we can use this and combine with IFTTT.com to trigger send email. The same result can be achieved using other tools support rss feed to email such as: blogtrottr.com, but for this blog, we'll just use IFTTT.com

RSS Feed for NA17 = http://trust.salesforce.com/rest/rss/NA17
  1. Login or Signup to ifttt.com
  2. Create a Recipe
  3. Select if "Feed"
  4. Enter NA17 Feed URL: http://trust.salesforce.com/rest/rss/NA17
  5. Select then "Email"
  6. Leave the Subject and Body as default
  7. Done and you have your recipe running.



If any post related to NA17, IFTTT will send you email, see sample below:




Thursday, May 26, 2016

Salesforce: Multi-Person Calendar Event (User as invitee)

In previous blog Multi-Person Calendar Event (Contact / Lead as invitee), we discussed about adding contact or lead as invitee, we also discussed the structure at the backend and how we can use API to add contact or lead as invitee.

But, when the invitee is a user, the structure will be a little different, although the objects used is the same.

1. Event object
Instead of create only 1 event record as add contact/lead as invitee, invite user will create multiple event record based on number of invitee + sender. In this scenario, we are going to invite 2 users and 1 contact.


Sample query: Select Id, Subject, OwnerId, GroupEventType, IsChild, WhatId, WhoId, CreatedDate, ActivityDate, ActivityDateTime, StartDateTime, EndDateTime, EventSubtype, IsReminderSet, Type, WhatCount, WhoCount FROM Event WHERE Subject = 'Test with User'


This will create 3 events with same subject, one event for each User, but only 1 with IsChild = False, which is "parent" event. Also notice that each record have different Owner Id, and all events with GroupEventType = 1, remember that we cannot populate / update GroupEventType manually.


2. EventRelation object
Sample query: SELECT Id,EventId,RelationId,IsParent,IsWhat,IsInvitee,Status,CreatedDate FROM EventRelation WHERE EventId IN ('00U63000001T8Y9EAK','00U63000001T8YAEA0','00U63000001T8YBEA0')


Notice that records created in this object is relate to: 1 opportunity, 1 contact and 2 users, but all linked to the same event, which is parent event where IsChild = False.


3. EventWhoRelation object
Same with EventRelation object, only 1 record created as we only have 1 contact relate to the event, and it is linked to the parent Event (IsChild = False)

Sample query: SELECT Id, EventId, RelationId, Type, CreatedDate FROM EventWhoRelation WHERE EventId IN ('00U63000001T8Y9EAK','00U63000001T8YAEA0','00U63000001T8YBEA0')



How to auto add User as Invitee Event with API?

You just need to insert record(s) to EventRelation object, 1 record for 1 contact / lead. Here are fields you need to populate:
1. EventId = Event Id
2. RelationId = User Id
3. IsParent = False
4. IsWhat    = False
5. IsInvitee = True
6. Status   = New

This is similar with add Contact / Lead as invitee, the difference is: Salesforce will auto create event record for the user as child record, if the parent record initially is not for multi-person, GroupEventType will change from 0 to 1.



Salesforce: Multi-Person Calendar Event (Contact / Lead as invitee)


In Salesforce, you can create event and relate to multiple Contacts (up to 50 contacts), but make sure you have enable Allow Users to Relate Multiple Contacts to Tasks and Events from Setup | Customize | Activities | Activity Settings.

You also can invite Contacts that is not defined in the Relate To for the event, including from Leads.


As you see from screenshot above, the event is relate to Opportunity and 2 contacts, we add both Contacts as invitee, and then we also add 2 Leads as Invitee.


So what happened in the backend ?

1. Event object
Salesforce create a new event record, because this is Multi-Person Calendar Event, notice GroupEventType = 1; while WhoId is the primary Contact.

Note that you cannot populate GroupEventType from API, but the value will be auto populate based on event category:
  • 0 (Non–group event)—An event with no invitees.
  • 1 (Group event)—An event with invitees.
  • 2 (Proposed event)—An event created when a user requests a meeting with a contact, lead, or person account using the Salesforce user interface.  

Sample query: Select Id, CreatedDate, ActivityDate, ActivityDateTime, ReminderDateTime, StartDateTime, EndDateTime, EventSubtype, GroupEventType, IsReminderSet, OwnerId, Subject, Type, WhatCount, WhatId, WhoCount, WhoId FROM Event WHERE Id = '00U63000001T8XGEA0'


2. EventRelation object
Represents people (a user, a lead, or contacts) or a resource (such as a conference room) invited to an event.  For above screenshot scenario, query to this object for above event will return 5 records: 2 Contacts, 2 Leads and 1 Opportunity.

Sample query: SELECT Id, EventId, RelationId, IsParent, IsWhat, IsInvitee, Status, CreatedDate FROM EventRelation WHERE EventId = '00U63000001T8XGEA0'



3. EventWhoRelation object
Represents the relationship between an event and a lead or contacts, this object DO NOT have relation with invitee, but it is pure on contacts or lead Relate To the Event. EventWhoRelation allows a variable number of relationships: one lead or up to 50 contacts. Available only if you’ve enabled Shared Activities for your organization.

Sample query: SELECT Id, EventId, RelationId, Type, CreatedDate FROM EventWhoRelation WHERE EventId = '00U63000001T8XGEA0'

From the top screenshot scenario, query will return 2 records which is Contact relate to: Mike Lee and Jack Man. We cannot create record directly in EventWhoRelation object with API.


How to auto add Contact / Lead as Invitee Event with API?

You just need to insert record(s) to EventRelation object, 1 record for 1 contact / lead. Here are fields you need to populate:
1. EventId = Event Id
2. RelationId = Contact Id / Lead Id
3. IsParent = False
4. IsWhat    = False
5. IsInvitee = True
6. Status         = New


Reference:


Wednesday, May 25, 2016

Salesforce: Automate Assigning Managed Package Licenses

When you purchase 3rd party app by License (from AppExchange or others), once installed in Production, you will find the Packaged in Setup | Installed Packages. For free package, it will be available for all users, but for license by user, you will notice Manage Licenses link next to the Package Name. Then admin or user with Manage Package Licenses permission need to add users for particular license. This is simple job, but when you have new user onboard and offboard over the times, this activity often forget and become not practical.

Can we automate this? 
Since Summer 14 release, Salesforce make the object available via API, where you can use Process Builder + Flow or Trigger to automate license assignment and license removal.

There are 2 object you need to work with:

1. PackageLicense
Represents a license for an installed managed package.
This object only support record query, not create, update, and delete.

2. UserPackageLicense
Represents a license for an installed managed package, assigned to a specific user.
This object support record create, delete, query, but not update.

I'll not go down to the detail on how to create Process Builder + Flow or Trigger code in this blog, but the idea is based on objects above, you need to get the PackageLicense Id, the create new record in UserPackageLicense, you just need to provide PackageLicenseId and UserId.


Sample Query
SELECT Id, NamespacePrefix, AllowedLicenses, UsedLicenses FROM PackageLicense WHERE Status = 'Active' AND AllowedLicenses > 0 ORDER BY NamespacePrefix


SELECT Id, PackageLicenseId, UserId FROM UserPackageLicense WHERE PackageLicenseId = '050o0000000DC8JAAW'


Reference:


Page-level ad