+ Start a Discussion
Adilson Arcoverde JrAdilson Arcoverde Jr 

I'm stucked on Service Cloud Specialist step 6. It shows the error message:

Challenge Not yet complete... here's what's wrong: 
We can't find the Recipient field in the email template. Ensure the Cloudy Weather Email Template addresses the Recipient of the email.
Close errors

However, my email template called Cloudy weather (Text format) has the following body:

Hey {!Contact.FirstName}, Sorry to hear that your panels aren't generating the power you hoped for. Based on our research, it appears the low power produced is related to the cloudy weather in your area recently. In the worst conditions, Ursa Major panels produce ~25% of maximum power. If you have additional questions, please give us a call and reference case {!Case.CaseNumber}. Thanks! {!User.Name}, Ursa Major Solar

Any ideas?

Best Answer chosen by Adilson Arcoverde Jr
Adilson Arcoverde JrAdilson Arcoverde Jr
I've found the problem.

The email template should start with Hey {!Recipient.FirstName}, instead of {!Contact.FirstName}.
Abhilash Mishra 13Abhilash Mishra 13 
can i get all the values of a picklist field in a list some how?

I have picklist type custom field in the product. having some options.
In my apex class i want to use these options. can I get them some how throught code? 
Best Answer chosen by Abhilash Mishra 13
Hi Abhilash,

If you want to display pick list values in your custom page through dyanamic apex .You can check below link it will help  .


If you want in a string array or list then you can use below code .
public List<String> getPickListValuesIntoList(){
       List<String> pickListValuesList= new List<String>();
		Schema.DescribeFieldResult fieldResult = ObjectApiName.FieldApiName.getDescribe();
		List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
		for( Schema.PicklistEntry pickListVal : ple){
		return pickListValuesList;
Let us know if it helps !!
Sharon CrenshawSharon Crenshaw 
I keep getting the following error while running my Apex Test Class. If I could please get assistance in resolving the problem I would appreciate it. I continue getting the following error:

System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Alias: data value too large: Sminull90 (max length=8): [Alias]

Below is my code:

Apex Class:

public  class NewUtilStaffProcess {
       public static void createUtlUser(Id recid) {
           Contact gcon = [SELECT Email, Lastname, Firstname, Middlename, AcctId
                            FROM   Contact
                            WHERE  Id = :recid];
           Profile p = [SELECT Id FROM Profile WHERE Name='HAVNA City Public Utility Group'];
           Id acctsTypeId = [SELECT Id
                            FROM   RecordType
                            WHERE  SObjectType = 'Account'
                            AND    Name = 'Account Source'].Id;
           String groleId = [SELECT Id FROM UserRole WHERE Name = 'Utility Staff' LIMIT 1].Id;
           String formatUsrName;
           String setUsrLoc;
           Account retAcct = [SELECT Id, HAVNA_Country__r.HAVNA_Letter_Code__c, Hav_Locality__c, Hav_Street__c
                               FROM   Account
                               WHERE  Id = :gcon.AcctId
                               AND    recordTypeId = :acctsTypeId
                               LIMIT 1];
           if (retAcct.Hav_Street__c == 'Local/Surveyor')
              setUsrLoc = retAcct.HAVNA_Country__r.HAVNA_Letter_Code__c+retAcct.Hav_Locality__c;
           if (retAcct.Hav_Street__c == 'City/Surveyor')
              setUsrLoc = retAcct.HAVNA_Country__r.HAVNA_Letter_Code__c+'C1';
           if (retAcct.Hav_Street__c == 'State/Surveyor')
              setUsrLoc = retAcct.HAVNA_Country__r.HAVNA_Letter_Code__c+'C2';
           if (gcon.middlename == null) {
               formatUsrName = gcon.Lastname.deleteWhitespace().toLowercase().trim()+'.'+gcon.Firstname.deleteWhitespace().toLowercase().trim()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';
           } else {
               Integer midSize = gcon.Middlename.length();
               if (midSize == 1) {
                   formatUsrName = gcon.Lastname.deleteWhitespace().toLowercase().trim()+'.'+gcon.Firstname.deleteWhitespace().toLowercase().trim()+'.'+gcon.middlename.deleteWhitespace().toLowercase().trim()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';
               } else {
                   formatUsrName = gcon.Lastname.deleteWhitespace().toLowercase().trim()+'.'+gcon.Firstname.deleteWhitespace().toLowercase().trim()+'.'+gcon.middlename.deleteWhitespace().trim().substring(0,1).toLowercase()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';

           System.debug('Formatted Username: '+formatUsrName);
           User u       = new User(Alias    = gcon.Lastname.deleteWhitespace().trim().length() > 4 ? gcon.Lastname.deleteWhitespace().trim().substring(0,3)+setUsrLoc: gcon.lastname+setUsrLoc,
                         Email              = gcon.Email,
                         EmailEncodingKey   = 'UTF-8',
                         LastName           = gcon.Lastname,
                         FirstName          = gcon.Firstname,
                         MiddleName         = gcon.Middlename,         
                         LanguageLocaleKey  = 'en_US',
                         LocaleSidKey       = 'en_US',
                         ProfileId          = p.Id,
                         UserRoleId         = groleid,          
                         TimeZoneSidKey     = 'America/New_York',
                         UserName           = formatUsrName);
           UtilStaffPermSet.assgnPermissionSet(recId, u.Id);  
           System.resetPassword(u.Id, True);


Apex Test Class:

public class NewUtilStaffProcessTest {

   public static testMethod void InitialTest() {

        /* Get Record Id Type */   
        Id conTypeId;
        Id acctTypeId;
        String formatUsrName;
        String setUsrLoc;
        conTypeId = [SELECT Id  
                     FROM   RecordType
                     WHERE  SObjectType = 'Contact'
                     AND    Name = 'Utility Staffer'].Id;  

        Id acctsTypeId = [SELECT Id
                      FROM   RecordType
                      WHERE  SObjectType = 'Account'
                          AND    Name = 'Account Source'].Id;

        Profile p = [SELECT Id FROM Profile WHERE Name='HAVNA City Public Utility Group'];
        String groleId = [SELECT Id FROM UserRole WHERE Name = 'Utility Staff' LIMIT 1].Id;

        Integer midsize;
        //Create new State record; initialize required field(s), then insert
        HAV_State_and_Country__c state  = new HAV_State_and_Country__c();
        state.Name                = 'Oregon';
        state.HAV_Letter_Code__c = 'OR';
        state.HAV_Type__c        = 'State';
        Insert state;
        //Create new Account record; initialize required field(s), then insert
        Account acct = new Account(Name='Oregon Local 7');
        acct.Hav_Locality__c     = '90';
        acct.Hav_Street__c     = 'Local/Surveyor';
        acct.RecordTypeId     =  AcctTypeId;
        acct.HAV__Country__c    = state.id;
    insert acct;

        //Create new Contact record; initialize required field(s), then insert
        Contact con  = new Contact();   
        con.FirstName       = 'Ralph';  
        con.LastName        = 'Smith';
        con.Middlename      = 'Otis';
        con.RecordTypeId    =  conTypeId;
        con.email           = 'rsmith8@verizon.com';
        con.AcctId          = acct.id;
        //Insert Contact
        Insert con ;
       Account retAcct = [SELECT Id, HAV_Country__r.HAV_Letter_Code__c, Hav_Locality__c, Hav_Street__c
                          FROM   Account
                          WHERE  Id           = :con.AcctId
                          AND    recordTypeId = :nomsTypeId
                          LIMIT 1];
       if (retAcct.Hav_Street__c == 'Local/Surveyor')
              setUsrLoc = retAcct.HAV_Country__r.HAV_Letter_Code__c+retAcct.Hav_Locality__c;
       if (con.middlename == null) {
           System.debug('3: '+setUsrLoc);
               formatUsrName = con.Lastname.deleteWhitespace().toLowercase().trim()+'.'+con.Firstname.deleteWhitespace().toLowercase().trim()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';
           } else {
               System.debug('4: '+setUsrLoc);
               midSize = con.Middlename.length();
               if (midSize == 1) {
                   System.debug('5: '+setUsrLoc);
                   formatUsrName = con.Lastname.deleteWhitespace().toLowercase().trim()+'.'+con.Firstname.deleteWhitespace().toLowercase().trim()+'.'+con.middlename.deleteWhitespace().toLowercase().trim()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';
               } else {
                   System.debug('6: '+setUsrLoc);
                   formatUsrName = con.Lastname.deleteWhitespace().toLowercase().trim()+'.'+con.Firstname.deleteWhitespace().toLowercase().trim()+'.'+con.middlename.deleteWhitespace().trim().substring(0,1).toLowercase()+'.cnastaff'+setUsrLoc+'@HAVNA.gmail';
 User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
         User u       = new User(Alias      = con.LastName.deleteWhitespace().trim().length() > 4 ? con.LastName.deleteWhitespace().trim().substring(0,4)+setUsrLoc: con.LastName+setUsrLoc,
                         Email              = con.email,
                         EmailEncodingKey   = 'UTF-8',
                         LastName           = con.LastName,
                         FirstName          = con.Firstname,
                         MiddleName         = con.Middlename,         
                         LanguageLocaleKey  = 'en_US',
                         LocaleSidKey       = 'en_US',
                         ProfileId          = p.Id,
                         UserRoleId         = groleid,          
                         TimeZoneSidKey     = 'America/New_York',
                         UserName           = formatUsrName);


Best Answer chosen by Sharon Crenshaw
Maharajan CMaharajan C
Hi Sharon,

The User Alias field has default size limit which is Maximum 8 characters. But code generating more than 8 character (Sminull90). 

Your code generating the alias dynamically so you have to handle the characters limit. And also avoid the null by using proper null check because am seeing null got genereated in alias Sminull90.
Alias      = con.LastName.deleteWhitespace().trim().length() > 4 ? con.LastName.deleteWhitespace().trim().substring(0,4)+setUsrLoc: con.LastName+setUsrLoc


I have certain list views on the custom objects which I want only certain group of people to see. For example I have two list views LV1 and LV2. Certain group of users should only see LV1 and certain others should see only LV2.I have created two public groups and restricted the visibility to 'Certain groups' but still the users are able to see both the list views LV1 and LV2.


Upon investigation I found that the users have system permission 'Manage Public List Views' in their profile.


What can I do to restrict the users from viewing the list views they are not supposed to see?

Best Answer chosen by Aneesha
I think only way is removing "Manage Public List Views" permissions on the profile coz profile permissions will be taken high priority.
Sharmila Sahu 12Sharmila Sahu 12 
I want to set record type while creating record in lightning component through e.force:createRecord. But I am not able to do so.
I tried using custom label and even I tried hardcoding still It is not showing correct record type and it is showing default record type for record creation.
Please find below code for javascript controller:
    doInit: function (component, event, helper) {
        var recId = component.get("v.recordId");

        var action = component.get("c.getdetails");
            "sId": recId
        action.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                console.log("Success" + JSON.stringify(response.getReturnValue()));
                component.set("v.sampleRequest", response.getReturnValue());
                var sampProd = component.get("v.sampleRequest");
                 if(sampProd.Lead__c === sampProd.Contact__c){
                    var Name = sampProd.Contact__r.Name;
                   var Name = sampProd.Lead__r.Name; 

                var createSampleProduct = $A.get("e.force:createRecord");
                var staticRecordLabel = $A.get("$Label.c.UsCanSampleProductRecordType");
                    "entityApiName": "Sample_Product__c",
                    "RecordTypeId": '0121b0000004aeSAAQ',
                    "defaultFieldValues": {
                        'Sample_Request__c' : component.get("v.recordId"),
                        'Name__c': Name,                    
            } else {

I tried hardcoding:
              var staticRecordLabel = $A.get("$Label.c.UsCanSampleProductRecordType");
                    "entityApiName": "Sample_Product__c",
                    "RecordTypeId": '0121b0000004aeSAAQ',

I have tried using:

            var staticRecordLabel = $A.get("$Label.c.UsCanSampleProductRecordType");
                    "entityApiName": "Sample_Product__c",
                    "RecordTypeId": staticRecordLabel ,

it is just showing for 1 sec 
UsCanSampleProductRecordType and then it is taking me to record creation page with default record type.

Please help. 
Best Answer chosen by Sharmila Sahu 12
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sharmila,

Greetings to you!

You need to use recordTypeId instead of RecordTypeId as lightning is based on aura framework which is a type of JavaScript and JavaScript is case sensitive so lightning is case sensitive.

Please refer to the below links which might help you further.


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

On the task there is a WhatId and a WhoId. Sometimes the WhatId is filled in and others have the WhoId filled in. In which situations is one used over the other?



Best Answer chosen by Admin (Salesforce Developers) 

WhoID refers to people things.  So that would be typically a Lead ID or a Contact ID

WhatID refers to object type things.  That would typically be an Account ID or an Opportunity ID

Salesforce GeekSalesforce Geek 
Hi There,

I’m newbie to Salesforce.

I would like to know the syntax “How to subtract one minute and two minutes from the current time”? I have checked in Datemethods in Apex documentation. No luck found.

Can anyone help?

Best Answer chosen by Salesforce Geek
PratikPratik (Salesforce Developers) 

This will work:

For 1 minute:   NOW() - (1/1440)
For 2 minutes:  NOW() - (2/1440)


P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
Hi All,
As of now, Case page layout has Product Pick list, and we can select only one Product and it mainted by Pick List Values.
What I am looking is that, When we create a Case, we should able to select Multiple Products to that Case. How we can achieve this?.

Do we need to create a Junction Object between Cases and Product?.
I think Junction Object is not going to support for Product as Product Standard object is going to be Detail Side of Junction Object, which is not supported by Salesforce.

Please correct me if I am wrong.
Also, please suggest me an alternative methods.

Best Answer chosen by Naren9
Boss CoffeeBoss Coffee
A Junction Object should work fine for this scenario. After a Case is created, you can create however many junction records as there are products you need to relate to the Case. You won't be able to make a Master-Detail Lookup to Product though, but you can use a regular Lookup and it should serve the same purpose of connecting the products to the Case.
Suzanne WasnerSuzanne Wasner 
I know I have completed the challenge correctly but keep getting this error. Note that the challenge has you create a "custom" object, not a "customer" object as stated in the error. I would like my 500 pts, please. :-)
Best Answer chosen by Suzanne Wasner
Ajay K DubediAjay K Dubedi
Hi Suzanne,

Remember, this module is meant for Lightning Experience. When you launch your hands-on org, switch to Lightning Experience to complete this challenge.

Please try the below steps:

1. You create new Trailhead Playground.
2. Click the Object Manager tab.
4. Click Create | Custom Object in the top right corner.
5. For Label, enter 'Offer'.
6. For Plural Label, enter 'Offers'.
7.Object Name 'Offer'.
8.Record Name 'Offer Name'.
9.Data type 'Auto Number'.
10.Display format 'OF-{0000}'.
11.string number 123.
12. Check the box for Launch New Custom Tab Wizard after saving this custom object.
13. Leave the rest of the values as default and click Save.
14. Select your desired Tab Style and click Next, Next, and Save.
15. Then goto Fields & Relationships in 'Offer' object and click 'New' button in top right corner.
16. In data type select Currency and click next.
17. For Label, enter 'Offer Amount'.
18. Select your desired Tab Style and click Next, Next, and Save.
19. In data type select Date and click next.
20. For Label, enter 'Target Close Date'.
21. Select your desired Tab Style and click Next, Next, and Save.

Please let me know if you have any query.
Please mark it as best Answer if you find it helpful.

Thank You
Ajay Dubedi
Dippan PatelDippan Patel 
Hi All, 

I am using Source Code Scanner for scanning my code. But it isn't identifying all the issues that come with Salesforce's security report. 

How do I identify all the issues before submitting my app again? 

Thank you. 
Best Answer chosen by Dippan Patel
VinayVinay (Salesforce Developers) 
Hi Dippan,

Try to check below tools that can help you or can you re-try scanning again.