• Bharath Vikkurthi
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 2
    Replies
Hi All,
Good day!!
I created one lightning table and added Inline edit for one column .When I was trying to edit column and update the new value its not saving the record .
.Please help me out.
Here is my code 
public class BillingHoursTimesheet
 {
                @AuraEnabled
    public static List<wrapper> getBillingRecord(string invoiceid )  
   {
  
       string projectid ; 
       date start;
       date endda;
       
         
       List<Invoice__c> res =[select Start_Date__c,End_Date__c,Project__c from Invoice__c where Id=:invoiceid]; 
       if(res.size()>0){
          projectid =res[0].Project__c;
               start =res[0].Start_Date__c;
           endda =res[0].End_Date__c;
       }
       
       List<wrapper> wr =new List<wrapper>(); 
        map<String, Decimal> projMap = new map<String, Decimal>(); 
       for(Project_Team_Member__c ptm: [select Id, Employeee__r.Name , Charged_Rate__c  from Project_Team_Member__c where Project__c=:projectid  ]){
        projMap.put(ptm.Employeee__r.Name, ptm.Charged_Rate__c);       
           system.debug('Value of Rate:'+ ptm);   
       }      
       for(AggregateResult tes: [select Timesheet__r.Employeee__r.Name em , SUM(No_of_hours__c) tot from Timesheet_Detail__c where Project__c=:projectid AND  Date__c>=:start AND Date__c<=:endda group by Timesheet__r.Employeee__r.Name ])
       {
   
         
           wrapper t = new wrapper();
           t.empname =String.valueof(tes.get('em'));
           t.hour =(Decimal) tes.get('tot');
           t.chargedhour =(Decimal) tes.get('tot'); 
           t.rate=projMap.get(t.empname); 
          wr.add(t);
       } 
       
       return wr; 
      
    }
     public class wrapper{
         @AuraEnabled
        public string empname;
          @AuraEnabled 
         public decimal hour;
         @AuraEnabled 
         public decimal chargedhour;
         @AuraEnabled
         public Decimal rate;
     } 
     @AuraEnabled
     public static boolean saveAccount(List<Project_Team_Member__c> lstAccount) {  
       try { 
          
            update lstAccount;  
            return true;  
              
        } catch(Exception e) {  
          
            return false;  
              
        }  
            
        
    } 
}
 
({
                doInit : function(component, event, helper) {
                                helper.getBillingRecord(component); 
                },
    
    
    inlineEditName : function(component,event,helper){   
       
        component.set("v.nameEditMode", true); 
        
        setTimeout(function(){ 
            component.find("inputId").focus();
        }, 100);
    },
    
    Save: function(component, event, helper) {
      
        if (helper.requiredValidation(component, event)){
             
               var action = component.get("c.saveAccount");
                  action.setParams({
                    'lstAccount': component.get("v.billLst")
                  });
            action.setCallback(this, function(response) {
                var state = response.getState();
                if (state === "SUCCESS") {
                    var storeResponse = response.getReturnValue();
                    
                    component.set("v.billLst", storeResponse); 
                
                    component.set("v.showSaveCancelBtn",false);
                    alert('Updated...');
                }
            });
            $A.enqueueAction(action);
        } 
    },
    
    cancel : function(component,event,helper){
      
        $A.get('e.force:refreshView').fire(); 
    } ,
    
     closeNameBox : function (component, event, helper) {
        
        component.set("v.nameEditMode", false); 
     
        if(event.getSource().get("v.value").trim() == ''){
            component.set("v.showErrorClass",true);
        }else{
            component.set("v.showErrorClass",false);
        }
    }, 
    
    onNameChange : function(component,event,helper){ 
       
        if(event.getSource().get("v.value").trim() != ''){  
            component.set("v.showSaveCancelBtn",true);
        }
    }
    
  
})
 
<aura:component controller="BillingHoursTimesheet" implements="force:appHostable,force:hasRecordId,forceCommunity:availableForAllPageTypes,flexipage:availableForAllPageTypes" access="global">
 <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 
    <!-- calling doInit method in Component Controller -->
    
    <aura:attribute name="showSaveCancelBtn" type="boolean" default="false" description="flag for rendered save and cancel buttons in aura:if "/>
    <aura:attribute name="showErrorClass" type="boolean" default="false"/> 
    <aura:attribute name="nameEditMode" type="boolean" default="false" />
    <aura:attribute name="ratingEditMode" type="boolean" default="false" />
    <aura:attribute name="billLst" type="List"/> <!-- create Array type object variable-->
    <aura:attribute name="sNo" type="string" />
    <article class="slds-card">
      <div class="slds-card__header slds-grid">
        <header class="slds-media slds-media_center slds-has-flexi-truncate">
          <div class="slds-media__figure">
            <span class="slds-icon_container slds-icon-standard-account" title="description of icon when needed">
                <lightning:icon iconName="standard:customers" size="large" alternativeText="List account"/>
            </span>
          </div>
          <div class="slds-media__body"> 
            <h1 style="color:#9ACD32;"> 
              <a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Logged Hours">
                  <span class="slds-text-heading_small">LOGGED HOURS</span>
              </a>
            </h1>
          </div>
        </header>
       </div>
      <div class="slds-card__body"> 
        <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered">
          <thead> 
            <tr class="slds-line-height_reset"> 
                <th scope="col">
                <div class="slds-truncate" title="S.No" >S.No</div>  
              </th>
              <th scope="col">
                  
                <div class="slds-truncate" title="Employee Name">Employee Name</div>

              </th>
              
                <th scope="col">
                <div class="slds-truncate" title="Total Hours">Total Hours</div>
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Charged Hour">Charged Hour</div> 
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Rate">Rate</div>
              </th>
                <th scope="col">
                <div class="slds-truncate" title="Amount">Amount</div>
              </th>
            </tr>
          </thead>
          <tbody>
              <aura:iteration items="{!v.billLst}" var="acc" indexVar="sNo">
                  
                  <!-- iteration account record.-->
                  <tr class="slds-hint-parent">
                      <td><div class="slds-truncate">{!sNo + 1}</div></td> 
                      <th scope="row">
                          <div class="slds-truncate" title="Name">{!acc.empname}</div>   
                      </th>
                     
                      <th>
                          <div class="slds-truncate" title="Hours" >{!acc.hour}</div> 
                      </th>
                     
                          <td ondblclick="{!c.inlineEditName}" class="{! v.showErrorClass == true ? 'slds-cell-edit slds-has-error' : 'slds-cell-edit'}">
            <span class="slds-grid slds-grid_align-spread">
                <!-- show input and output section based on boolean flag --> 
                <aura:if isTrue="{!v.nameEditMode == false}">
                    <span class="slds-truncate" title="Rate">{!acc.chargedhour}</span> 
                    <button onclick="{!c.inlineEditName}" class="slds-button slds-button_icon slds-cell-edit__button slds-m-left_x-small" tabindex="0" title="Edit Name">
                      <lightning:icon iconName="utility:edit" size="xx-small" alternativeText="edit"/>
                    </button>
                   
                    <!-- Inline Edit Section in else case-->  
                    <aura:set attribute="else">
                        <section  tabindex="0" class="slds-popover slds-popover_edit" role="dialog" style="position: absolute; top: 0px">
                            <div class="slds-popover__body">
                                <div class="slds-form-element slds-grid slds-wrap">
                                    <div class="slds-form-element__control slds-grow">
                                        <ui:inputText class="slds-input inputFieldWidth"
                                                      labelClass="slds-form-element__label slds-form-element__label_edit slds-no-flex"
                                                      aura:id="inputId"
                                                      blur="{!c.closeNameBox}"
                                                      change="{!c.onNameChange}"
                                                      
                                                      required="false"
                                                      label="Charged Hour"
                                                      value="{!acc.chargedhour}" /> 
                                    </div>
                                </div>
                            </div>
                            <span id="form-end" tabindex="0"></span>
                        </section>  
                    </aura:set>  
                </aura:if> 
            </span>
        </td>
                      
                      
                      
                      
                      
                      
                     <!-- <th>
                          
                          <div class="slds-truncate" title="Charged Hour" >  
                              {!acc.hour}
                          </div>         
                      </th> -->
                      
                      <th  >   
                          <div class="slds-truncate" title="Rate"  > {!acc.rate} </div>        
                      </th> 
                      
                      <th> 
                         <div class="slds-truncate" title="Amount" >
                       {!acc.chargedhour*acc.rate}
                         </div> 
                         
                      </th>  
                      </tr> 
                      
                  
              </aura:iteration>
              
               <tr class="slds-hint-parent">
                      
                      <th colspan="5"  style="text-align:right">  
                          
                         <b>Grand Total:</b>
                         
                      </th>  
                  <th >  
                           
                        SUM
                         
                      </th>  
                        
                      </tr>  
             
            
  
          </tbody>
    
        </table>
          
        <lightning:buttonGroup class="slds-m-around_medium">
            <aura:if isTrue="{!v.showSaveCancelBtn}">
                <lightning:button label="Cancel" onclick="{!c.cancel}"/>
                <lightning:button label="Save" onclick="{!c.Save}" variant="success"/>
                </aura:if>
            </lightning:buttonGroup> 
             
      </div>
         
      <footer class="slds-card__footer"><a href="javascript:void(0);"><!--View All <span class="slds-assistive-text">entity type</span>--></a></footer>
    </article>
</aura:component>


 
Hi All,

I have one interesting requirement when the user compose an email from gmail it will send to the corresponding groups in salesforce (groups users will receive) the email in activity or in object whatever.
For Example
1.I composed an email mentioned subject as group name i.e Level1 and  added some body content 
2.My requirement is particular email goes to only level 1 group members.
3.Level1 Group members will recive the mail
Is it possible in Salesforce ??

Thanks 

 
Hi All,
I am using visualforce page  to show related list of one of the custom object. When I click on edit and update the related record, changes dont reflect in  detail page unless I refresh it. How do I refresh the detail page after updating records in  popup window.

Thanks
Bharath
We have two objects in  a look up realtionship, Object1 has a property called propery1, which is used to link it to master object Object2. In my apex code, I want to remove this relationship based on a condition and I am using the following code. 
Object1 slct = cCon.obj; //We are able to populate values for slct
   slct.propery1 = NULL; 
  update slct;
There is no error, but relationship is not getting terminated aswell. How can we terminate the relationship among the objects?
Thanks,
Bharath V
 
Hi all,
I created two objects Education and Student are in lookup relationship.In education detail page, student relatedlist i want to create one custom button(ex.select button) when i click the button 3 picklist fields(present in student object) will open.How it possible? 
Hi All
I created two objects with lookup, If i click Edit button in Detail Page(output page) and modify some fields(Loan type Picklist) in same object1 then i click save button corresponding object2 related records will display.Here it is not working 

<apex:page lightningStylesheets="true"  Standardcontroller="Loan" extensions="Refresh" sidebar="false" showHeader="true" showChat="true"   >
     <apex:tabPanel >
         <apex:tab label="Loan detail">
             <apex:detail relatedList="false" title="true"/>
         </apex:tab>
         
         <apex:form >
    <apex:pageBlock title="Employee"  mode="edit">
    <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" id="saveButton" value="Save" style="display:none"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection columns="1">
        <apex:pageBlockTable value="{!emp}" var="a">
            <apex:column value="{!a.loan type}"/> <br/> 
        <apex:column value="{!a.Loan name}"/> <br/> 
             <apex:column value="{!a.City}"/><br/><br/>
             
        </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
    </apex:tabPanel>
    
</apex:page>
Hi All
I have one requirement,In detail page edit and save buttons are Standard buttons and page is standard page. I created one vf page in same detail page.So my detail page one standard page and one Custom Visualforce page is there.But i want to create Custom Visualforce page instead of standard Vf page and combine both Vf pages into one page.How it possible?plz help me
Hi

I have one query regarding Backup data.How to Backup Workflows ,Triggers & 3rd Party services
Hi folks 
I face interviewon couple of days ago they asked few questions here i mention those question plz give me possible answers..
1)why sales force is called as CRM application ? 

2)what is Multitenant ?

3) Why Permission Sets Used,? 

4)Difference Between Sales & Service Objects,?

5)How You Use Case Object, ?

6)Can we Write Test class without isStart & isStop,?
.
7)Why isStart & isStop is Used in Test Classes ?
                                
8)Tell About {Lead,Opportunity,Account} Sobjects,? 

9)What is Lightening, ?

10) How to Create a Report where several Calculation included to Show the Reports weekly,? 

11) When you use Service Objects ?

12) how to Create an App using Lightening ?

13) What are the Custom-Objects you have created in your organization
Hi All,
I am using visualforce page  to show related list of one of the custom object. When I click on edit and update the related record, changes dont reflect in  detail page unless I refresh it. How do I refresh the detail page after updating records in  popup window.

Thanks
Bharath