+ Start a Discussion
Manjunath S 85Manjunath S 85 

Hi Trailblazers,

I am stuck in Step 3 of the Advanced Apex Specialist badge where I'm getting this error:

"Ensure that the getFamilyOptions method returns the correct picklist values."

I have only the 4 picklist values: 
User-added image

The getter method for the FamilyOptions property is defined here:

public static List<SelectOption> GetFamilyOptions(){
        List<SelectOption> familySelections = new List<SelectOption>();
        familySelections.add(new SelectOption(Constants.SELECT_ONE,Constants.SELECT_ONE));
        for(Schema.PicklistEntry ple : Constants.PRODUCT_FAMILY){
            familySelections.add(new SelectOption(ple.getLabel(),ple.getValue()));
        system.debug('>>>>> familySelections >>>>>>>> '+familySelections);
        return familySelections;

Can somebody please help me in figuring out what I am doing wrong here?
Best Answer chosen by Manjunath S 85
Manjunath S 85Manjunath S 85

I had mistakenly marked the method static. Making it a instance method worked and I'm now able to proceed.
Developer BaseDeveloper Base 
Hey guys, I installed VSCode, authorized my developer sandbox and retrieved all metadata including objects and fields. Yet those field names do not autopopulate as you can see on the screenshot. Is there a way to fix this? Thank you alot. If your answer fixes my problem I will mark it as the best answer.
User-added image
Best Answer chosen by Developer Base
VinayVinay (Salesforce Developers) 

Autocomplete depends on the metadata cache. To fix this, go to View > Command Palette (Ctrl-Shift-P), and type in "sobject". You should see a command "SFDX: Refresh sobject definitions." After that command runs, you should get autocomplete for all custom objects and fields.

Review below links which has fixes for similar issue.


Hope above information was helpful.

Vinay Kumar
Matthew Hayes 46Matthew Hayes 46 
I am getting the following error message"field integrity exception: Pricebook2Id (cannot change pricebook on opportunity with line items)".  I am not sure what this means.  We had an opportunity come in and after we went through the process realized that the price book was incorrect.  We need to update the price book so we can update the price.  FYI, I am an admin and not a developer.
Best Answer chosen by Matthew Hayes 46
VinayVinay (Salesforce Developers) 
Hi Mathew,

Yes,  I have shared sample links to review on related error.

Please mark as Best Answer if above information was helpful so that it can help others in the future.

Vinay Kumar
Vinod Krishnan 33Vinod Krishnan 33 
Hi there,

'Projects' in our world is a created object. I'm trying to put in place a validation rule to prevent users (with the exception of a few, of course) from changing the status a project out of 'In Execution'. The below code, is an attempt to prevent the status from being changed from 'In Execution' to 'Lead'. The syntax is ok. But the code does not work. I'm seeking help to fix it. Thanks a ton!

(PRIORVALUE(Status__c) = "In Execution"),
(ISPICKVAL (Status__c,"Lead")),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Integration Profile" ,
$Profile.Name <> "Jobscience Administrator",
$UserRole.Name <>"Contract Team"
Best Answer chosen by Vinod Krishnan 33
Hi Vinod,

Try like this for adding more status values:
TEXT(PRIORVALUE(Status__c)) = "In Execution",
(ISPICKVAL (Status__c,"Lead") ||ISPICKVAL (Status,"Inquiry") ||ISPICKVAL (Status,"Proposal") ||ISPICKVAL (Status,"Lost") ||ISPICKVAL (Status,"Cancelled")),
$Profile.Name <> "System Administrator",
$Profile.Name <> "Integration Profile" ,
$Profile.Name <> "Jobscience Administrator",
$UserRole.Name <>"Contract Team")

Hope this helps!

Karthik GunasekaranKarthik Gunasekaran 
Hi, i creates a record page(selected Template is with 3 sections) for my lightning console. I added a custom lightning component "Interaction Log" to the right side section. On click of "save log" i need to open another lightning component in the same section where i highlighted. Anyone can plz help me to sort this out as it is opening always as a seperate subtab(which i don't want).
User-added image
Best Answer chosen by Karthik Gunasekaran
Gopal ChoudharyGopal Choudhary
You need three components in total, lets say my third component studysMainCmp and is as below.

<aura:component access="global" implements="force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="c:navigateToCmp" action="{!c.NavigateComponent}" />



doInit : function(component, event, helper) {
    $A.createComponent("c:studys", {

    }, function(newCmp) {
        if (component.isValid()) {
            component.set("v.body", newCmp);

NavigateComponent : function(component, event, helper) {
if(event.getParam("navigate") == "true")
    $A.createComponent("c:studyDetail", {

        }, function(newCmp) {
            if (component.isValid()) {
                component.set("v.body", newCmp);

In your study component the button action should fire an event, the button function will be as below

buttonFunction : function(component, event) {
    var event = $A.get("e.c:navigateToCmp");
        "navigate" : "true"

Lightning event named navigateToCmp will be as below:

<aura:event access="global" type="APPLICATION" description="Event template" >
    <aura:attribute name="navigate" type="Boolean" default="false"/>

It worked for me, hope it helps for you.
Rajath Kundapur 17Rajath Kundapur 17 

I have 2 array

-> The First array consists of all the values.

-> In the second array, consist of selected values  Here I need to filter the value which is already present

Best Answer chosen by Rajath Kundapur 17
Danish HodaDanish Hoda
Hi Rajath,
secondArray.forEach(elem => {
      const index = firstArray.indexOf(elem);
      firstArray.splice(index, 1);

Best Answer chosen by Suraj Ade
Maharajan CMaharajan C
Hi Suraj,

Try the below script in anonymous window on developer on and let me know if there is any error:
Id ProfileX = '00e0K000001kzB4';  // user
Id ProfileY = '00e28000000HnvN';
List<user> users = [Select Id, ProfileId from user where ProfileId = : ProfileX];
for(user u : users)
	u.ProfileId = ProfileY;
	update users;
    system.debug(' === Success === ');
catch(Exception ex){
	system.debug( ' Exception ==> ' + ex.getMessage() );

Julia BJulia B 
Hi, I am trying to return on formula text type field, the outcome if 3 fields are empty to return text inactive if they are not empty and filled in return text active.

Can this be achieved? below is what I have so far :
IF(ISBLANK(Account_Name__c)&& ISBLANK(Name) && ISBLANK( CtM_Close_Date__c ) ,"Inactive","Active")
Best Answer chosen by Julia B
Hello, Julia. Based on the qay you stated the requirements, it seems like you want an OR() statement inside the IF() statement as follows:

If any of the fields have a value, the formula evaluates to "Active". Otherwise, they are all blank and the formula evaluates to "Inactive".

Steve Connelly 5Steve Connelly 5 
I have the starting quarter for an opp. and the number or quarters the opp spans.

I have a trigger that creates new related records for the Opp. Using the above information, how do i loop the trigger to name these new related records with subsequest quarter names?

Thank smuch,
Best Answer chosen by Steve Connelly 5
AbhishekAbhishek (Salesforce Developers) 
Hi Steve,

The below blog might similar to your requirement,


Check it once.

Steve Connelly 5Steve Connelly 5 
Good morning all. I have a trigger that creates new records related to opportunities.

I have everything working but my loop and i am stuck. I am very new to coding and would really appreciate some assistance.

This iwhat I have so far and everything works...except....
                            //while loop create record process                     	
              				decimal counter = 0;
              				while (counter < opportunityList.Quarters_Spanned_op__c)
                			Open_Quarter__c oq           = new Open_Quarter__C();
                			Quarter_Number__c qn		 = new Quarter_Number__c();
                			oq.Amount_Per_Quarter_oq__c  = opportunityList.Amount_per_Quarter_op__c;
                			oq.Close_Date_oq__c          = opportunityList.CloseDate;
                			oq.Name            			 = opportunityList.Quarter_Created_op__c;
                			oq.Opportunity_Name_oq__c    = opportunityList.Id;
                			oq.Quarters_Spanned_oq__c    = opportunityList.Quarters_Spanned_op__c;

                            }//end while loop                                             
When I create each new record I need it to populate a field in that record with escalating quarter names. Right now it creates the right nimber of records but they all have the same quarter name in them which the starting quarter of the opp.

Now I have four custom formula fields in the opp that I can use.
  • One with the name for the quarter when the opp was created in this format: 2019-Q1 etc
  • One with the year the opp was started as a number "2019"
  • One with the starting quarter as a number (1-4)
  • One with the number of quarters the opp spanse based upon the created and close dates also expressed as a number.
I was told that I can loop the quarters within the year so that if an opp ovewrlaps years i can increment the rear number and reset the quarter to one and continue the loop for the same number of times as the quarters spanned (I already have that part)

But the rest is all very new to me. How do I build these nested loops with an output for each iteration that looks like this "2019-Q1" that I can use in creating my new records.

I am really stuck here so any help at all will be greatly appreciated.
Best regards,
Best Answer chosen by Steve Connelly 5

Hi Steve,

You can create one formula field, where you can define the structure as  YYYY-Q1 (find link below, )


Use that formula field to assign to that field on opporunity.