• Mayur Gore 10
  • NEWBIE
  • 25 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies
Hi Experts
I need quick help in writing one validation rule on opportunity. Requirement is below:
- New, Pipeline and Forecast Record Type: Lost Reason(custom field) and Other Reason(custom field) should not be editable until the Opportunity is set to 'Closed Lost'.

- Renewals Record Type: Loss Type, Loss Reason and Other Reason should not be editable until the Opportunity is set to 'Closed Lost'.

I want these points to be covered in a single VR. Looking forward to your swift help on this.

Thanks in advance..!!
How to populate date fields in lightning using URL hacking
Hi,
i have a table inside lightning component..aura iteration items comes from another lightning component..when i add the new record then the table should refresh and display the values..can anyone help me with that.
User-added imageUser-added image<div class="slds-m-around_xx-small">
        <div class="slds-align--absolute-left">
        <h1 class="slds-text-heading--small">Below are the 5 most recent work time entries</h1>
            <br/>
        </div>
                </div>
                             
                            <table class="slds-table slds-table_bordered slds-table_cell-buffer">
        <thead>
            <tr class="slds-text-title--caps">
                
                <th scope="col"><div class="slds-truncate" title="Id">S.No</div></th>
               
                <th scope="col"><div class="slds-truncate" title="Work Date">Work Date</div></th>
                <th scope="col"><div class="slds-truncate" title="User">User</div></th>
                <th scope="col"><div class="slds-truncate" title="Minutes">Minutes</div></th>
                <th scope="col"><div class="slds-truncate" title="After Hours">After Hours</div></th>
                <th scope="col"><div class="slds-truncate" title="Reason">Reason</div></th>
                
                
            </tr>
        </thead>          
        <tbody>
    
               <aura:iteration items="{!v.timeList}" var="time" indexVar="sNo"  >
              
                       
             
                   <c:Inlinechildtime single="{!time}"  sNo="{!sNo + 1}"/>
                   
            </aura:iteration>
            </tbody>
            </table>
                            <br/>
                            <br/>
                            <center>
                            <div class="slds-m-around_xx-small">
        <div class="slds-align--absolute-Center">
        <h1 class="slds-text-heading--small">Do you need to add any additional work time?</h1>
            <br/>
            <br>
            </br>
            <br>
            </br>
        </div>
                </div>
                            
                    <button class="slds-button slds-button_success" type ="submit" onclick="{!c.actionhandler2}"  >Yes</button>
                                

                            <button class="slds-button slds-button_destructive" onclick="{!c.handleNext1}">No</button>
                                <br/>
                                <br/>
                                <br/>
                                <br/><br/>
                                <br/>
                                <br/><br/><br/><br/>
                           
            <aura:if isTrue="{!v.seeu}">
 <div role="dialog" aura:id="Modalbox" class="slds-modal slds-fade-in-open ">
               <div class="slds-modal__container">
                   
                   <div class="slds-m-around--xx-large">
                       
        <lightning:card title="Work Time" iconName="custom:custom86" class="slds-p-around_medium">
            <br/>
            <lightning:recordEditForm aura:id="leadCreateForm2"  objectApiName="SVC_Work_Time__c">
                <lightning:messages />
                 
                <lightning:inputField fieldName="Ticket__c" value="{!v.recordId}"></lightning:inputField>
                        <lightning:inputField aura:id="lookup" fieldName="Work_Date__c"></lightning:inputField>
                   
                   
                        <lightning:inputField aura:id="lookup" fieldName="User__c"></lightning:inputField>
               
               
                        <lightning:inputField aura:id="lookup" fieldName="Minutes__c"></lightning:inputField>
                  
                   
                        <lightning:inputField aura:id="lookup" fieldName="After_Hours__c"></lightning:inputField>
                
                          
                        <lightning:inputField aura:id="lookup" fieldName="Reason__c"></lightning:inputField>
                  <br/><br/><br/>
                <center>
                 
                <lightning:button type="submit" label="Save" variant="brand" onclick="{!c.handleOnSubmit}"/>
                    <lightning:button type="submit" label="Save and New"  variant="brand" onclick="{!c.handleOnSubmit2}"/> 
                <lightning:button  label="Close" onclick="{!c.closemodal}" variant="brand"/>
                </center>
            </lightning:recordEditForm>
        </lightning:card>
    </div>
                </div>
            </div>
            <div class="slds-backdrop slds-backdrop--open" aura:id="Modalbackdrop"> 
             </div>
         
          </aura:if>    

how to refresh this table..

thanks 
 
I want to create a formula field where if a coulum have value Quarter then it return 3 else if Half year it retrun 2 else if month it return 12
Hi Experts
I need quick help in writing one validation rule on opportunity. Requirement is below:
- New, Pipeline and Forecast Record Type: Lost Reason(custom field) and Other Reason(custom field) should not be editable until the Opportunity is set to 'Closed Lost'.

- Renewals Record Type: Loss Type, Loss Reason and Other Reason should not be editable until the Opportunity is set to 'Closed Lost'.

I want these points to be covered in a single VR. Looking forward to your swift help on this.

Thanks in advance..!!
Getting the subject line error when validating my test class. I'm not a developer (someone from SF CS team that no longer works there helped me write this initially) so I think this is a simple fix, but I couldn't figure out how to update it based on the examples I saw.  Any help would be appreciated. Thanks!


@isTest
private class BusinessHoursTest {
    
    public static testMethod void BusinessHours(){        
        //Delcare var
        Decimal diff;
        
        //Test QFH data
        Quote_Field_History__c QFH = new Quote_Field_History__c();
        QFH.Quote__c = 'a2Lm00000007mTYEAY';
        QFH.Start_Time__c = system.now();
        QFH.Stop_Time__c = (system.now()+5);
        insert QFH;               
        
        
        system.debug('Inserting QFH with vaild QFH.Stop_Time__c value');
        
        BusinessHours BusinessHoursId = [SELECT Id FROM BusinessHours WHERE IsActive=true AND name= 'CS];
        QFH = [select ID, Stop_Time__c, Name from Quote_Field_History__c where Id = 'a2Lm00000007mTYEAY'];
        system.assert(QFH.Stop_Time__c != Null);
    }
}
Hello everyone I write all trigger event on Account object...and test class for the same....i am getting 96% code coverage but i want 100% code coverage .....i am new learner, please help me in this.....any help is appriatiated ...


this is the the Trigger
trigger SelfAccountTrigger on Account(before delete, before insert, before update,after delete,after insert,after update){
    
 //Before Insert logic
    
if(Trigger.isBefore){
   if(Trigger.isInsert)
   {
   for(Account Acc:Trigger.new)        
   {
     if(Trigger.isInsert && Acc.email__c == NUll)
       Acc.Name.addError('You Cannot Create Account without email');
       //Acc.Name = 'ER'+Acc.Name;
       
   }
 }
    
//Before Update logic
 
  else if(Trigger.isupdate)
 {
   for(Account Acc:Trigger.new)
   {
       Acc.Name = 'ER'+Acc.Name;
    
 }

 }

//Before Delete logic
  
else if(Trigger.isdelete)
{
  for(Account Acc: Trigger.old)
  {
        if(String.isNotBlank(Acc.Description))
        {
            Acc.AddError('Cannot Delete if Account if Description is Available');
        }
    }
}}
  
    
//After Insert and After Update logic
     
else {
    if(Trigger.isInsert){

    List<Contact> ct = new List <Contact>();

    for(Account acc : trigger.new){

        Contact c = new Contact(LastName = acc.name,
                    AccountId=acc.id,
                    Phone=acc.Phone);
                   
        ct.add(c);
    }
    insert ct;
    }
    
    
 //After delete 
else if(Trigger.isdelete)
{

 Messaging.reserveSingleEmailCapacity(trigger.size);
    List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
    for (Account acct :(List<Account>)Trigger.old) {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        email.setToAddresses(new String[] {'aishwarya_kutte@persistent.com'});
        email.setSubject('Deleted Account Alert');
        email.setPlainTextBody('This message is to alert you that the account named ' + acct.Name + ' has been deleted.');
        emails.add(email);
    }
    Messaging.sendEmail(emails);
}

 }

}





and test class for same 

@isTest
    
  public class SelfAccountTestClass {
  static testmethod void myTest(){
           
          Boolean result =false;
          Account acc = new Account(); 
          acc.Name = 'Test Account';
          acc.email__c = 'Test@mail.com';
         // acc.Description='a'; 
          insert acc;
      
            try{
      Account acc1=new account();
      acc1.Name= 'riya';
      acc1.email__c='riyakutte123@gmail.com';
                
      insert acc1;
      }
      catch(DMLException ex)
      {
      result=true;
      system.assert(result);
      }
   
          acc.Name = 'Test Account 1'; 
          update acc;

          
          acc.Description = '';
          delete acc;
          
            
        }
  }




please help ,me to get 100% code coverage
 
I have the requirement to disable  users access (users within a custom Profile) from being able to update their own profile .
For that have to write a trigger to restrict the user to access/not update his own profile.
public class Test
{
List<Contact> acctList = new List<Contact>(); 
Contact a1 = new Contact(FirstName='Account1'LastName='sri'); 
Contact a2 = new Contact(FirstName='Account2' LastName='sri'); 
acctList.add(a1);
acctList.add(a2);
insert acctList;
}