+ Start a Discussion
Timothy SmithTimothy Smith 
Attempting to access the variables MIlestone1_Project__c has a Lookup relationship to Account with relationship name: `Projects__r'.
List<Account> accList = [SELECT Id, Name, EHR_Status__c, PM_Status__c,
                                    Project_Imp_Status__c, Other_Status__c,(select Client_Advisor_Email__c,
                                                                                 from Projects__r) 

                             FROM Account
                             WHERE Id IN :AcctIds];
List<String> emailAdds = new List<String>();
                 for (Account al: accList) {

Any help is greatly appreciated.
Best Answer chosen by Timothy Smith
Boss CoffeeBoss Coffee
Projects__r will be a list for each Account, so it'll be something like the following.
for(Account al : accList) {
  for(Project__c proj : al.Projects__r) {
    // ...etc
azhar khasimazhar khasim 
Hello guys,

Need help in these for writing a validation rule

When field: 'Candidate Final Status" is not blank, then field: "Interviewer" and field: "Comments" is mandatory Validation Rule

Please help me from thiss...

Azar Khasim

Best Answer chosen by azhar khasim
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
try this formula
AND( NOT( ISPICKVAL( Candidate_Final_Status__c ,'' )) ,
(OR(ISBLANK(F2F_Interviewer__c ),ISBLANK( F2F_Comments__c ))))

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards

User-added image

I wan to filter by date of current year, how can i do it ?
I can filter by date but do i have option to filter by YEar()

thank you in advance 
Best Answer chosen by Sandrine
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi sandrine,
It is not possible .With roll up summary we can calculate the count,sum, minimum value, or maximum value of a field in the detail records.We can only summarize data records using Rollup fields.You can use Reports to filter records.
Please refer below link which might help you further

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
Foram Rana RForam Rana R 
User-added image
While clicking on button called Visualforce page.
Best Answer chosen by Foram Rana R
Khan AnasKhan Anas (Salesforce Developers) 

Greetings to you!

1. From Setup, click Object Manager, then click Lead.
2. Click Buttons, Links, and Actions, then New Button or Link.
3. Name the button.
4. Select List Button.
5. Content Source: Visualforce
6. Select your visualforce page. The visualforce page should use the object's standard controller.
<apex:page standardController="Lead" recordSetVar="leads">
      <apex:pageBlock title="Edit Stage and Close Date" mode="edit">
         <apex:pageMessages />
         <apex:pageBlockTable value="{!leads}" var="opp">
            <apex:column value="{!opp.Name}"/>
            <apex:column headerValue="Email">
               <apex:inputField value="{!opp.Email}"/>
            <apex:column headerValue="Phone">
               <apex:inputField value="{!opp.Phone}"/>
7. Add button to the layout:
Stay in the Lead object, click Search Layouts for Salesforce classic menu, then select Edit under ListView.
Add your button to the "Selected Buttons".

Note: Mass actions aren’t supported on the most recent records list. They are only available on list views.

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




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
Abhishek MallikAbhishek Mallik 

I am trying to solve a  trail challeng on Visualforce standard list controller (Visualforce standard list controller trail (https://trailhead.salesforce.com/content/learn/modules/visualforce_fundamentals/visualforce_standard_list_controllers)). I have written the following code for the same:
<apex:page standardController="Account" recordSetVar="accounts"> 
<apex:repeat value="{! accounts }" var="a"> 
 <li><apex:outputLink value="{! a.id}"></apex:outputLink> </li> 

Here while checking, I am getting following error:
The page does not bind to the record ID value (in order to link to the record detail page)
Best Answer chosen by Abhishek Mallik
Khan AnasKhan Anas (Salesforce Developers) 
Hi Abhishek,

Greetings to you!

For each record, the repeater uses the apex:outputLink component to link to the respective record detail page. Please try below code:
<apex:page standardController="Account" recordSetVar="accounts" >
        <apex:repeat var="a" value="{!accounts}" rendered="true" >
                <apex:outputLink value="/{!a.Id}" >
                    <apex:outputText value="{!a.Name}"/>

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
Arpitha MArpitha M 
Apex Class:

public class createCorporate {
    public Account acc {get;set;}
    public List<Contact> conList {get;set;}
    public AccountWrapper.cls_billing cbilling {get;set;}
    public AccountWrapper.cls_personal personal {get;set;}
    public Id Id{get;set;}
    public String message{get;set;}
    public string updatedmessage{get;set;}
    CorporateResponse core = new CorporateResponse();

    public createCorporate(ApexPages.StandardController controller){
        acc = (Account) controller.getRecord();
        Id = acc.Id;
    public void createCorporatedata(){
        HMACGenearatorHandler hg = new HMACGenearatorHandler();
        fromJSON obj = new fromJSON();
        HMACGenearatorHandler.Wrapper wr;
        wr = hg.createJson();
        if(wr.response != null){
            obj = obj.parse(wr.response);
            string accesssecret = obj.hotelogix.response.accesssecret;
            string accesskey = obj.hotelogix.response.accesskey;
        acc= new Account();
        Contact con = new Contact();
        AccountWrapper aw = new AccountWrapper();
        AccountWrapper.cls_personal personal = new AccountWrapper.cls_personal();
        AccountWrapper.cls_billing cbilling = new  AccountWrapper.cls_billing();
        acc= [Select id,Name,taxCode__c,Account_Address__c,Account_State__c,Account_City__c,Account_Pincode__c,
              BillingStreet,BillingCity,BillingCountry,BillingState,BillingPostalCode,(Select id,Title,name,Type__c,Contact_Designation__c,
              from contacts where Type__c != 'Others' ORDER BY Type__c ASC LIMIT 2) from Account where id =:Id];
        conList= acc.contacts;
        for(Contact c : conList){
            if(c.Type__c =='Personal'){
                personal.salutation= c.Title;
                personal.designation =c.Contact_Designation__c;
                personal.dob =string.valueOf(c.Birthdate);
                personal.email =c.Email;
                personal.faxNo = c.Fax;
                personal.fName = c.FirstName;
                personal.gender =c.Gender__c;
                personal.lName = c.LastName;
                personal.mobileNo =c.MobilePhone;
                personal.phoneNo =c.Phone;
                personal.website ='';               
            if(c.Type__c =='Billing'){
                cbilling.salutation= c.Title;
                cbilling.designation =c.Contact_Designation__c;
                cbilling.dob =string.valueOf(c.Birthdate);
                cbilling.email =c.Email;
                cbilling.faxNo = c.Fax;
                cbilling.fName = c.FirstName;
                cbilling.gender =c.Gender__c;
                cbilling.lName = c.LastName;
                cbilling.mobileNo =c.MobilePhone;
                cbilling.phoneNo =c.Phone;
                cbilling.website ='';      
        AccountWrapper.cls_office office = new AccountWrapper.cls_office();
        office.address = acc.Account_Address__c;
        office.city = acc.Account_City__c;
        office.country ='India';
        office.zip = String.valueOf(acc.Account_Pincode__c);
        AccountWrapper.cls_billingAddress billingad = new AccountWrapper.cls_billingAddress();
        billingad.companyName = acc.Name;
        billingad.address = acc.BillingStreet;
        billingad.city = acc.BillingCity;
        billingad.country = acc.BillingCountry;
        billingad.zip = acc.BillingPostalCode;
        AccountWrapper.cls_addresses addresses = new AccountWrapper.cls_addresses();
        addresses.office = office;
        addresses.billingaddress = billingad;
        AccountWrapper.cls_contacts contacts = new AccountWrapper.cls_contacts();
        contacts.personal = personal;
        contacts.billing = cbilling;
        AccountWrapper.cls_creditCardDetail carddetails = new AccountWrapper.cls_creditCardDetail();
        carddetails.nameOnCard ='Puja';
        carddetails.cardType ='Visa';
        carddetails.cardNo ='4111111111111111';
        carddetails.cvc ='256';
        carddetails.expiryMonth ='05';
        carddetails.expiryYear ='2022';
        carddetails.zip ='256';
        carddetails.address ='noida';
        carddetails.state ='delhi';
        carddetails.country ='India';
        List<AccountWrapper.cls_hotels> hotels = new List<AccountWrapper.cls_hotels>();
        AccountWrapper.cls_hotels hotel = new AccountWrapper.cls_hotels();
        hotel.id ='51237';
        AccountWrapper.cls_data data = new AccountWrapper.cls_data();
        data.taxCode =acc.taxCode__c;
        data.addresses= addresses;
        data.contacts = contacts;
        data.creditCardDetail = carddetails;
        data.hotels = hotels;
        AccountWrapper.cls_request req = new AccountWrapper.cls_request();
        req.key =accesskey;
        req.data = data;
        AccountWrapper.cls_hotelogix hlogix = new AccountWrapper.cls_hotelogix();
        hlogix.datetime_x =wr.myDate;
        hlogix.request = req;
        aw.hotelogix = hlogix;
        String corporateJSON = JSON.serialize(aw);
        corporateJSON = corporateJSON.replace('datetime_x', 'datetime');
        system.debug('corporateJSON: '+ corporateJSON); 
        String mac2=hg.generateHmacSHA1Signature(corporateJSON,accesssecret);
    public static void sendcreateCorpRequest(String corporatejson,String mac2){
        System.debug('mac2+++  '+ mac2);
        HttpRequest req = new HttpRequest();
        req.setHeader('Content-Type', System.label.Content_Type); 
        Http http = new Http();
        HTTPResponse res = http.send(req);
           System.debug('createcorp++++ '+res.getBody());
           System.debug('GET STATUS +++ '+res.getStatus());
           String response = res.getBody();
           CorporateResponse core = new CorporateResponse();
           core = core.parse(response);
           String message = core.hotelogix.response.status.message;
           String updatedmessage = core.hotelogix.response.hotels[0].updateStatus.message;

Visualforce Page:

<apex:page standardController="Account" extensions="createCorporate" action="{!createCorporatedata}">
Best Answer chosen by Arpitha M
Arpitha MArpitha M
The static should be removed from sendcreateCorpRequest() method. 
Example select id from account where id iN:accList 
Best Answer chosen by Praveenchandu
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi praveen,
list<list<sobject>> acc = new list<list<sobject>>();
acc = [FIND 'test' RETURNING Account(id,name WHERE id in :ids),contact(id,name WHERE id in :ids)];
list<id> ids1 = new list<id>();
for(sobject a : acc[0]){
for(sobject c:acc[1]){
//you can use this way to get ids in seperate lists
Account [] accounts = ((List<Account>)acc[0]);
Contact [] contacts = ((List<Contact>)acc[1]);


Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
Hello All,
Implementing a basic navigation component. No error while pushing the code to the scratch org, but when i click on the navigation buttons no action. Below is the image of our component on Account Record page.

User-added image

    <lightning-card title="Navigation Service in Lightning Web Component">
        <lightning-card title="Navigation to Record Page">
                <lightning-button label="New Record Page" onclick={navigateToNewRecordPage}></lightning-button>
                <lightning-button label="Edit Record Page" onclick={navigateToEditRecordPage}></lightning-button>
                <lightning-button label="View Record Page" onclick={navigateToViewRecordPage}></lightning-button>

import { LightningElement,api } from 'lwc';
import {NavigationMixin} from 'lightning/navigation'
export default class NavigationinLWC1 extends LightningElement {
    @api recordId;
                "actionName": "new"

                "actionName": "edit"

                "actionName": "view"

Kindly help me out.
Best Answer chosen by Vikram23
Maharajan CMaharajan C
HI Vikram,

Your JS File have lot of small mistakes:

Just copy the below JS File code then it will work:

I have also bolded the area's in below where you have done the mistakes:


    <lightning-card title="Navigation Service in Lightning Web Component">
        <lightning-card title="Navigation to Record Page">
                <lightning-button label="New Record Page" onclick={navigateToNewRecordPage}></lightning-button>
                <lightning-button label="Edit Record Page" onclick={navigateToEditRecordPage}></lightning-button>
                <lightning-button label="View Record Page" onclick={navigateToViewRecordPage}></lightning-button>


/* eslint-disable no-console */
/* eslint-disable no-alert */
import { LightningElement,api } from 'lwc';
import {NavigationMixin} from 'lightning/navigation';                             
export default class LightningNavSamples extends NavigationMixin(LightningElement) {
    @api recordId;
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Account',
                actionName: 'new'
        console.log('Record Id ==> '+ this.recordId);
                "actionName": "edit"
        console.log('Record Id ==> '+ this.recordId);
                "actionName": "view"

Meta-XML File:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">

Maze LinnMaze Linn 
I am trying to write test coverage for a method and receiving the error "Attempt to de-reference a null object" when I run the test.  Below is my test class, can anyone guide me in the right direction with this?

Test class:

static testmethod void getselectOptionsTest(){
        Id RecordTypeIdPropAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Franchisee').getRecordTypeId();
        Account fAcct = new Account(Name = 'Test', RecordTypeId=RecordTypeIdPropAccount);
        insert fAcct;
        sObject objObject = [SELECT Id, Name FROM Account WHERE Name = 'Test' LIMIT 1];
        String fld = 'RetailerCategory';
        multiPicklistCtrl.getselectOptions(objObject, fld);

Original method:

    public static List <String> getselectOptions(sObject objObject, string fld) {
          system.debug('objObject --->' + objObject);
          system.debug('fld --->' + fld);
          List < String > allCats = new list < String > ();
          // Get the object type of the SObject.
          Schema.sObjectType objType = objObject.getSObjectType();
        // Describe the SObject using its object type.
          Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
          // Get a map of fields for the SObject
          map < String, Schema.SObjectField > fieldMap = objDescribe.fields.getMap();

          // Get the list of picklist values for this field.
          list < Schema.PicklistEntry > values =

          // Add these values to the selectoption list.
          for (Schema.PicklistEntry a: values) {
          system.debug('allCats ---->' + allCats);
          return allCats;    
Best Answer chosen by Maze Linn
Dushyant SonwarDushyant Sonwar
Also if RetailerCategory is custom field then it would be RetailerCategory__c in fld variable.
Dilushan De SilvaDilushan De Silva 
Hi Everyone, I am going to create a flow to create records in opportunity object. I am going to add a quick action button in the accounts  which calls this flow. I want the account ID and Name linked to the new opportunity record that will be created. Any ideas how to do this?
Best Answer chosen by Dilushan De Silva