top of page

SF Trigger to create Portal user upon creating contact.

Requirement Specification:

We need to create a user record when a contact record is created:

-Timezone: We need to go and read from the Account's timezone field.

-Current values for timezone are

Pacific Mountain Central Eastern Alaskan Hawaiian New Foundland Australia/Sydney

Any unknown value should be set to "America/New_York"

Record must have the following fields populated

alias = 'contact.lastName',

email = '',

emailencodingkey = 'UTF-8',

firstname = 'contact.firstName',

lastname = 'contact.lastname',

languagelocalekey = 'en_US',

localesidkey = 'en_US',

contactId = 'contact.Id',

timezonesidkey = 'America/New_York' (this value changes)

username = '',

CommunityNickname ='contact.lastName'

ProfileId = '00e0Y000001M7qf' (nb; not recommended)

IsActive = true

Also we need to test whether the user get's the welcome email.

-Test class is required as well.


The Trigger

Test Class: 100% code coverage

Featured Posts
Recent Posts
Search By Tags
No tags yet.
Follow Me
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page