• punith narasimha
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
 Hi friends
My requirement is place a component in opportunity detail page (get the record details by using  {!v.recordId}) when change and save the Stage(StageName) picklist values in details page  then my component is need to refresh
Here I don’t want to use any button ,link
So I just used  aura:handler    in this action function I used
$A.get('e.force:refreshView').fire();     but is not working 
location.reload();        it is working but problem is entire page will reload number of times i.e it is reload the page continuously it does not stop

    <lightning:input label="current record id" aura:id="recid" value="{!v.recordId}" />
    <aura:handler name="init" value="{!this}" action="{!c.show}" />

({
 
    show : function(component, event, helper)
    {
        var recid=component.find("recid").get("v.value");
        //alert(recid);
        var ledmethod=component.get("c.opprecordidmethod");
        ledmethod.setParams({
            idd:recid,
        }); 
        ledmethod.setCallback(this, function(res){
            if (res.getState() === "SUCCESS")
            {
                var resultval = res.getReturnValue();
                component.set("v.stagename",resultval);
                if(resultval == "Prospecting"){
                    component.set("v.Prospectingcurrent", "resultval");
                    
                }
                if(resultval == "Qualification"){
                    component.set("v.Qualificationcurrent", "resultval");
                    
                    component.set("v.Prospectingcomplete", "resultval");
                }
                 $A.get('e.force:refreshView').fire();     
                //location.reload();
            }
        });
        $A.enqueueAction(ledmethod);  
    }
})

Please help me friends

Thanks in advance

 
hi 
i am crated a component page with "Enter a date" is date field, 'Starttime' is time sloat  now combined these 2 fields and set as date and time format in controller and  want to insert a student record 

component.set("v.student.Start_Date__c",------  ? ? ? -----);
please help me 
Thank you

User-added image
Hi Friends 
I want to create a custom button in lead object in lightning component
when click on the custom button create a contact record 
but i dont want to open any component page or alert or model box 
just create a contact record these process done in lightning only



 
Hi Every one ,
Could you please explain what is Schema ,in which case we need to use Schema , how to use and what is advantage of Schema in salesforce
i am new to this plese explain about Schema
thanku
here i want to display all opp names under account and each name saparated ny comma(,) but i did not get this requriment its displaying all opp names and i dont want to use for loop inside forr loop
please help me
public class AccountOppNamesTotalAmount 
{
    //method
    @AuraEnabled
    public static list<wrapperclass> alloppnames()
    {
        list<wrapperclass> wrplist=new list<wrapperclass>();
        set<id> accids=new set<id>();
        set<string> accname=new set<string>();
        map<string,wrapperclass> wrpmap=new map<string,wrapperclass>();
        String oppnames=null;
        String lastSplitoppnames=null;
        string glue = ',';
        map<id,string> mapoppnames = new map<id,string>();
        map<string,string> allnamemap = new map<string,string>();
        //fetching all account rec
        for(account acc:[select id,name,Type,phone from account limit 49999])
        {
            accids.add(acc.Id);
            accname.add(acc.Name);
            wrapperclass wrpcls=new wrapperclass();
            wrpcls.allaccnames=acc.Name;
            wrpcls.acctype=acc.Type;
            wrpcls.accphone=acc.Phone;
            wrpmap.put(acc.Id,wrpcls);
        }
        // for opp names
        
        for(Opportunity opp:[select id,name,AccountId from Opportunity where AccountId IN:accids and  AccountId !=null])
        {
            mapoppnames.put(opp.AccountId, opp.Name);
            if(mapoppnames.containsKey(opp.AccountId))
            {
                oppnames +=glue+opp.Name;
                String delimiter = ',';
                lastSplitoppnames=oppnames.substringAfter(delimiter);//for avoiding null at starting
                allnamemap.put(opp.AccountId,lastSplitoppnames);
            }
        }
        system.debug('=======>'+lastSplitoppnames);
        
        
        for(String acid:accids)
        {
            wrapperclass wc1=new wrapperclass();
            if(wrpmap.containsKey(acid))
            {
                wc1=wrpmap.get(acid);
                if(allnamemap.containsKey(acid))
                    wc1.alloppnames= allnamemap.get(acid); 
                wc1.alloppnames=lastSplitoppnames;
                wrplist.add(wc1);
            }
        }
        return wrplist;
    }
    
    //wrwpper class 
    public class wrapperclass
    {
        @AuraEnabled public String allaccnames        {set;get;}
        @AuraEnabled public String alloppnames        {set;get;}
        @AuraEnabled public String accphone            {set;get;}
        @AuraEnabled public String acctype            {set;get;}
        @AuraEnabled public decimal oppamount        {set;get;}
        
    }
    
}
hi,
in vf page we have a tag i.e  apex:param by using this we can pass parameters  from vf page to Apex controller 
now i want to do same scenario  in lightning component  please help me
thank u,
 Hi friends
My requirement is place a component in opportunity detail page (get the record details by using  {!v.recordId}) when change and save the Stage(StageName) picklist values in details page  then my component is need to refresh
Here I don’t want to use any button ,link
So I just used  aura:handler    in this action function I used
$A.get('e.force:refreshView').fire();     but is not working 
location.reload();        it is working but problem is entire page will reload number of times i.e it is reload the page continuously it does not stop

    <lightning:input label="current record id" aura:id="recid" value="{!v.recordId}" />
    <aura:handler name="init" value="{!this}" action="{!c.show}" />

({
 
    show : function(component, event, helper)
    {
        var recid=component.find("recid").get("v.value");
        //alert(recid);
        var ledmethod=component.get("c.opprecordidmethod");
        ledmethod.setParams({
            idd:recid,
        }); 
        ledmethod.setCallback(this, function(res){
            if (res.getState() === "SUCCESS")
            {
                var resultval = res.getReturnValue();
                component.set("v.stagename",resultval);
                if(resultval == "Prospecting"){
                    component.set("v.Prospectingcurrent", "resultval");
                    
                }
                if(resultval == "Qualification"){
                    component.set("v.Qualificationcurrent", "resultval");
                    
                    component.set("v.Prospectingcomplete", "resultval");
                }
                 $A.get('e.force:refreshView').fire();     
                //location.reload();
            }
        });
        $A.enqueueAction(ledmethod);  
    }
})

Please help me friends

Thanks in advance

 
here i want to display all opp names under account and each name saparated ny comma(,) but i did not get this requriment its displaying all opp names and i dont want to use for loop inside forr loop
please help me
public class AccountOppNamesTotalAmount 
{
    //method
    @AuraEnabled
    public static list<wrapperclass> alloppnames()
    {
        list<wrapperclass> wrplist=new list<wrapperclass>();
        set<id> accids=new set<id>();
        set<string> accname=new set<string>();
        map<string,wrapperclass> wrpmap=new map<string,wrapperclass>();
        String oppnames=null;
        String lastSplitoppnames=null;
        string glue = ',';
        map<id,string> mapoppnames = new map<id,string>();
        map<string,string> allnamemap = new map<string,string>();
        //fetching all account rec
        for(account acc:[select id,name,Type,phone from account limit 49999])
        {
            accids.add(acc.Id);
            accname.add(acc.Name);
            wrapperclass wrpcls=new wrapperclass();
            wrpcls.allaccnames=acc.Name;
            wrpcls.acctype=acc.Type;
            wrpcls.accphone=acc.Phone;
            wrpmap.put(acc.Id,wrpcls);
        }
        // for opp names
        
        for(Opportunity opp:[select id,name,AccountId from Opportunity where AccountId IN:accids and  AccountId !=null])
        {
            mapoppnames.put(opp.AccountId, opp.Name);
            if(mapoppnames.containsKey(opp.AccountId))
            {
                oppnames +=glue+opp.Name;
                String delimiter = ',';
                lastSplitoppnames=oppnames.substringAfter(delimiter);//for avoiding null at starting
                allnamemap.put(opp.AccountId,lastSplitoppnames);
            }
        }
        system.debug('=======>'+lastSplitoppnames);
        
        
        for(String acid:accids)
        {
            wrapperclass wc1=new wrapperclass();
            if(wrpmap.containsKey(acid))
            {
                wc1=wrpmap.get(acid);
                if(allnamemap.containsKey(acid))
                    wc1.alloppnames= allnamemap.get(acid); 
                wc1.alloppnames=lastSplitoppnames;
                wrplist.add(wc1);
            }
        }
        return wrplist;
    }
    
    //wrwpper class 
    public class wrapperclass
    {
        @AuraEnabled public String allaccnames        {set;get;}
        @AuraEnabled public String alloppnames        {set;get;}
        @AuraEnabled public String accphone            {set;get;}
        @AuraEnabled public String acctype            {set;get;}
        @AuraEnabled public decimal oppamount        {set;get;}
        
    }
    
}