• vijayabhaskarareddy
  • NEWBIE
  • 215 Points
  • Member since 2017

  • Chatter
    Feed
  • 6
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 39
    Replies
Hi Team,

trying to deisgn CSV uploder in lightning component and need to display in table after uploading CSV file and on click on save button need to save account reords in data base.
 
public class PMO_CsvUploaderController {
    public Blob csvFileBody{get;set;}
    public string csvAsString{get;set;}
    public String[] csvFileLines{get;set;}
    public List<Account> Acclist{get;set;}
    public PMO_CsvUploaderController(){
        csvFileLines = new String[]{};
            Acclist = New List<Account>(); 
    }
    
    public void importCSVFile(){
        try{
            csvAsString = csvFileBody.toString();
            csvFileLines = csvAsString.split('\n'); 
            
            for(Integer i=1;i<csvFileLines.size();i++){
                Account couObj = new Account();
                string[] csvRecordData = csvFileLines[i].split(',');            
                couObj.name = csvRecordData[1] ;        
                couObj.AccountNumber = csvRecordData[2];
                couObj.Phone = csvRecordData[3];
                couObj.Rating = csvRecordData[4];
                	/*
                    String temp_fees=csvRecordData[3];
                    couObj.Course_fees__c = Decimal.valueOf(temp_fees);
                    String temp_date=csvRecordData[4];
                    couObj.Course_Date__c = Date.parse(temp_date); 
                    */
                Acclist.add(couObj);   
            }
            insert Acclist;
        }
        catch (Exception e){
            System.debug(e.getCause());
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importing data. Please make sure input csv file is correct');
            ApexPages.addMessage(errorMessage);
        }  
    }
}

Using these contoroller to create account.. help me to design lightning component
Hi everyone.

I hope you can help me. I'm working with a lightning component which has an aura iteration with another component inside.

My code:
 
<aura:iteration var="event" items="{!v.events}">
       <c:LC_Events event="{!event}"/>                
 </aura:iteration>

I would like to know if there is any way to limit the number of records displayed and make a kind of button to load more or show more like in list views or related lists because when I have very few records I have no problem but when I have many records I get a very long vertical scroll and this is I want to avoid.

Regards
 
Hi  
The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
Hi

I have a scenario where the account currency and opportunity currency can be different. The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
Highly appreciated.
global class SendQuoteAsEmail 
{
    public static List <String> ToAddresses= New List<String>();

    webservice static string sendQuoteEmail(String OrderIdFromParam)
    {
    
        try
        {
        
            System.debug('Order ID passed'+OrderIdFromParam);
                   
            List<order> OrderDetailList = [select id, name,orderNumber,account.Billing_Owner__r.id,Client_Order_Owner__r.Email,Client_Order_Owner__r.id,Quote__c from Order where id=: OrderIdFromParam];
            List<order> orderId=new List<order>();
            //List<Order> ordersToUpdate=new List<Order>();
            
            List<Quote_Email__c> getCustomSettingValues= new List<Quote_Email__c>([select CC_Email_Address__c, From_Email_Address__c from Quote_Email__c limit 1]);
               
            String fromAddress= getCustomSettingValues.get(0).From_Email_Address__c ;
            //String[] ccaddress = new String[] {getCustomSettingValues.get(0).CC_Email_Address__c};
            
            OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address=:fromAddress];
                       
            for(Order ord: OrderDetailList )
            {
                ToAddresses.add(ord.Client_Order_Owner__r.Email);
                orderId.add(ord);
            }
                 
            system.debug('email ID:'+ToAddresses);
    
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            PageReference pdf =  Page.QuoteDetailsPage;
            pdf.getParameters().put('id',OrderIdFromParam);
            pdf.getParameters().put('param','withprice');

            pdf.setRedirect(true);
    
            Blob b;
             
           // Take the PDF content
           if(Test.IsRunningTest())
           { 
                b=Blob.valueOf('UNIT.TEST');

           }
           else
           {
                b = pdf.getContent();
           }
    
            // Create the email attachment
    
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
    
            efa.setFileName(OrderDetailList[0].orderNumber+'-Quote-DiamondAir International.pdf');
    
            efa.setBody(b);

             // Construct the list of emails we want to send
             List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>();

             Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
             email.setTemplateId( [select id from EmailTemplate where DeveloperName='Quote_Email_Template'].id );
             email.setWhatId(OrderIdFromParam);
             email.setTargetObjectId(OrderDetailList.get(0).Client_Order_Owner__r.id);
             email.setToAddresses( ToAddresses);
             //email.setCcAddresses(ccaddress);
             email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); 
             email.setOrgWideEmailAddressId(owea.get(0).Id);
             lstMsgs.add(email);

            
            String upsertOrder=null;
            String updateInvoice=null;
            
              
                
                List<order> OrderToUpdate= new List<Order>();
                for(order orderListVal: orderId)
                {
                    datetime myDateTime = datetime.now();
                    string mydtstring = mydatetime.format();
                    orderListVal.Quote_status__c='Quote Sent to Client at '+myDateTime; 
                    orderListVal.Quote_Sent__c=true;
                    OrderToUpdate.add(orderListVal); 
                    
                }//end of for
                
                try{
                    update OrderToUpdate;
                    updateInvoice='Pass';
                }
                catch(Exception e)
                {
                    updateInvoice='Fail';
                    return 'false';
                }
                if(updateInvoice.equals('Pass'))
                {
                    List<Messaging.SendEmailResult> results=new List<Messaging.SendEmailResult>();
            
                    if(!Test.isRunningTest())
                        results=Messaging.sendEmail(lstMsgs);  
                   if(results.get(0).isSuccess())          
                        return 'true'; 
                   else 
                       return 'false';
                }
                else 
                    return 'false';
                         
      }//end of try
      catch(Exception e)
      {
          system.debug('Catch block'+e);
          return 'false';
          
      } 
      //end of catch  

    }//end of sendInvoiceEmail
}//end of class

 
when we click on command button   first execute  NoOfPassengersTrueFalse()  if  it return true show elert message "TRUE"
if it returns false  call  QuoteAcceptedITpage() method 


 
JS
=====

function NoOfPassTrueFalse(PassengersTrueFalse)
    {
          var pass= PassengersTrueFalse;
          
          if(pass==true)
          {
          
          alert('true')

      
           }
           else{
                     
           callApexMethod();
          }
           
           
      } 
============================================================	  
	  
	<apex:commandlink     action="{!NoOfPassengersTrueFalse}"  value="Accept"  oncomplete=" NoOfPassTrueFalse('{! PassengersTrueFalse}');"/>
	 <apex:actionFunction name="callApexMethod"  action="{!QuoteAcceptedITpage}"  />
	 =============================================================================
	 
	 
	  public boolean NoOfPassengersTrueFalse()
    
     {
       
       AddPassengerController obj= new AddPassengerController();
        
        PassengersTrueFalse= obj.AddPassengerMethod();
        
        return PassengersTrueFalse;
       
      }
	  
	  
	  
	   public pageReference QuoteAcceptedITpage()
    
    {
      
       
        
       
         
         Id orderID=Apexpages.currentpage().getParameters().get('orderId');
         Order ord= new Order();
         ord.Id=orderID;
         ord.Order_Stage__c='Quote';
         ord.Admin_Stage__c='Quote Accepted';
         update ord;
         
        
        pageReference pgRef = new pageReference('/apex/ItineraryDetailPage?Id='+itineraryID);
        pgRef.setRedirect(true); 
        
        return pgref;       
        }
	  ===========================================

 
6. difference b/w system.assert and system.assertEquals...?
5. is it possible to send email in triggers..?
I'm getting an error while trying to generate Apex code from Partner WSDL file.
~Apex Generation Failed
Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType

How to overcome this error?
Hi,

We have accidentally made some record update in our org, but we now want to know who was the last modified user before we made the changes.
Is there a way to get this in Salesforce?

Thanks.
 i need help  to upload a csv  file using drag and drop
hi..! friends
if I am trying to save an apex class,  I  am getting so many asci code errors,
here is my program and related errors:
apex class with asci code errorserror

and my friend saved this program and he did not get any error when he was writing this.but i have got these so many times.
and when i was writing this program, i did not get any error only whenever i am trying to copy any program, i will get these errors :

here is the common error:
'invalid identifier '    public list'.Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters(a-z or A-Z),digits(0-9),'$','_',or unicode characters from U+0080 to U+FFFE-'.


 
hi All,
I have made a oppurtunity page as vf page , but it is not responsive in simulator, all the fields are not aligned, 

just see the effect.
i have bootstrap also,User-added image

plz reply ,
hai 
 please tell me the code to insert records related to multiple objects with the data from csv file using custom visualforce upload page, you can see preview of my page attached hereUser-added image

Thanks in advance