• Abhi_Tripathi
  • PRO
  • 2138 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
Hi,
My question is : If i checked the checkbox then both fields will appear and if the checkbox is unchecked then both field will not appear.User-added image
Hi,
I have to  Create the HotelRemoter Controller. For this here is code:

global with sharing class HotelRemoter {
        @RemoteAction
         global static List<Hotel__c> findAll() {
               return [SELECT Id, Name, Location__Latitude__s, Location__Longitude__s
                                             FROM Hotel__c];
         }
 }

I got this error: Error: Compile Error: No such column 'Location__Latitude__c' on entity 'Hotel__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 5 column 16

 
I am working on a TrailHead quiz at
https://developer.salesforce.com/trailhead/force_com_admin_intermediate/business_process_automation/flow
I have created a New Account in a previous record create. I want to assign a new Contact to that new Acccount. Is the AccountID required and if so I  have the following issue: How to I take an Account ID from an account record and place it in a new Contact record for a contact record I have created in a previous step in a work flow? Is a formula required? 
For the new Contact Record, I have assigned  FirstName = {!FirstName} input from previous screen, same with LastName. I am guessing that to assign a Contact to an Account requires assigning the AccountID to the new contact record. I cannot figure out how to do that. 
I think I may have the same issue when I create a new Opportunity in the next step. :)
Thank you!


 
I have the below JSON POST callout class. The data is sent in an array format whereas the destination requires it in just normal format. please suggest to remove the array in this code an execute in normal format. Please help. I just want it to send data in normal format and not in an array.
 
public class WebServiceCallout {

    @future (callout=true)
    public static void sendNotification(string Id,string Email,string First_Name,string Last_Name,string phone,string Title,string Account) {
conweb cont=new conweb(Id,Email,First_Name,Last_Name,Phone,Title,Account);
List<conweb> conwebs=new List<conweb>();
conwebs.add(cont);
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
req.setTimeout(2000); // timeout in milliseconds
        req.setEndpoint('http://178.62.64.210/api/user');
        req.setMethod('POST');
        req.setHeader('Content-Type','application/json');
        req.setHeader('Authorization','gfkj^%$654GF65yhtd54');
       req.setBody(JSON.serialize(conwebs));
        //req.setBody('Id='+EncodingUtil.urlEncode(Id, 'UTF-8')+'&Email='+EncodingUtil.urlEncode(Email, 'UTF-8')+'&First_Name='+EncodingUtil.urlEncode(First_Name, 'UTF-8')+'&Last_Name='+EncodingUtil.urlEncode(Last_Name, 'UTF-8'));
        //req.setCompressed(true); // otherwise we hit a limit of 32000

        try {
            res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }

    }

 
    
    
    public class conweb
    {
    String salesForceId;
    String emailAddress;
    String firstName;
    string lastName;
    string contactNumber;
    string jobTitle;
    string companyName;
   
    public conweb(string sid,string semail,string sfirstname,string slastname,string sphone,string Title,string Account)
    
    {
    salesForceId=sid;
    emailAddress=semail;
    firstName=sfirstname;
    lastName=slastname;
    contactNumber=sPhone;
    jobTitle=Title;
    companyName=Account;
  
    }
    }}

 
AND ( RecordTypeId = '012E0000000NA5U' , ISBLANK ( Date__c ) , ISPICKVAL ( Status , "Completed" ) )
public PageReference saveAndBind(){ 
        
        PageReference pgRef = controller.save();
        Site__c site;
        
        Map<string,string> URLParameters = ApexPages.currentPage().getParameters();
        String returnPage; 
        if(URLParameters.containsKey('returnBack')){
            returnPage = URLParameters.get('returnBack');
            pgRef = new PageReference('/' + returnPage); 
        }
        System.debug('Page Reference URL is :' + pgRef);
        if(null != pgRef){
            site = new Site__c();
            if (null != returnPage && returnPage.length() >=3 && returnPage.substring(0,3).equals(DescribeUtility.getObjectKeyPrefix('Account'))){
                site.Account__c = returnPage;
            }
            else if(null != returnPage && returnPage.length() >=3 && returnPage.substring(0,3).equals(DescribeUtility.getObjectKeyPrefix('Opportunity')))
            {
                if(site.opportunity__r.site_name__c!=null)
                    site.name=site.opportunity__r.site_name__c;
                else 
                    site.name= addr.address_line_1__c +' '+addr.city__c+' '+addr.state__c;    
                    site.Opportunity__c = returnPage;
                  system.debug('@@-->Opportunity');
            }
            
            // Added by Piyush for Item 5568
            else if(null != returnPage && returnPage.length() >=3 && returnPage.substring(0,3).equals(DescribeUtility.getObjectKeyPrefix('Contract')))
            {
                site.Contract__c = returnPage;
                  system.debug('@@-->Contrct');
            }
            
            site.Address__c = controller.getRecord().ID;
            site.zip__c = addr.Postal_Code__c;
            Insert site;
        }
        return pgRef;
    }
    
     public String getAccountKeyPrefix(){
        Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe();
        return dsr.getKeyPrefix();
     }
}
I'm working now in an special project, and I would like to use visual flow to build this app, so in one part of this project, there is a requirement of show a look up option, as drop down list, to bring a full list of items filtered by family, from Product Object

​Has somebody done this before?, Any Example???

I want to override the standard SF view to a custom controller, but only standard controllers appear in the VF dropdown list. I need to either:

Find a way of overriding with a custom controller

OR

Switch off the SF behaviour (My problem is the recent items link in the home page takes users directly to the standard SF layout which I do not want users to have access to.

Any ideas?

Hi,

I am trying to write my first trigger and I am running into major roadblocks!  I have done some testing but I think the problem is a little too much for a novice.

Summary:
I am the admin for a group that does mobile advertising.  In mobile advertising there is often an agency that will buy ads on behalf of the client.  I am trying to pull in the billing information from the account page into the opportunity automaticaly for the sales and billing teams.  We will often have multiple opportunities for each client (ex.  Summer campaign, Back to School campaign, Holiday campaign, etc.) and it does not make sense to enter the billing information on the opportunity each time.  It should be entered on the account page once and then pulled into each opportunity automatically.  

On the Account page, in the related contact list, a new contact is created and the billing information is entered.  We have 2 fields on the opportunity page that are both account look up fields (see scenarios below).

Goal:  On the opportunity, have the billing contact look-up field automatically grab the related billing contact from the account page


Oh yea, some other items that make this kind of a pain:
  • I am on the enterprise edition but I am part of a larger org (I am 1 of 50 or so business units)
    • This means we have to share fields and it is easy to reach the limits - also means it is sometimes hard to get new fiels on popular objects
  • Account page
    • Will not be able to get any additional fields to enter billing contact information, I was told to enter it in the related contact list
  • Contact page
    • I was able to get custom picklist values added to a field to flag that is it a billing contact for our business unit
  • Reporting
    • Since there are two account look up fields, anytime you try to run an opportunity and account report it will only pull in information for the client account, not the agency account.  I need to pull in the billing contact on the opportunity to create the look up for reporting to work (see scenarios below)
  • Record Types
    • You basically need to include a record type for everything.  This rule should only fire for our record type and should not be applied to any other business unit.


Scenario 1:  Client is buying ads direct and will be billed directly
Account Field:  (look up client)
Partner Field:  (would be blank since there is no agency)

Scenario 2:  Agency is buying ads for the client - agency will be billed by us, they will then in turn bill the client on their own
Account Field:  (look up client)
Partner Field:  (look up agency)


Opportunity Fields:
Account Name (Account)
Partner (Partner__c)
Billing Contact (Billing_Contact__c)
Opportunity Record Type:  Ad Sales

Contact Fields:
Name (First Name and Last Name - not sure how Salesforce combines them into one field)
Contact Type (Contact_Type__c) (picklist value of "Billing")



If there is a partner, grab the billing contact from the partner account page.  If there is no partner, grab the billing contact from the client account page.  The trigger should fire every time the opportunity changes stages.  Sometimes we do not have the billing information when the sales rep is first working with the client (50% or less opportunity probability).  By the time the opportunity gets to 75% or higher though we are getting a contract in place and then is when the billing information is generally listed on the contract.  

I was going to create a separate validation rule that would not allow the opportunity to go to 100% unless the billing contact look-up field had a value entered - i.e. the sales rep entered the billing information on either the client account or the agency account page.


I think that is everything but let me know if I missed something that helps to expalin this more!

hi, why is it that my trigger shows this error = Error:Apex trigger SSExpensesCountonPayroll caused an unexpected exception, contact your administrator: SSExpensesCountonPayroll: System.LimitException: Too many SOQL queries: 101?
what should i do to prevent this error?

this is my trigger:

trigger SSExpensesCountonPayroll on Expense__c (after insert, after update, after delete) {
    Map<Id, List<Expense__c>> PayrollExpenses = new Map<Id, List<Expense__c>>();
    Set<Id> PRIds = new Set<Id>();   
   
    List<Payroll__c> PRList = new List<Payroll__c>();
    List<Expense__c> ExList = new List<Expense__c>();
   
    if(trigger.isInsert || trigger.isUPdate) {
        for(Expense__c ex : trigger.New) {
            PRIds.add(ex.Payroll__c);    
        } 
    }
   
    if(trigger.isDelete) {
        for(Expense__c ex : trigger.Old) {
            PRIds.add(ex.Payroll__c);    
        } 
    }      
   
    ExList = [SELECT Id, Amount__c FROM Expense__c WHERE Type_of_Expense__c = 'Spareparts & Supplies' and Payroll__c IN : PRIds];
    double t=0;
    for(Expense__c ex : ExList) {
            if(ex.Amount__c != null) {
                t += ex.Amount__c;
            } 
    }   
       
    PRList = [SELECT Total_SS_Expense__c FROM Payroll__c WHERE Id IN : PRIds];
   
    for(Payroll__c pr : PRList) {
        List<Expense__c> ExpList = new List<Expense__c>();
        ExpList = PayrollExpenses.get(pr.Id);
        pr.Total_SS_Expense__c = t;
    }   
    update PRList;
}

  • February 25, 2014
  • Like
  • 0

when to go for eclipse and when to go for developer console

What does creating a field comes under, customization or Configuration.

Hi everyone ,

 

i want to write a test class for the following apex class . Please help me 

 

APEX class:

 

public class ImportContactsController 
{

public blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvfilelines{get;set;}
public String[] inputvalues{get;set;}
public List<string> fieldList{get;set;}
public List<Account> sObjectList{get;set;}
public integer count =0;

 public void readcsvFile()
    { 
        csvFileLines = new String[]{}; 
        FieldList = new list<String>();
        sObjectList = new list<Account>();   
        csvAsString = csvFileBody.toString();
        csvfilelines = csvAsString.split('\n');
        inputvalues = new String[]{};
        for(string st:csvfilelines[0].split(',')) 
        FieldList.add(st);      
      
        for(Integer i=1;i<csvfilelines.size();i++)
        {
            Account obj = new Account() ;
            string[] csvRecordData = csvfilelines[i].split(',');
            obj.Name = csvRecordData[0];
            obj.Mobile__c = csvRecordData[1] ;             
            obj.Workshop_Number__c = csvRecordData[2] ;                                                 
            sObjectList.add(obj);   
        }  
                      
        Database.UpsertResult[] results = Database.upsert(sObjectList,Schema.Account.Workshop_Number__c, false);
        for (Database.UpsertResult res : results) 
        {
            if (res.isSuccess()) 
            {          
                count ++; 
            }
            else 
            {
                if (res.getErrors().size() > 0) 
                {
                     ApexPages.AddMessage( new ApexPages.Message( ApexPages.Severity.WARNING, ' ' +res.getErrors()[0].getMessage() ));
                }
            }          
        }
         ApexPages.AddMessage( new ApexPages.Message( ApexPages.Severity.INFO, +count+ ' Records Inserted ' ));         
    }
}

 

Please guide in writing a proper test class for this 

 

Thanks in advance 

 

I have rewritten a class which originally had its test code within the actual class. I am now trying to move this test code into its own class and am getting some errors. 

 

Whenever I run this test I get an error saying "Attempting to de-reference a null object". 


Here is the full code : 

I have rewritten a class which originally had its test code within the actual class. I am now trying to move this test code into its own class and am getting some errors.

Whenever I run this test I get an error saying "Attempting to de-reference a null object".


Here is the full code :

@isTest
private class TestCSHOrgModelQuarterly {
static Id getRecordTypeId(String sObjectType, String Name) {
return [select id from recordtype where sobjecttype=:sObjectType and name=:Name limit 1].id;
}
static final Id A_MM_Rectype = getRecordTypeId('Organization_Model__c','Global');

User User1;
Organization_Model__c Org1;
//CSH_New__c csh1, csh2, cshErr;
String u; // Unique number for this test run.

TestCSHOrgModelQuarterly() {

// Create a unique string for this test so we're never confused with existing data.
u = Datetime.now().millisecond().format();

// Create the two users:
Profile p = [select id from profile where name='Standard User'];



User1 = new User(LastName=u+'Test2', email='test2@test.com', CompanyName='BCD Testing', Country='USAISTAN', Department='Sales', Title='Tester 2', alias='test2',
username='test2@test.com', emailencodingkey='UTF-8', languagelocalekey='en_US', localesidkey='en_US', profileid = p.Id, timezonesidkey='America/Los_Angeles',
Division='North America', isActive = True);
insert User1;


Org1 = new Organization_Model__c(Name=u+'Test2', recordtypeid=A_MM_Rectype, Org_Model_CSH_to_be_completed_by__c = User1.id, Org_Model_CSH__c = 'Quarterly');
insert Org1;



//killtime();
// Note: Satisfied comes *after* unhappy, so that's the one we should be cloning.
}

static testMethod void testReview() {
// Reduce the number of message we get during debugging.
system.debug(Logginglevel.DEBUG);

// All we're really doing is setting up the data, calling the routine, and checking the results.
TestCSHOrgModelQuarterly x = new TestCSHOrgModelQuarterly();

Date tod = Date.Today();
// Calculate the dates we might use for AM_Completion depending on record type.
Date AM_Date_10 = Date.newInstance(tod.addMonths(1).year(),tod.addMonths(1).month(),10);
Date AM_Date_15 = Date.newInstance(tod.addMonths(1).year(),tod.addMonths(1).month(),15);


//Integer nCSHatStart = [select count() from CSH_New__c where Name like :unique and CreatedDate = Today];
//system.debug('Number of CSH\'s before the run is: ' + nCSHatStart);

// Instantiate the class which runs the code.
test.startTest();
CSHOrgModelQuarterly CSHR = new CSHOrgModelQuarterly();

String xxx = CSHR.doReview(true);

test.stopTest();



}
}

And the error is referencing these two lines :
insert User1;

TestCSHOrgModelQuarterly x = new TestCSHOrgModelQuarterly();

Does this mean my test records are not being made or is that something else ? I really appreciate any help I can get.

Thank you.

 

And the error is referencing these two lines : 

 insert User1;

 

TestCSHOrgModelQuarterly x = new TestCSHOrgModelQuarterly();

 


Does this mean my test records are not being made or is that something else ?  I really appreciate any help I can get.

 

Thank you.

  • December 04, 2013
  • Like
  • 0
Hi Iam new to witing test class any body help me out the test class for below class?
public class BadgeAssignmentReportController{ public string un { get; set; } public List<WorkBadge> badges { get; set; } public List<WorkBadge> listbadges{get; set;} public Boolean badgeListSize{get;set;} public boolean noBadgeMsg{get;set;} public String fromDate{get;set;} public String toDate{get;set;} public PageReference generateBadgeReport() { system.debug('-------------------------'+un); system.debug('-----------toDate--------------'+toDate); system.debug('-----------fromDate--------------'+fromDate); Date myfromDate; String[] tempStr = fromDate.split('/'); Integer m = Integer.valueOf(tempStr[0]); Integer d = Integer.valueOf(tempStr[1]); Integer y = Integer.valueOf(tempStr[2]); myfromDate= Date.newInstance(y,m,d); Date mytoDate; String[] tempStr1 = toDate.split('/'); Integer m1 = Integer.valueOf(tempStr1[0]); Integer d1 = Integer.valueOf(tempStr1[1]); Integer y1 = Integer.valueOf(tempStr1[2]); mytoDate = Date.newInstance(y1,m1,d1); system.debug('--------------myFromDate -----------'+myFromDate); system.debug('--------------myFromDate -----------'+mytoDate ); if(un == null || un=='--None--'){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Select a User')); } if(toDate == null){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Select To Date')); } if(fromDate ==null){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Select From Date')); } listbadges = new List<WorkBadge>(); listbadges=[select id,RecipientId,CreatedById,Definition.imageUrl,Definition.Description,CreatedDate from WorkBadge where RecipientId=:un and CreatedDate >=:myFromDate and CreatedDate <=:mytoDate]; // system.assertEquals(listbadges,null); badges =new List<WorkBadge>(); badges.addall(listbadges ); badgeListSize = badges.size()>0? true:false; noBadgeMsg = badges.size()==0? true:false; return null; } public List<selectoption> options=new List<selectoption>(); public List<selectoption> getPickvaluesTest() { //profile userProfile =[select id from profile where name ='Chatter Free User' limit 1]; if(options.size()>0){ options.clear(); } options.add(new selectoption('--None--','--None--')); for(User us:[select id,Name from User where isactive = true]) { options.add(new selectoption(us.id,us.Name)); } return options; }

 Thanks,

 

Isha

Hi Friends...

I run a test class in eclipse and passed with coverage of 82%. If I run in apex execution, the status symbol appearing as red and the result displaying as "Could not run tests on class Class Id but if I click on the class in apex execution page the methods of test class are passing with result as Pass. 

 

What could be the reason of this kind error... Please post your comments if you have any Idea regarding this.

Hi,

I have written a test class for the following trigger:

Trigger:

 

trigger serviceAgreementInactive on Service_Agreement__c(after update){

Set<id> servids = new Set<id>();

List<Equipment__c> eq=new List<Equipment__c>();
for(Service_Agreement__c serv: Trigger.new){

if(serv.status__c == 'Inactive' && serv.Status__c != trigger.oldMap.get(serv.id).Status__c) {

servids.add(serv.id); } }
List<Equipment__c> equipmentsToMakeExpire = [Select id, Contract_Status__c from Equipment__c where Job_Number__c in :servids];

for(Equipment__c e : equipmentsToMakeExpire){

e.Contract_Status__c = 'Under Expired Contract'; eq.add(e); }

if(!eq.isEmpty())

update eq; }

 

 

Test Class:

 

@isTest private class TestServiceAgreementInactive {

 static testMethod void testServiceAgreement() {

    Service_Agreement__c servAggrement1 = new Service_Agreement__c(Account__c = 'Test Service Agreement Account1', Name = 'Test Service Agreement1', CurrencyIsoCode = 'Canadian Dollar', Status__c = 'Active');

  Service_Agreement__c servAggrement2 = new Service_Agreement__c(Account__c = 'Test Service Agreement Account2', Name = 'Test Service Agreement2', CurrencyIsoCode = 'U.S. Dollar', Status__c = 'Active');   

List<Service_Agreement__c> lstServAgreement = new List<Service_Agreement__c>();

  lstServAgreement.add(servAggrement1);

  lstServAgreement.add(servAggrement2);

  insert lstServAgreement;

     Equipment__c equip1 = new Equipment__c(Name = 'Equipment 1', CurrencyIsoCode = 'Canadian Dollar', Job_Number__c = lstServAgreement[0].Id); 

  Equipment__c equip2 = new Equipment__c(Name = 'Equipment 2', CurrencyIsoCode = 'U.S. Dollar', Job_Number__c = lstServAgreement[1].Id);   

 List<Equipment__c> lstEquipment = new List<Equipment__c>();

  lstEquipment.add(equip1);

  lstEquipment.add(equip2);

  insert lstEquipment;  

    lstServAgreement[0].Status__c = 'Inactive';

  lstServAgreement[1].Status__c = 'Inactive';

     update lstServAgreement;

            } }

 

Upon running this in the Dev Console it throws an error as: "System.StringException: Invalid id: Test Service Agreement Account1"

  • November 28, 2013
  • Like
  • 0

I wrote a basic APEX Class that helps create a case from a VisualForce page and need to write a test class for it. I am far from being a developer and managed to get the class uop and running but I do not have the foggiest idea where to start for a test class

public class SubmitCaseController {
    public Case c { get; set; }
    public SubmitCaseController() {
        c = new Case();
    }
    public PageReference submitCase() {
            try {   
                        
                // Specify DML options to ensure the assignment rules are executed
                Database.DMLOptions dmlOpts = new Database.DMLOptions();
                c.Created_By_User__c = UserInfo.getUserId();
                c.OwnerId = '00G30000003El5v';
                c.RecordTypeId = '012n00000004I1r';
                c.Origin = 'Internal Ticketing';
                c.setOptions(dmlOpts);

                // Insert the case
                INSERT c;
                return new PageReference('/apex/thank_you_case_submission');
            } catch (Exception e) {
                ApexPages.addMessages(e);
                return null;
            }
        
    }
 }

 

Hello,

I need help writing test coverage for this trigger I created that will update my custom billing address fields on insert.

Trigger AddressMapNonStandardFields on Account(before insert){
For(Account a:Trigger.new){
   a.Billing_Street_Number__c=a.BillingStreet;
   a.Billing_Street_Name__c=a.BillingStreet;
   a.Billing_City__c=a.BillingCity;
   a.Billing_State_ABB__c=a.BillingState;
   a.Billing_Zip_Code__c=a.BillingPostalCode;
}
}

 

Any help would be greatly appreciated!

Hi,

 

I'm trying create a test class for this trigger:

 

trigger DeleteTask_Solicitacao_Pagamento on Case (after update){
           
    Set <id> ids = new Set <id> ();
    for (Case c: trigger.new) {
        if (c.motivo__c == 'Solicitação de Pagamento' && c.status <> 'Fechado') {
            ids.add(c.id);
        }
    }  
             
  for (Case c: trigger.new) {
      if ((c.Quantas_PP_s_pagamento__c >= 1 || c.Quantidade_de_PP_s_Estojo__c >= 1) && (c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados')){
      if(ids.size()>0){
          for (Task t: [SELECT Id, description, Solicita_o_de_Pagamento__c FROM Task WHERE (subject = 'Solicitação de Pagamento - Lançar PP' OR subject = 'Solicitação de Pagamento - Baixar PP') AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }      
      if ((c.Quantas_PP_s_pagamento__c < 1 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c < 1 || c.Quantidade_de_PP_s_Estojo__c == null)){
      for (Task t: [SELECT whatid, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Lançar PP' AND status != 'Concluído' AND whatid IN: ids]){
      delete t;
          }
      }
      if (c.Nota_fiscal__c == 'SIM' && (c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados')){
      if(ids.size()>0){
          for (Task t: [SELECT description, Solicita_o_de_Pagamento__c FROM Task WHERE subject = 'Solicitação de Pagamento - Solicitar Nota Fiscal' AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }
      if (c.Nota_fiscal__c != 'SIM'){
      if(ids.size()>0){
          for (Task t: [SELECT whatid, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Solicitar Nota Fiscal' AND status != 'Concluído' AND whatid IN: ids]){
      delete t;
          }
      }
      }
      if ((c.forma_de_pagamento__c == 'MALOTE' || c.forma_de_pagamento__c == 'DEPÓSITO + MALOTE') && c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados'){
      if(ids.size()>0){
          for (Task t: [SELECT description, Solicita_o_de_Pagamento__c FROM Task WHERE subject = 'Solicitação de Pagamento - Malote' AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }
       if (c.forma_de_pagamento__c != 'MALOTE' && c.forma_de_pagamento__c != 'DEPÓSITO + MALOTE'){
       if(ids.size()>0){
       for (Task t: [SELECT whatId, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Malote' AND status != 'Concluído' AND whatid IN: ids]){
          delete t;
      }
       }
       }
       if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' && c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'MALOTE' && (c.Quantas_PP_s_pagamento__c == 0 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c == 0 || c.Quantidade_de_PP_s_Estojo__c == null)){
       if(ids.size()>0){
          for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = false;
               t.Solicitar_PP__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
         update t;
         }
         }
         }
      if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'DEPÓSITO + MALOTE' && (c.Quantas_PP_s_pagamento__c == 0 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c == 0 || c.Quantidade_de_PP_s_Estojo__c == null)){
      if(ids.size()>0){
             for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = false;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = true;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
         update t;
         }
         }
         }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c != 'MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){
        if(ids.size()>0){
            for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = false;
               t.Solicitar_Dep_sito__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
       update t;
        }
        }
        }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){
        if(ids.size()>0){
        for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
            t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
      update t;
        }
        }
        }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'DEPÓSITO + MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){        
        if(ids.size()>0){
        for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = true;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
       update t;
        }
        }
        }
         if (c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' && c.Tipo_de_solicita_o__c == 'Divisão de resultados'){
         if(ids.size()>0){
         for (Task t: [SELECT whatId, subject, status FROM Task WHERE Subject != 'Solicitação de Pagamento - Aprovar solicitação' AND status != 'Concluído' AND whatid IN: ids]){
         delete t;        
      }
     }
     }
     }
}

 

Can anyone assist me?

 

Thanks.

Trying to add css class in lightning:tab, but always getting the aura:id value as undefind, I am trying to load my third tab as red in color onload of the component.
here is the component
<lightning:tabset selectedTabId="tabRec" aura:id="tabset" > 
         <lightning:tab label="Lead1" aura:id="tab1" class="tabPadding"> 
         <lightning:tab label="Lead2" aura:id="tab2" class="tabPadding">
         <lightning:tab label="Lead3" aura:id="tab3" class="tabPadding"> 

</lightning:tabset>


Here is the helper, calling this function in init
applyCSS: function(cmp, event) { 
        var cmpTarget = cmp.find("tab3"); 
        alert(JSON.stringify(cmpTarget)); 
        $A.util.addClass(cmpTarget, 'changeMe');
 },


This is style
 
.THIS .changeMe { 
      background:red!important; 
}

 

1down votefavoriteI am trying to auto populated the force:inputfield but its not working, is there some specific way to populating as other types of field are working fine like picklist, text, date & checkbox

Here is the code
Component
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="recordId" type="Id"/>
<aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account' }"/>
<!-- lookup to lead on account object -->
<force:inputField aura:id="accNe2" value="{!v.account.Lead__c}"/>

Here is the controller
 
doInit: function(component) {

    var action = component.get("c.getAccountFieldValues");
    action.setParams({ recordId : component.get("v.recordId") });
    action.setCallback(this, function(actionResult) {
        var infos = actionResult.getReturnValue();
        component.set("v.account", infos);             
    });
    $A.enqueueAction(action);
},

And the apex method has normal SOQL returning account record.
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
Hi All,

While setting up the CLIQ, its giving me the error below, I don't know which path to set to make it working

User-added image

thanks in advance
Abhi
Hi I am trying to merge two or more pdfs in one pdf in Salesforce, I looked into many things and searched allot but didn't got anything.
If anybody have done any POC on this thing do let me know.

Thanks
Hi,

I am having a regex expression for a perticular format. The format is working a I want, but now I want to add Starting and Trailing spaces with the expression. but didn't succeed, 

My regext expression is [a-zA-Z]{1}(\d){8}​

Any help would be appreciated.
Hi there,

I am getting error when trying to add something in my profile in Title option.

I guess error is coming because of the exceeding limit in Title Option, Please do put a limit option on it
Here is the proof

Discussion Board Error


Regards,
Abhi Tripathi
Salesforce Developer
Blog : http://abhithetechknight.blogspot.in/
 
 
Hi All,

Preparing for DEV 501 Advance developer certification, other then Apex Guide and VF guide, if anyone have any reference document or set of practice test question please do forward at abhi.rec08@gmail.com
 
Hi Folks,

I am updating my case Records with Milestone actions, on the update of the case record  a trigger will run to again Update the Case record to attach another Milestone to the Case record.

But trigger is not running after field update on Case by the Milestone Action, Milestone Action update the case field value right on the voilation time.
If we want to run a trigger on Time dependent workflow , the trigger runs , but not happening with the milestone action's Field Update,

Any help would be appreciated.

My requirement is that I want to attach another Milestone on voilation of the First Mileston, without editing the record

Thanks in Advance
Regards,
Abhi

Hi,

I am getting internal server erro while saving a case, I have written a trigger on the case object as well,
Anybody have any idea about this thing

User-added image

Hi Everyone,

I am trying to Delete Entitlement Process, but it showing a reference of an Entitelment which is already deleted,  I have emptied my Case records also, Entitlements also, but donno why it's showing that Entitlement reference.

I think its a bug in Salesforce

Regards,
Abhi Tripathi
Hi Everyone,

I have enable entitlement in my org, and added fields on the case layout, there is field name time that I added on the layout its showing twice on the case layout don't know whats happening exaclty, If somebody have faced same issue and please let me know, below is the snapshot.

User-added image

Regards and thanks in advance
Abhi
Hi Everyone,

I am currently preparing for Salesforce Advance Developer Certication exam, if any body have any study material or dump so please send it to me.
Any help would appreciated.

My Email Id : abhi.rec08@gmail.com


Best Regards,
Abhi Tripathi 
Salesforce Developer 
Hi there,

I have more 2 yrs of Experience in salesforce, I am Salesforce Certified Developer, hands on experience in salesforce Cofiguration , Apex Class, Vf pages, Test classes, Integration, Triggers, documentation and handeling clients etc.
Currently am looking salesforce developer freelancer job.
Any help would be appreciated.

to know more about me.
My Linkedin Profile : http://www.linkedin.com/pub/abhi-tripathi-%E2%98%81/46/906/317
My Blog : http://abhithetechknight.blogspot.in/2014/05/opportunity-probability-field-value.html

Warm Regards,
Abhi Tripathi
Salesforce Certified Developer
Mobile : +91-9928833992
Skype : abhi.tripathi7


Hi Everyone,

I am trying to free header pane in excel, while am exporting it from Salesforce.

There is a method in Java

sheet1.createFreezepane(0,1);

Is there anything using javascript or something else in Apex class or page so that we can freeze the header in excel.

Regards,
Abhi Tripathi
Salesforce Certified Developer

Hi,

 

Can We change default landing page of Chatter Feed to "All Company"

 

My chatter feeds default landing page is "What I follow" but I want to change it to "All Company"

 

Can't find anything so now am here 

Hi,

 

Can We change default landing page of Chatter Feed to "All Company"

 

My chatter feeds default landing page is "What I follow" but I want to change it to "All Company"

 

Can't find anything so now am here 

Hi,

 

I have writtern a code on my task Trigger to set "Send Email Notification" to true, but using that its sending email to assigned user Two times,

 

Really not getting the logic and how to solve it ?

 

My code is

 

//List of task
List<Task> taskClone = [Select Id From Task Where Id=:tasks.keySet()];
	
		//Set EmailHeader.triggerUserEmail to true
		Database.DMLOptions dmlo = new Database.DMLOptions();
		dmlo.EmailHeader.triggerUserEmail = true;
		
		System.debug('@@@@@@' + taskClone);
			
		//Update Task 	
		database.update(taskClone, dmlo);  

 

 

Any help would be appreciated

Hi all,

I want to display Account History as a related list in Visual force page. I am trying below syntax

<apex:page standardController="Account">
        <apex:relatedList list="AccountHistory"/>
</apex:page>

But it is giving error as 'AccountHistory' is not a valid child relationship name for entity Account '

Please let me know the correct syntax of API name for account history to display it as a related list.

hey..

 

Am having a salesforce site, which have a login page, i created that login page , am not using standard salesforce provided login page,

This login page have Email and password field and a login button, the email will be the Email of contact and the password is also a field of Contact. 

 

When am using "site.login( username, password , startURL)" its showing error on page that "Your login attempt has failed. Make sure the username and password are correct."

 

But when i used a normal redirect to the new page its working fine.

 

Can anybody tell mw what is the problem with this thing?

 

 

Hi All,

While setting up the CLIQ, its giving me the error below, I don't know which path to set to make it working

User-added image

thanks in advance
Abhi
Hi I am trying to merge two or more pdfs in one pdf in Salesforce, I looked into many things and searched allot but didn't got anything.
If anybody have done any POC on this thing do let me know.

Thanks
Hi,

I am having a regex expression for a perticular format. The format is working a I want, but now I want to add Starting and Trailing spaces with the expression. but didn't succeed, 

My regext expression is [a-zA-Z]{1}(\d){8}​

Any help would be appreciated.
Hi there,

I have more 2 yrs of Experience in salesforce, I am Salesforce Certified Developer, hands on experience in salesforce Cofiguration , Apex Class, Vf pages, Test classes, Integration, Triggers, documentation and handeling clients etc.
Currently am looking salesforce developer freelancer job.
Any help would be appreciated.

to know more about me.
My Linkedin Profile : http://www.linkedin.com/pub/abhi-tripathi-%E2%98%81/46/906/317
My Blog : http://abhithetechknight.blogspot.in/2014/05/opportunity-probability-field-value.html

Warm Regards,
Abhi Tripathi
Salesforce Certified Developer
Mobile : +91-9928833992
Skype : abhi.tripathi7


Hi,

 

I have writtern a code on my task Trigger to set "Send Email Notification" to true, but using that its sending email to assigned user Two times,

 

Really not getting the logic and how to solve it ?

 

My code is

 

//List of task
List<Task> taskClone = [Select Id From Task Where Id=:tasks.keySet()];
	
		//Set EmailHeader.triggerUserEmail to true
		Database.DMLOptions dmlo = new Database.DMLOptions();
		dmlo.EmailHeader.triggerUserEmail = true;
		
		System.debug('@@@@@@' + taskClone);
			
		//Update Task 	
		database.update(taskClone, dmlo);  

 

 

Any help would be appreciated

hey,

 

    I am trying to delete contacts (Child records) of an Account, but only when i remove the LastName(Mandatory field) of a contact record.

Actually  i have visualforce page where LastName field of Contact is an input field, if user wants to update he can change the LastName and the record will be Updated...this thing is happening in my code

     BUT trying to delete the records by removing the LastName and leaving it BLANK...Thats not happening.

 

Regards 

Abhi Tripathi

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.

 

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.