• Abhi_Tripathi
  • PRO
  • 2148 Points
  • Member since 2013
  • Salesforce 7x Certified | cloudyabhi.blogspot.in
  • PwC SDC, Bangalore


  • Chatter
    Feed
  • 26
    Best Answers
  • 7
    Likes Received
  • 2
    Likes Given
  • 29
    Questions
  • 439
    Replies

Hello Team,

 

We are currently using <lightning:tree  to display Account Hierarchy Data. Customer has a requirement where they want to show icons beside type of record in the tree and also highlight with different color based on the account record type. Is there a way to accomplish this using <lightning:tree itself and not redoing with Trees?

 

 

        <lightning:tree items="{!v.items}" />

 

Hi Guys

Need to improve my code coverage of my trigger 75% to 100%
trigger DocumentAttached on Purchase_Order__c (before insert , before update) 
{ 
    for(Purchase_Order__c tsk : Trigger.new){ 
        Attachment[] attList = [select id, name, body from Attachment where ParentId = :Trigger.new[0].id]; 
        if(attList.size() > 0) { 
            tsk.PO_Uploaded__c =true; 
        }
    }
}

 
We have a trigger that doen't allow users to delete an Event, but admins that can delete events do not get the popup to confirm they do want to delete. How can I get the popup again?

trigger EventDelete on Event (before delete) {
    if([SELECT PermissionsModifyAllData FROM Profile WHERE Id = :UserInfo.getProfileId()].PermissionsModifyAllData) {
        return;
    }
    for (Event sb : Trigger.old) {
        sb.addError('Cannot delete an Event');
    }
}
Our Sales team members are beginning their formal training modules, one associate received the below error. Please advise on what is causing this error?.

Thanks!
User-added image

User-added image
Hi Guys,

I am trying to use a single lightnign controller in many place in the component, all the time wherever I am using it will have different parameters,
Please let me know how I can achieve that

Just for better understanding 
 
////////////////// component ////////////////////////////

<!--Here is the link 1 where I want to show function with param1 as the parameter -->
<a href="#" onclick="{c.Show('param1')}"> Link 1</a>

<!--Here is the link 2 where I want to use same  show function with param2 -->
<a href="#" onclick="{c.Show('param2')}"> Link 1


Thanks in advance
I have apex batch scheduled to run daily.This batch query sometime timesout (First error: [QUERY_TIMEOUT] Your query request was running for too long).

Is there any wayto retry the batch at the same time ?

The problem is, this type of error, doesnot go in the try/catch, and also no FInish method is called. So i am not sure how to detect this batch failure and rerun it. 

Sid
My users can complete a process when they are in an admin profile, but they get the Apex CPU Time Limit Exceeded error when they try to complete the same process in another profile.  Can anyone provide advice on where to start looking to fix this?

A previous admin set up everyone in a new department as under the admin profile.  I am now trying to migrate users to their own profile and this is my last hurdle.
Ok, our sandbox has just been upgraded to Sumemr16 and we are having issues with our Batch Apex processes.  We current submit a series of batch jobs using "Database.executeBatch" and when the process gets to the 2nd one we get the following error message...
"System.LimitException: Too many async calls created: 2"
I know the limits have been changed to One limit to rule them all, but I thought this was set at 200 not 2.
Anyone else seen this or have any ideas?
thanks
I have created a button on standard layout on Conatct Object,name as "SEND MAIL" button when I pressed it will be sending a mail to the given mail ID. Now i want when he open the link he will get a VF form, with the help of VF form he will update his contact fields.

 
Can any one help me out . How to send an email to Account Owner from contract object in Batch Class.Im using templateid ,in target object im giving the contact id ,in whatid im sending the Account owner email ,but the Account owner is not getting any email.What im doing is correct .Any help very much appreciated.
Portion of the Code :
global void execute(Database.BatchableContext bc, List < Contract >
     recs) {
            List < Messaging.SingleEmailMessage > mailList = new List < Messaging.SingleEmailMessage > ();
             for (Contract c: recs) {
                if (c.Contact_Email__c != null) {
                    List < String > toAddresses = new List < String > ();
                     List < String > CcAddresses = new List < String > ();
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    //toAddresses.add(c.Contact_Email__c);
                     ccAddresses.add(c.Account.Owner.Email);
                    //toAddresses.add(c.Account.Owner.Manager.Email);
                    // mail.setToAddresses(toAddresses);
                     mail.setCcAddresses(CcAddresses);
            mail.setTargetObjectId('c.contact__r.Id)');
                     mail.setWhatId(c.Account.Owner.Manager.Email));
                     mail.setTemplateId('00X4B000000M3go');
                     mail.setSaveAsActivity(false);
                mailList.add(mail);
                 }
            }
             Messaging.sendEmail(mailList);
         }

 
Every time we try to edit an account in Salesforce, we cannot open it and Salesforce ends up bugging and crashed. Thanks for the help you could give to solve this problem.
Hi Everyone,

I am not able to achieve the challenge in trial head  for below lightening concept.

Create a simple Lightning component with a styled headline. The headline must use an H1 tag with a CSS class that enforces a 24px font-size. Make the component available in the Navigation Menu of Salesforce1.
The component must be named 'MyLightningComponent'.
The component must include an H1 tag with a CSS class named 'headline'. The 'headline' CSS class must set a font-size of 24px.
The Lightning Component tab that is added to Salesforce1 must be called 'MyLightning'

i have created below components in my org.

1) MyLightningComponent.cmp

<aura:component implements="force:appHostable">
    <div class="headline">
        <h1>Headline</h1>
    </div>
</aura:component>

2) When i click 'style' button , 'MyLightningComponent.css' was created automatically and i have written below code.

.THIS.headline {
    padding-top: 24px;
}
 
I am getting below error when i check the challenge.  please any body suggest me if i am doing wrong.

Challenge Not yet complete... here's what's wrong:
The component does not include an H1 tag with a 'headline' CSS class


Thanks,
Nag.


 
hi,  i am getting    "unexpceted token where  error."      please solve this. 

Date dte = Date.today().addDays(-2);
      
         String Name ='dell ';
       String ActName ='Activity ';
       
return database.getquerylocator('select id,name__c,name__c,Project_Name__c from customerstatus__c where End_date__c staus__c !=\''+Name+'\' and type__c=\''+ActName+'\' where actual_End_date__c =: dte '
Hi all,

i have below requirement in trialhead.

For this challenge, you will need to create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code (API name: MailingPostalCode) matching the second. It gets the ID and Name of those contacts and returns them.
The Apex class must be called 'ContactSearch' and be in the public scope.
The Apex class must have a public static method called 'searchForContacts'.
The 'searchForContacts' method must accept two incoming strings as parameters, find any contact that has a last name matching the first, and mailing postal code matching the second string. The method should return a list of Contact records with at least the ID and Name fields.
The return type for 'searchForContacts' must be 'List<Contact>'.

i have written below code, but when i check challenge it is giving error.  like
'Challenge Not yet complete... here's what's wrong:
Executing the 'searchForContacts' method failed. Either the method does not exist, is not static, or does not return the expected contacts.

'Am i doing anything wrong?  please correct me or guide on this.

public class ContactSearch {
    
    public static List<Contact> searchForContacts(String sname,String postalcode)
    {
        List<Contact> Clist;
       
      insert new Contact[]{new Contact(LastName='aint',MailingPostalCode__c='5600069'),
            new Contact(LastName='aria',MailingPostalCode__c='5700085')};
       
      clist=[select Id,Name from Contact Where  LastName=:sname and MailingPostalCode__c=:postalcode];
        return clist;
    }
}

Thanks,
Nag.
        return database.getquerylocator('select id,name__c,name__c,Project_Name__c from customerstatus__c where End_date__c  =: Date.today().addDays(-2)');   

i am using this in batch apex start method.  i am getting error at this line at  where condition.     FATAL_ERROR System.QueryException: unexpected token: 'where'  
Hello All,
I had a requirement where i need to send an email notification 100 days before the contract end date.So based on this we had a batch and schedule class written.Now we would like to add few more condition in the code.
We have two picklist value as 'Status Renewed' and "Status Renewed next Year".This picklist field has some values  as Status renewed for nxt quarter , pipeline etc the other picklist has renewed and renewed lost.
Condition is when the "Status Renewed" is equal to "Status renewed for next quarter " or "Pipeline" AND when "Status Renewed next Year" is not equal to "Renewed" or"Renewed lost".
So how do i give this condition in an execute method.When this condition is satisfied ,then the email notification should be sent to the owner before 100 days.

Batch and Schedule Class:
global class NotificationEmailtoAccountExecutive implements Database.Batchable < sObject >, Schedulable, Database.Stateful {
	global List<String> errorMessages = new List<String>();
    global Database.QueryLocator start(Database.BatchableContext bc) {
     
        Date ed = Date.today().addDays(100);
        System.debug(Date.today().addDays(100));
        
        set<Id> setContractIds = new set<Id>();

        for(Contract_role__c objContract: [SELECT  Contract__c FROM Contract_role__c WHERE Role__c = 'Subscription Administrator' AND Contract__r.EndDate =: ed]) {
			setContractIds.add(objContract.Contract__c);
        }
        
        return Database.getQueryLocator('Select  id, Contract_Name__c , EndDate ,Contact_Email__c, Contract_End_Date_2__c, Owner.Email, Owner.Manager.Email ,Account.Owner.Email,Account.Owner.Manager.Email  FROM Contract  WHERE Id IN: setContractIds');
    }

    global void execute(Database.BatchableContext bc, List < Contract > recs) {
        List < Messaging.SingleEmailMessage > mailList = new List < Messaging.SingleEmailMessage > ();
        for (Contract c: recs) {
            if (c.Contact_Email__c != null) {
                List < String > toAddresses = new List < String > ();
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                toAddresses.add(c.Contact_Email__c);
	        toAddresses.add(c.Owner.Email);
                toAddresses.add(c.Account.Owner.Email);
                toAddresses.add(c.Owner.Manager.Email);
                toAddresses.add(c.Account.Owner.Manager.Email);
                mail.setToAddresses(toAddresses);
                mail.setSubject('Notification Before 100 Days of Contract End Date');
                String messageBody = '<html><body>Hi ' + c.Contract_Name__c  + ',<br>Your  Contract Expires within 100 Days . <br>Kindly take  action.<br><br><b>Regards,</b><br>ADP</body></html>';
                mail.setHtmlBody(messageBody);
                mailList.add(mail);
            }
        }
        Messaging.sendEmail(mailList);
    }

    global void finish(Database.BatchableContext bc) {
		AsyncApexJob aaj = [Select Id, Status, NumberOfErrors, JobItemsProcessed, MethodName, TotalJobItems, CreatedBy.Email from AsyncApexJob where Id =:BC.getJobId()];
        
        // Send an email to the Apex job's submitter notifying of job completion.
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {aaj.CreatedBy.Email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('JOB Salesforce NotificationEmailtoAccountExecutive Finished: ' + aaj.Status);
        String bodyText='Total Job Items ' + aaj.TotalJobItems + ' Number of records processed ' + aaj.JobItemsProcessed + ' with '+ aaj.NumberOfErrors + ' failures.\n';
        bodyText += 'Number of Error Messages ' + errorMessages.size() + '\n';
        bodyText += 'Error Message' + String.join(errorMessages, '\n');
        mail.setPlainTextBody(bodyText);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
	}
	
	global void execute(SchedulableContext SC) {
        NotificationEmailtoAccountExecutive batchable = new NotificationEmailtoAccountExecutive();
		database.executebatch(batchable);
    }
}
Any help very much appreciated.