• Sukhdeep Singh
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 7
    Replies
Hi,

I need to check the "Assign using active assignment rule" check box field & change status to 'open' at Lead update But getting error "System.LimitException: Too many SOQL queries: 101"
Please suggest,

Thanks,

The code is below


trigger AssignLeadFromTimeOutQ on Lead (after update) {

    List<Lead> ls = new List<Lead>();
    Lead tempLead = Trigger.new[0];
        if (tempLead.OwnerId == '00P40000001l62pEAA' && UserInfo.getUserId() == '00570000001PNMtAAO') {
            ls.add(new Lead(id = tempLead.id, status = 'Open'));
            Database.DMLOptions dmo = new Database.DMLOptions();
            dmo.assignmentRuleHeader.useDefaultRule = true;         
            Database.update(ls, dmo);   
          }
}
List<Asset> lst=  [select Id, ProductCode, Product_Family1__c, Product_Family__c from Asset WHERE AccountId = '0015000000IBGof' AND ( (NOT IB_Status__c Like '%eval%') OR (NOT IB_Status__c Like '%Under Right of Return%') OR (NOT IB_Status__c Like '%Sold - Demo%') OR (NOT IB_Status__c Like '%WRITTEN OFF%') ) AND Product_Family__c != 'Whitewater'];

I am getting below error
No such column 'ProductCode' on entity 'Asset'. 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.

Also I need to use group by (Product_Family1__c, Product_Family__c) this query But getting error
<td align="center"  style="font-weight: bold;color:Red;"><a href="{!URLFOR($Action.Attachment.delete, a.Id)}">Delete</a></td>

I am getting Error: Field $Action.Attachment.delete does not exist. Check spelling
Please suggest, How can I delete
Hi I am useing below code to display multiple fields in a pageblock.
But I need span one field in two columns. How can I do this

<apex:pageblockSection title="Lead Details" columns="2"> 

<apex:outputField value="{!sellead.Description}" ><apex:inlineEditSupport event="ondblclick" 
            showOnEdit="saveButton, cancelButton" /></apex:outputField> 
I useing below code for controller & VF. But error does`t display on VF.

Controller:-

public PageReference Saveod(){  
        for(Opportunity_Development__c od:odList)   {
             if(od.Account_Plan__c == null)
            od.Account_Plan__c=ap.id;
        }
        try
        {
            pagereference p = apexpages.Currentpage();
            upsert odList;
        }
        catch (Exception e)
        {
            System.debug('AccountPlanningExtensionSaveod() Exception ===> '+e);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please use Save button at the top of the page to save header information.'));
//          ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please use Save button at the top of the page to save header information.');
//            ApexPages.addMessage(msg);
//            return p;
        }




VF:-


<apex:page standardController="Account_Plan__c" extensions="AccountPlanningExtension" standardStylesheets="true">
<apex:pageMessages />
 
I am useing below VF code. When I change a value of field 'company' & click once outside of the text field & then press save button the value
gets saved. But it does`t save If I dirrectly click on save button after changing a value in text field
Please suggest . . . 

Thanks,

<apex:outputField value="{!sellead.Company}" ><apex:inlineEditSupport event="ondblClick" 
            showOnEdit="saveButton,cancelButton"  ></apex:inlineEditSupport> </apex:outputField> 

 
I need to write a script to trigger the sync for all records for all the tables being sync over to some other database say My SQL database.
This class will query all accounts, contacts, Opportunities, User, and so on… all the objects that we sync from SFDC to MySQL.
For this, I just need to query in batch mode, update the name or some other column that would trigger all outbound messages and then update the records back to original state.

I have a sample class below which edits all contacts with a specific extension.
But How I can I modify it to edit records for all objects So that it trigers my all outbound messages
and then update the records back to original state.

global class BatchUpdateDataSync implements Database.Batchable<Sobject> {
  global final List<Account> accLst=new List<Account>();
  global final List<Contact> conLst=new List<Contact>();
  global final String value;
  global BatchUpdateDataSync(string sandbox) {
    value = sandbox;
  }
  global Database.QueryLocator start(Database.BatchableContext BC) {
// query for contacts only How I can pass query for all other objects ?
    return Database.getQueryLocator([Select c.Id,c.Email from Contact c]);
  }
  global void execute(Database.BatchableContext BC, List<Contact> records) {
    for(Contact con:records){
     if(con.Email!=Null){
      con.Email=con.Email+'.'+value;
         conLst.add(con);
     }   
    }
    if(conLst.size()>0) update conLst;
// Where I need to write code to revert changes ?
  }
  global void finish(Database.BatchableContext BC) {
  }
}
Hi,

I need to check the "Assign using active assignment rule" check box field & change status to 'open' at Lead update But getting error "System.LimitException: Too many SOQL queries: 101"
Please suggest,

Thanks,

The code is below


trigger AssignLeadFromTimeOutQ on Lead (after update) {

    List<Lead> ls = new List<Lead>();
    Lead tempLead = Trigger.new[0];
        if (tempLead.OwnerId == '00P40000001l62pEAA' && UserInfo.getUserId() == '00570000001PNMtAAO') {
            ls.add(new Lead(id = tempLead.id, status = 'Open'));
            Database.DMLOptions dmo = new Database.DMLOptions();
            dmo.assignmentRuleHeader.useDefaultRule = true;         
            Database.update(ls, dmo);   
          }
}
List<Asset> lst=  [select Id, ProductCode, Product_Family1__c, Product_Family__c from Asset WHERE AccountId = '0015000000IBGof' AND ( (NOT IB_Status__c Like '%eval%') OR (NOT IB_Status__c Like '%Under Right of Return%') OR (NOT IB_Status__c Like '%Sold - Demo%') OR (NOT IB_Status__c Like '%WRITTEN OFF%') ) AND Product_Family__c != 'Whitewater'];

I am getting below error
No such column 'ProductCode' on entity 'Asset'. 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.

Also I need to use group by (Product_Family1__c, Product_Family__c) this query But getting error
<td align="center"  style="font-weight: bold;color:Red;"><a href="{!URLFOR($Action.Attachment.delete, a.Id)}">Delete</a></td>

I am getting Error: Field $Action.Attachment.delete does not exist. Check spelling
Please suggest, How can I delete
I useing below code for controller & VF. But error does`t display on VF.

Controller:-

public PageReference Saveod(){  
        for(Opportunity_Development__c od:odList)   {
             if(od.Account_Plan__c == null)
            od.Account_Plan__c=ap.id;
        }
        try
        {
            pagereference p = apexpages.Currentpage();
            upsert odList;
        }
        catch (Exception e)
        {
            System.debug('AccountPlanningExtensionSaveod() Exception ===> '+e);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please use Save button at the top of the page to save header information.'));
//          ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please use Save button at the top of the page to save header information.');
//            ApexPages.addMessage(msg);
//            return p;
        }




VF:-


<apex:page standardController="Account_Plan__c" extensions="AccountPlanningExtension" standardStylesheets="true">
<apex:pageMessages />
 
I am useing below VF code. When I change a value of field 'company' & click once outside of the text field & then press save button the value
gets saved. But it does`t save If I dirrectly click on save button after changing a value in text field
Please suggest . . . 

Thanks,

<apex:outputField value="{!sellead.Company}" ><apex:inlineEditSupport event="ondblClick" 
            showOnEdit="saveButton,cancelButton"  ></apex:inlineEditSupport> </apex:outputField>