• vamshi kothakapu 9
  • NEWBIE
  • 9 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 11
    Replies
User-added imageNot able to pass the if condition of old and new values compariosn.
Im updating record ownerid from test class but still ownerId in,logs is same
User-added imageNeed to know how to get rid of the PMD report listing of the soql with subquery 
            Approval.ProcessWorkitemRequest[] prWkItems = New Approval.ProcessWorkItemRequest[]{};
            if(!Schema.sObjectType.ProcessInstance.isAccessible()  && !Schema.sObjectType.ProcessInstanceWorkItem.isAccessible() && !Schema.sObjectType.ProcessInstanceStep.isAccessible()){ 
               pageMessage('ProcessInstance');
            }
           /* if(!Schema.sObjectType.ProcessInstanceWorkItem.isAccessible()){
                pageMessage('Workitems');
            }
            if(!Schema.sObjectType.ProcessInstanceStep.isAccessible()){ 
                pageMessage('Steps');  //  isQueryable() 
            }*/
                ProcessInstance[] pi = [Select ID, Status, TargetObject.Name,     
                                        (SELECT Id, ActorId, ProcessInstanceId FROM Workitems),(SELECT Id, StepStatus, Comments FROM Steps) 
                                       From ProcessInstance 
                                        Where TargetObjectID=:PerAppID AND  Status = 'Pending' WITH SECURITY_ENFORCED];
Having issue with formsubmit event I guess. Below error is showing up while saving BoatSearch.
Failed to save BoatSearch.cmp: A aura:handler that specifies an event="" attribute must handle an application event. Either change the aura:event to have type="APPLICATION" or alternately change the aura:handler to specify a name="" attribute.: Source.
<!--BoatSearch.cmp-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global">
     <aura:handler name="formsubmit" event="c:formsubmit" action="{!c.onFormSubmit}" phase="capture"/>
       <aura:attribute name="eventMessage" type="String"/> 
    
   <lightning:card title="Find A Boat">
       <c:BoatSearchForm  />
    </lightning:card>
    <lightning:card title="Matching Boats">
       <c:BoatSearchResults aura:id="searchResults" />
    </lightning:card>
</aura:component>
<!--BoatSearchForm.cmp-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" controller="fetchPicklistOptsController" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
     <aura:attribute name="options" type="map" default="{Id:'value'}"/> 
     <aura:attribute name="boatTypeId" type="string" /> 
     <aura:attribute name="showNewButton" type="Boolean" default="true"/> 
      <aura:attribute name="formData" type="object" default=""/> 
    <!--<aura:registerEvent name="passBoatId" type="c.BoatId_serachform_BoatSerchResult"/>-->
    
    <aura:registerEvent name="formsubmit" type="c:formsubmit"/>
       <lightning:layout horizontalAlign="center" class="slds-align_absolute-center">
          <lightning:layoutItem padding="around-small">
              <lightning:select aura:id="boattypePicklist" value="{!v.options.Id}" onchange="{!c.onChange}" label="Alltype" required="true">
                  <option value="">All Types</option>
                  <aura:iteration items="{!v.options}" var="opt" indexVar="key">
                      <option text="{!opt.value}" value="{!opt.key}" selected="{!opt.key==v.options.Id}" />
                  </aura:iteration>
              </lightning:select>
          </lightning:layoutItem>
          <lightning:layoutItem padding="around-small">
              <lightning:button label="Search" class="slds-button slds-button_brand"  variant="brand" onclick="{!c.onFormSubmit}" />
              <aura:if isTrue="{!v.showNewButton}">
                  <lightning:button label="New" class="slds-button slds-button_neutral" variant="Neutral" onclick="{!c.NewBoat}"/>
              </aura:if>
          </lightning:layoutItem>
       </lightning:layout>
</aura:component>

<!--formsubmit.evt-->
<aura:event type="APPLICATION" description="Event template" >
    <aura:attribute name="formData" type="object"/>
</aura:event>
Please help me.
Hello, 
I am writing test class for a trigger which has all the events nand also has recursive trigger avoider method call(Recursive.trigger()).
Test calss is passing through if(Recursive.trigger()) at the start of trigger but not executing any event of the trigger.
also the functionality is working fine.
User-added image
any help will be great ASAP.
Hi to all,

I am a newbee here having problem to ececute a scenario from my institution.
When  a new Account record is inserted check wheather any duplicate Account exists based on Account Name,Industry  if duplicate record found throw error message. if duplicate records are notfound, check if type=Prospect, if so Create new Task  for the owner of the  account record and send email alert regarding new task. I have no idea ,I have put the toaddress but it is asking for receipent.
Above is the error when i tried to insert account.  and my code with class and trigger are
Trigger:trigger AccTaskTrigr on Account (After insert ) {   // Trigger code is good
    AccTaskTrigr.AccountTaskTrigger(Trigger.New);}  
class:
public class AccTaskTrigr {
    public static void AccountTaskTrigger(List<Account> newtrigger){
      
            List<Task> ListTasks =  new List<Task>();
           Task tsk =new task();
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        list<account> accs =[select Name, Industry from Account];
        
            For(account account1:  newtrigger){
            for(account a :accs){
                if(a.name!=account1.name && a.Industry !=account1.Industry){
                    if( account1.Type=='Prospect'){
                    tsk.OwnerId=account1.OwnerId;
                    tsk.Priority='High';
                    tsk.Subject='Email';
                    tsk.Status='In Progress';
                    tsk.WhatId=account1.Id;
                    listTasks.add(tsk);
                   List<user> toAdd=new List<user>();
                        list<string> toadd1 =new List<string>();
                    toAdd =([select user.email from user where user.id=:account1.Ownerid]);
                        for (user u: toadd){
                            toadd1.add(u.email);
                        }
                    mail.setToAddresses(toAdd1);
                    mail.setSubject('Attachments');
                    mail.setPlainTextBody('Test Message');
                    /*EmailTemplate emailt=[Select id from EmailTemplate where name = 'Account_Task_trigger'];
                    mail.setTargetObjectIds(listids);
                    mail.setSenderDisplayName('Vamshi Kothakapu SFDC');
                    mail.setTemplateId(emailt.id);
                    mail.setSaveAsActivity(false);*/
                    }}
                else{ account1.adderror('another account exists with values of name&Industry');}
                }
    }insert listTasks;
    Messaging.Email[] emails=new Messaging.Email[]{mail};
        Messaging.sendEmail(emails); ////Error line 38 is here
    } 
}
 
User-added imageNot able to pass the if condition of old and new values compariosn.
Im updating record ownerid from test class but still ownerId in,logs is same
User-added imageNeed to know how to get rid of the PMD report listing of the soql with subquery 
            Approval.ProcessWorkitemRequest[] prWkItems = New Approval.ProcessWorkItemRequest[]{};
            if(!Schema.sObjectType.ProcessInstance.isAccessible()  && !Schema.sObjectType.ProcessInstanceWorkItem.isAccessible() && !Schema.sObjectType.ProcessInstanceStep.isAccessible()){ 
               pageMessage('ProcessInstance');
            }
           /* if(!Schema.sObjectType.ProcessInstanceWorkItem.isAccessible()){
                pageMessage('Workitems');
            }
            if(!Schema.sObjectType.ProcessInstanceStep.isAccessible()){ 
                pageMessage('Steps');  //  isQueryable() 
            }*/
                ProcessInstance[] pi = [Select ID, Status, TargetObject.Name,     
                                        (SELECT Id, ActorId, ProcessInstanceId FROM Workitems),(SELECT Id, StepStatus, Comments FROM Steps) 
                                       From ProcessInstance 
                                        Where TargetObjectID=:PerAppID AND  Status = 'Pending' WITH SECURITY_ENFORCED];
Having issue with formsubmit event I guess. Below error is showing up while saving BoatSearch.
Failed to save BoatSearch.cmp: A aura:handler that specifies an event="" attribute must handle an application event. Either change the aura:event to have type="APPLICATION" or alternately change the aura:handler to specify a name="" attribute.: Source.
<!--BoatSearch.cmp-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global">
     <aura:handler name="formsubmit" event="c:formsubmit" action="{!c.onFormSubmit}" phase="capture"/>
       <aura:attribute name="eventMessage" type="String"/> 
    
   <lightning:card title="Find A Boat">
       <c:BoatSearchForm  />
    </lightning:card>
    <lightning:card title="Matching Boats">
       <c:BoatSearchResults aura:id="searchResults" />
    </lightning:card>
</aura:component>
<!--BoatSearchForm.cmp-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" controller="fetchPicklistOptsController" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
     <aura:attribute name="options" type="map" default="{Id:'value'}"/> 
     <aura:attribute name="boatTypeId" type="string" /> 
     <aura:attribute name="showNewButton" type="Boolean" default="true"/> 
      <aura:attribute name="formData" type="object" default=""/> 
    <!--<aura:registerEvent name="passBoatId" type="c.BoatId_serachform_BoatSerchResult"/>-->
    
    <aura:registerEvent name="formsubmit" type="c:formsubmit"/>
       <lightning:layout horizontalAlign="center" class="slds-align_absolute-center">
          <lightning:layoutItem padding="around-small">
              <lightning:select aura:id="boattypePicklist" value="{!v.options.Id}" onchange="{!c.onChange}" label="Alltype" required="true">
                  <option value="">All Types</option>
                  <aura:iteration items="{!v.options}" var="opt" indexVar="key">
                      <option text="{!opt.value}" value="{!opt.key}" selected="{!opt.key==v.options.Id}" />
                  </aura:iteration>
              </lightning:select>
          </lightning:layoutItem>
          <lightning:layoutItem padding="around-small">
              <lightning:button label="Search" class="slds-button slds-button_brand"  variant="brand" onclick="{!c.onFormSubmit}" />
              <aura:if isTrue="{!v.showNewButton}">
                  <lightning:button label="New" class="slds-button slds-button_neutral" variant="Neutral" onclick="{!c.NewBoat}"/>
              </aura:if>
          </lightning:layoutItem>
       </lightning:layout>
</aura:component>

<!--formsubmit.evt-->
<aura:event type="APPLICATION" description="Event template" >
    <aura:attribute name="formData" type="object"/>
</aura:event>
Please help me.
Hi to all,

I am a newbee here having problem to ececute a scenario from my institution.
When  a new Account record is inserted check wheather any duplicate Account exists based on Account Name,Industry  if duplicate record found throw error message. if duplicate records are notfound, check if type=Prospect, if so Create new Task  for the owner of the  account record and send email alert regarding new task. I have no idea ,I have put the toaddress but it is asking for receipent.
Above is the error when i tried to insert account.  and my code with class and trigger are
Trigger:trigger AccTaskTrigr on Account (After insert ) {   // Trigger code is good
    AccTaskTrigr.AccountTaskTrigger(Trigger.New);}  
class:
public class AccTaskTrigr {
    public static void AccountTaskTrigger(List<Account> newtrigger){
      
            List<Task> ListTasks =  new List<Task>();
           Task tsk =new task();
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        list<account> accs =[select Name, Industry from Account];
        
            For(account account1:  newtrigger){
            for(account a :accs){
                if(a.name!=account1.name && a.Industry !=account1.Industry){
                    if( account1.Type=='Prospect'){
                    tsk.OwnerId=account1.OwnerId;
                    tsk.Priority='High';
                    tsk.Subject='Email';
                    tsk.Status='In Progress';
                    tsk.WhatId=account1.Id;
                    listTasks.add(tsk);
                   List<user> toAdd=new List<user>();
                        list<string> toadd1 =new List<string>();
                    toAdd =([select user.email from user where user.id=:account1.Ownerid]);
                        for (user u: toadd){
                            toadd1.add(u.email);
                        }
                    mail.setToAddresses(toAdd1);
                    mail.setSubject('Attachments');
                    mail.setPlainTextBody('Test Message');
                    /*EmailTemplate emailt=[Select id from EmailTemplate where name = 'Account_Task_trigger'];
                    mail.setTargetObjectIds(listids);
                    mail.setSenderDisplayName('Vamshi Kothakapu SFDC');
                    mail.setTemplateId(emailt.id);
                    mail.setSaveAsActivity(false);*/
                    }}
                else{ account1.adderror('another account exists with values of name&Industry');}
                }
    }insert listTasks;
    Messaging.Email[] emails=new Messaging.Email[]{mail};
        Messaging.sendEmail(emails); ////Error line 38 is here
    } 
}
 
I have a lightning component that implements lightning:actionOverride how do I get the recordId of the parent when the action is triggered from a related list?

Hi All,

I have a page within which there a button "Add Filter". Beneath this button are some filters like:

 

Select Object(this is a select list containing all salesforce object)---Select Field(this is also a select list containing all fields of salesforce selected salesforce object)------Textbox(this is a textbox)------Remove(this is a button which should remove row).

 

When the user clicks on Add filter, a replica of all above filter items should be added beneath the current filter and on click of Remove button the respective filter should be removed.

 

Any one who as idea/sample code regarding this please help.

Thank you!

 

Regards,

Lakshman