• Shubham saini 14
  • NEWBIE
  • 29 Points
  • Member since 2017
  • Associate Consultant
  • VirtuoWhiz Consulting Pvt. Ltd.


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 28
    Replies
Hi I am currently stuck on step 2 of the lightning component framework super badge. with this error. I have created both the lightning app page and lightning  app with the same layout but the verification wont go through. Please helpUser-added image

/*** BoatDetails.cmp ***/

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="id" type="Id" />
    <aura:attribute name="simpleRecord" type="Object" />
    <aura:attribute name="recordError" type="String" />
    <aura:attribute name="selTabId" type="String" />
    <aura:handler event="c:BoatSelected" action="{!c.onBoatSelected}" />
    <aura:handler name="BoatReviewAdded" event="c:BoatReviewAdded" action="{!c.onBoatReviewAdded}" />
    <force:recordData aura:id="service"
      recordId="{!v.id}"
      fields="Id,
              Name,
              Description__c,
              Price__c,
              Length__c,
              Contact__r.Name,
              Contact__r.Email,
              Contact__r.HomePhone,
              BoatType__r.Name,
              Picture__c"
      mode="VIEW"
      targetRecord="{!v.boat}"
      targetFields="{!v.simpleRecord}"
      targetError="{!v.recordError}"
      recordUpdated="{!c.onRecordUpdated}"
      />
    <aura:if isTrue="{! !empty(v.boat)}">
        <lightning:tabset aura:id="details" selectedTabId="{!v.selTabId}">
            <lightning:tab label="Details" id="Details">
                <c:BoatDetail boat="{!v.simpleRecord}" />
            </lightning:tab>
            <lightning:tab label="Reviews" id="boatreviewtab">
                <c:BoatReviews boat="{!v.boat}" aura:id="BR" />
            </lightning:tab>
            <lightning:tab label="Add Review" id="addReview">
                <c:AddBoatReview boat="{!v.boat}" aura:id="ABR" />
            </lightning:tab>
        </lightning:tabset>    
    </aura:if>
</aura:component>

/*** BoatDetailsController ***/

 onBoatReviewAdded : function(component, event, helper) {
        component.set("v.selTabId","boatreviewtab");
    },

Hi All,
I am having rerender issue in VF page. 
Problem:
when I am putting reRender and rendred together in a commandbutton, when clicking on commandbutton it is not redirecting to the actual page what I mentioned on pagereference method.

This is my code
Apex class:
public class SaveRecords{
 public PageReference saveToCollege() {
    
        Boolean saved = false;
        saved = Class2.saveCollegeData(WrapperData.result,collegeId);
        if(saved)
        {
            PageReference pg=new PageReference('/'+collegeId );
            return pg;
        }
        
    } 
	}
VF Page code:
<apex:page>
	<apex:form>
	  <apex:pageBlock id="mySelectedPB1">
	  
			some code
	  </apex:pageBlock>
	 <apex:commandButton action="{!linkToProject}" value="Link to Project" rerender="mySelectedPB1" rendered="{!if(WrapperData.result != null,true,false)}"/>
	</apex:form>
	</apex:page>

Please suggest me where it is going wrong

Thanks in Advance​
 
Hello Everyone,

Need help on generating 3 char Identifier for Salesforce Record in below format :
[0-9][A-Z][A-Z]
e.g. 0AA,0AB,0AC....0AZ,0BA,0BB........9ZZ

Do we have library methods to generate such combinations ?
If not Please help in implementing the algorithm to generate 3 char Identifier for each of the records.
  • March 27, 2018
  • Like
  • 0
Hi everyone,
I'm getting this error at Step 6: "The BoatDetails component must use force:recordData to load the appropriate list of fields from Boat__c into the boat attribute of the component."

I believe it's because my "auraMethodResult" happens to be undefined for some reason.. Can anyone help me with this, please? Thank you so much :-)
BoatSearch:
<aura:handler name="formsubmit" event="c:FormSubmit" action="{!c.onFormSubmit}"  phase="capture"/>
   
 
    <div>
    <lightning:card class="findBoatCard" title="Find a Boat">
        <c:BoatSearchForm />    
    </lightning:card>     
    </div>
    
    <lightning:card title="Matching Boats">
        <c:BoatSearchResults aura:id="child"/>
    </lightning:card>
</aura:component>


BoatSearchController:
({

    onFormSubmit : function(component, event, helper){
 
        var formData = event.getParam("formData");
        var boatTypeId = formData.boatTypeId;
        var child = component.find("child");
        var auraMethodResult = child.search(boatTypeId);
        console.log("auraMethodResult: " + auraMethodResult);
    },

})

BoatSearchResults:
 	<aura:attribute name="boat" type="BoatType__c"/> 
    <aura:attribute name="boats" type="Boat__c[]"/> 
    <aura:attribute name="selectedBoatId" type="Object"/> 
    
<aura:handler name="boatClickEvent" event="c:BoatSelect" action="{!c.onBoatSelect}" />

    <aura:method name="search" action="{!c.doSearch}"> 
        <aura:attribute name="boatTypeId" type="Object" /> 
    </aura:method>
    
<lightning:layout multipleRows="true" horizontalAlign="center">

    <aura:iteration items="{!v.boats}" var="boat"> 
        <lightning:layoutItem   flexibility="grow" class="slds-m-right_small" >   
        
                <c:BoatTile boat="{!boat}" selected="{! boat.Id == v.selectedBoatId ? true : false }"/> 
            
        </lightning:layoutItem>
    </aura:iteration>

    
    <aura:if isTrue="{! empty(v.boats)}"> 
        <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
            <ui:outputText value="No boats found" />
        </lightning:layoutItem>
 
    </aura:if>
    
    </lightning:layout>

BoatSearchResultsController:
({
	doSearch : function(component, event, helper) {
      
        var params = event.getParam('arguments');
        
        component.set("v.boatTypeId", params.boatTypeId);
        helper.onSearch(component);
     
    },
    
    onBoatSelect: function(component, event, helper){
        var selectedBoatId = event.getParam('boatId');
        component.set("v.selectedBoatId", selectedBoatId);
    }
})
 
BoatTile
	<aura:attribute name="boat" type="Boat__c"/> 
    <aura:attribute name="selected" type="Boolean" default="false"/> 

      <aura:registerEvent name="boatClickEvent" type="c:BoatSelect"/>
     <aura:registerEvent name="boatSelected" type="c:BoatSelected"/>
    

    
    <lightning:button aura:id="boatTileButton" class="{!v.selected == 'true' ? 'tile selected' : 'tile'}" onclick="{!c.onBoatClick}">
        <div style="{! 'background-image:url(\'' + v.boat.Picture__c + '\'); '}" class="innertile">
            
            <div class="lower-third">
                <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>

            </div>
        </div>
    </lightning:button>  
BoatTileController:

({
    onBoatClick : function(component, event, helper) {
      
       var boatType = component.get("v.boat");
        console.log('Boat asd'+boatType);
        var boatSelectEvt = component.getEvent("boatClickEvent");
        boatSelectEvt.setParams({"boatId" :boatType.Id});
        boatSelectEvt.fire();
        
 
        var appEvent = $A.get("e.c:BoatSelected");
        var boat = component.get("v.boat");  
        appEvent.setParams({
            "boat": boat
        });
        appEvent.fire();    
     }
})

 
Hi Gurus, 

I have a Visualforce page for a Survey form that saves entry in to a custom object (Survey) in Salesforce. Within this VF page, I have images of different countries flags which are links to the same survey but in a different language. i.e the french flag with be a link to another VF page but will be the same survey but in french.

Now my problem is that when the flag is click and goes to the different language page, the Survey ID in the web address bar is removed therefore the entry wouldnt be saved into the correct place in Salesforce.

So does any one please know I can transfer the ID from one VF page to another?

This is the Div Class for my UK Flag linking to the english version;
<div class="UK_Flag">
                   <a href="/apex/CustomerSatisfaction_EN"><apex:image id="UK_Flag" value="
                   {!URLFOR($Resource.UK_Flag)}" /></a>
       	 </div>

This is my Apex Class for keeping the ID in the address bar after clicking on the UK Flag but its not working:
public with sharing class CustomerSurvey{
public CustomerSurvey() {

}
 public PageReference UK_Flag () {
           PageReference pageref = new PageReference('/apex/CustomerSurvey_UK'); 
           pageref.getParameters().put('recordID', 'a0C3E000001yarn' + ''); 
           pageref.setRedirect(true); return pageref;
           return pageref;
}

}

Please if anyone know how I can resolve this issue, please let me know please!
Thanks!
 
I have a visualforce page being used in Lightning. The default Cancel button takes me to the home page of Lightning rather than the record page from where I clicked on the New button. However, it works fine in Classic. Any help would be really appreciated.

I have tried adding following method in the controller, but that didn't help.

public PageReference cancel(){     
        return controller.cancel();
    }

Visualforce Line: 
<apex:commandButton value="Cancel" action="{!cancel}"/>

Thanks,
Chetan
Hi,

i have created a component having three checkboxes - course 1 , course 2 and course 3.
also i have a button to select all courses.
My requirement is running a soql query and displaying the count of records for each course type ( the ones which are selected)

So far i have written this code:
<aura:component access="global">
    <aura:attribute name="selected" type="List" default="[]"/>
    <aura:attribute name="options" type="List" default="[{'label': 'Course 1', 'value': 'option1'}, {'label': 'Course 2', 'value': 'option2'},{'label': 'Course 3', 'value': 'option3'}]"/>
    <lightning:checkboxGroup
        aura:id="mygroup"
        name="checkboxGroup"
        label="Checkbox Group"
        options="{!v.options}"
        value="{!v.selected}"
        onchange="{!c.handleChange}"
        required="true" />

    <br/><br/>
    <lightning:button variant="brand" label="Select All" onclick="{!c.selectAll}"/> 
</aura:component>

SelectCheckBox.js
({
    selectAll : function(component, event, helper) {
        component.set("v.selected",['option1','option2','option3']);
    },

    handleChange : function(component, event, helper) {

    },
})


Can you all please give a sample code to proceed forward for the requirement?

Thanks​
  • March 15, 2018
  • Like
  • 0
 

my scenario is when i will click on new opportunity button a new opportunity page should open where i fill the details and click on save then it will redirect to the list page of opportunity where records save with edit and delete link when click on edit link edit page should open i have done till that but when i click on delete link it should deleted i am not abe to do for delete when i am deleting record a new bank page open
 

    <apex:page StandardController="Opportunity" Extensions="secondpage" >
        <apex:form >
        <apex:pageBlock >
    
        <apex:pageBlockButtons location="Top" >
         <apex:commandButton value="Save" action="{!saverec}"/> <br/><br/>
         
         <apex:commandLink action="{!editOpp}" value="Edit"/>
      <apex:param value="{!opp.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
      <apex:commandLink action="{!deleteOpp}" value="Delete" />
     <apex:param value="{!opp.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        </apex:pageBlockButtons>
        <apex:pageblockSection >
           <apex:inputfield value="{!opp.Name}" />
            <apex:inputfield value="{!opp.StageName}"/>
             <apex:inputfield value="{!opp.AccountId}"/>
             <apex:inputfield value="{!opp.Amount}"/>
            <apex:inputfield value="{!opp.closeDate}"/>
       </apex:pageblockSection>
                </apex:pageBlock>   
        </apex:form>
    </apex:page>

----

    public class secondpage {
    
       
        Public Opportunity opp{get;set;}
        Public String op1;
         public id accid{set;get;}
       public String selectedAccId {get;set;}
          public String selectedoppId{get;set;}
        public secondpage(ApexPages.StandardController stdController) {
            
       
            Opp= (Opportunity)stdController.getRecord();
               
            
        }
       
       
        public PageReference saverec() {
           
            insert opp;
           
            pagereference pr = new pagereference('https://c.ap6.visual.force.com/apex/Opp2');
           
            return pr;
        }
    
    
        public Pagereference editOpp()
     {
         
           PageReference ref = new PageReference('/'+selectedAccId+'/e?retURL=%2F'+selectedAccId);
            return ref;
     }
     
     public Pagereference deleteOpp()
     {
            return null;
    
            }
     }

----

    <apex:page Controller="mycontroller1">
    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockSection >
    <apex:pageBlockTable value="{!Opportunitylst}" var="op">
    <apex:column value="{!op.Name}"/>
    <apex:column value="{!op.StageName}"/>
    <apex:column value="{!op.Amount}" />
    <apex:column value="{!op.accountId}"/>
    <apex:column value="{!op.CloseDate}"/>
    <apex:column headerValue="Action" >
      <apex:commandLink value="Edit /" action="{!editOpp}">
        <apex:param value="{!op.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        </apex:commandLink>
        
        <apex:commandLink action="{!deleteOpp}" value="Delete"/>
     <apex:param value="{!op.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        
        
    </apex:column>                        
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

----
                        
    public class mycontroller1 {
    
        public List<Opportunity> Opp{get;set;}
        Public List<Opportunity> Opportunitylst{get;set;}
        public String selectedAccId {get;set;}
    
    
      public PageReference deleteOpp() {
              
opportunitylst=[select Name,AccountId,Amount,CloseDate,StageName from Opportunity where id=:selectedAccId];      
delete  opportunitylst;     
  return null;
              
              }
    
                 
                 
                 
        public mycontroller1(){
            Opportunitylst=[select Name,AccountId,Amount,CloseDate,StageName from Opportunity order by createdDate DESC limit 10 ];
         }
        public Pagereference editOpp()
     {
         p
           PageReference ref = new PageReference('/'+selectedAccId+'/e?retURL=%2F'+selectedAccId);
            return ref;
     }
    }

 
A introduction to Salesforce Lightning component development.  The training video goes over at a high level what developing a lightning component is like.  Visit http://doubleheadsoftwaretraining.com/developer-landing19082899
Opportunity opp = [select id,(select id,Test__c,Name,from Vendor_Groups__r) from opportunity where id =: oppid];

system.debug('@@@@Check1'+opp.Vendor_Groups__r);   No compile error
system.debug('@@@@Check1'+opp.Vendor_Groups__r.
Test__c);   Compile error as shown below
Error: Compile Error: A non foreign key field cannot be referenced in a path expression: Vendor_Groups__r
 
If you look at the general approach to write a batch, it asks to implement the Batchable interface. The sample code is like this -
global class Accountupdate implements Database.Batchable<sObject> 
{ 
:
:
Here, one thing is absurd - what is the use of datatype sObject in the interface name? Can we write an interface like this?
Also, Salesforce doc says you need to implement start method -
global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {}
But in an interface how can you define a method with 2 return types? Again, when you actually implement this, you are implementing with just any one of these return types - Database.QueryLocator or Iterable<sObject>. How does this work?

In a nutshell, how has salesforce written the Batchable interface?
 
Hello,

I'm trying to create a DateTime formula by combining a date field and time field (beta version). I've been able to create a Text output but it doesn't like it if I want it to create a DateTime value as an output.. In case you're wondering, I need it to be DateTime in order for me to use it in my activities/events.

I currently have

DATETIMEVALUE(TEXT(Date__c) + TEXT(Time__c))

Thank you for any help!
Hello everyone;
I thought I had this right but I am not refencing the Class correctly in my VF page. What I am trying to do is show a list of  accoutns around a lead record based on the geo location.
error: Error: Unknown constructor 'LeadGeoController.LeadGeoController(ApexPages.StandardController controller)
<apex:page standardstylesheets="true" showheader="false" standardController="Lead" extensions="LeadGeoController">

       <apex:pageBlock title="Recent Orders for Lead">
          <apex:pageBlockTable styleClass="responsive-table" value="{!GetAccountsNearLead}" var="accounts">
             <apex:column title="Account Name " value="{!account.name}" headerValue="Name"/>
             <apex:column title="Contacts Email Address " value="{!account.Primary_Contact_Email_Address__c}" headerValue="Email Address"/>   
             <apex:column title="Account Street Address " value="{!account.BillingStreet}" headerValue="Address"/>
             <apex:column title="Account City " value="{!account.BillingCity}" headerValue="City"/>
             <apex:column title="Diectance From Lead " value="{!account.Distance}" headerValue="Distance"/>
          </apex:pageBlockTable>   
    </apex:pageBlock>
</apex:page>
 
public with sharing class LeadGeoController {

     
     public Decimal lat { get; set; }
     public Decimal longitude{ get; set; } 

     public LeadGeoController () 
     {
     List<Lead> lat =  [SELECT MALatitude__c from Lead WHERE Id=:ApexPages.currentPage().getParameters().get('id')];
       List<Lead> longituide= [SELECT MALongitude__c from Lead WHERE Id=:ApexPages.currentPage().getParameters().get('id')];
    }
     
      
    public List<Account> GetAccountsNearLead() {
        return [SELECT Name, Primary_Contact_Email_Address__c,BillingStreet,BillingCity,distance(BillingAddress, geolocation(:lat , :longitude), 'mi')  Distance
            FROM Account
            WHERE Partner_Type__c= 'TrexPro' AND
            distance(BillingAddress, geolocation(:lat , :longitude), 'mi') < 10 
        //    AND Id = :ApexPages.currentPage().getParameters().get('id')
            ORDER BY distance(BillingAddress, geolocation(:lat , :longitude), 'mi')
            LIMIT 5];            
        }
      
    }
Thanks,
M
 
I have created BoatSearchForm.cmp, BoatSearchResults.cmp, and BoatSearch.cmp, as described in the business requirements but I am unable to make the Boatsearchform look similar to the use case. I did not add any styling or controller to it yet. Any advice is appreciated.
Boat Search form
Component:
User-added image