+ 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
Hi,

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) 
Hi,

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.

https://salesforce.stackexchange.com/questions/254478/how-to-get-custom-object-fields-displaying-in-code-completion-in-vs-code/254556

Hope above information was helpful.

Thanks,
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.

Thanks,
Vinay Kumar
Nevin O'Regan 3Nevin O'Regan 3 
Hi guys,

I've created a custom screen flow and I want to add it to a community page, launched from a custom button on the Homepage. 
The flow guides users through creating a case. I am getting the following error when I add the component to the page: "Action failed: c:CustomCaseCommunityComponent$controller$init [flowData is not defined]"

This is my component. 

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,forceCommunity:availableForAllPageTypes,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global">

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <lightning:flow aura:id="flowData"/>
    
</aura:component>


({
init : function (component) {
var flow = component.find(flowData);
flow.startFlow(CaseFlow);
},
})
Best Answer chosen by Nevin O'Regan 3
SUCHARITA MONDALSUCHARITA MONDAL
Nevin,
Just update your code as below:
var CaseFlow = component.find("flowData");
flow.startFlow(CaseFlow);  

Thanks,
Sucharita
 
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!

AND(
ISCHANGED(Status__c),
(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
SarvaniSarvani
Hi Vinod,

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

Hope this helps!

Thanks
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).
Thanks,
Karthik
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}" />

    <div>
        {!v.body}
    </div>
</aura:component>

Controller:

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");
    event.setParams({
        "navigate" : "true"
    });
    event.fire();
},

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"/>
</aura:event>

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 => {
   if(firstArray.includes(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;
}
try{
	update users;
    system.debug(' === Success === ');
}
catch(Exception ex){
	system.debug( ' Exception ==> ' + ex.getMessage() );
}


Thanks,
Maharajan.C
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
TechingCrewMattTechingCrewMatt
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(
   NOT(
      OR(
         ISBLANK(Account_Name__c), 
         ISBLANK(Name),
         ISBLANK(CtM_Close_Date__c)
      ) 
   ),
   "Active",
   "Inactive"
)

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

Thanks,
Matt
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,
Steve
Best Answer chosen by Steve Connelly 5
AbhishekAbhishek (Salesforce Developers) 
Hi Steve,

The below blog might similar to your requirement,

https://developer.salesforce.com/forums/?id=906F00000009F6RIAU

Check it once.