• Colin Kenworthy
  • NEWBIE
  • 90 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 27
    Replies
I'm not a dev but getting this error when I try to mass update opps 

AcountUtilityTrigger: System.LimitException: Too many SOQL queries: 101

We installed an app called ContractPod could that of caused this?

I turned off all opp flows and rules and we still get this error. 

As an Admin , what can I do?
I am new to Salesforce and come from a reporting / SQL background and perspective. I started to look at how to write SQL (SOQL) in Salesforce.

This link answered my question exactly - it's painful. So that gave me the quick answer, and a headache as well.

On this link it describes a limitation of Salesforce in regards to SQL:
SOQL doesn’t support all advanced features of the SQL SELECT command. For example, you can’t use SOQL to perform arbitrary join operations, use wildcards in field lists, or use calculation expressions.

So my specific question is now, what does it mean "you can't use SOQL to perform arbitrary join operations"? Is this the same as simply saying "You can't do join operations"? What exactly is the adjective "arbitray" trying to convey.

And per the first link of the guy who was "OMG how do I write a normal SQL statement in Salesforce?", any suggestions on how to get started? I do have the Trailheads, and I see SOQL modules in "Apex Basics & Database", but do you have any tips on getting started.

My perspective is Oracle SQL and BusinessObjects for your traditional reporting.

Also, I think this is my first post, I don't see any Category for "Reporting", "Einstein", etc. So I put it in 
 
I have made a lightning component (that uses the lightning:tree) that works fine when I place it in the lightning page layout, however when I place it in a legacy VF page (the VF page is a tab on the record detail page) using Lightning Out the down/right chevrons do not render.  Then if I place my component on a VF page inside an apex : tabPanel the component does not render at all.

Is there still ongoing work in the Lightning dev team to integrate Lightning and Visualforce together?  Perhaps the lightning:tree component itself has a few bugs?
I've been working on this superbadge, near the end I got to this part:

Ada also tells you that the SolarBot Status Averages report needs some tweaks. First, the Support team wants to see trends over time, so they want the report to show data by week instead of by day. Second, they want a graph for this report called Weekly Panel Temperature and kWh that shows average panel temperature and average kilowatt hours as lines over time. Third, they want to see this graph on each SolarBot record page. Create the page and call it SolarBot Status Page With Chart. Include only information about the individual SolarBot in the chart.


What kind of page should I go for? I created a Lightning Record Page, a page layout, and it is not detecting any kind of page
Thanks in advance
I am new to test classes. My Test class is giving only 36% coverage.What else i  can check in my test class

Test class:

@isTest
public class ITOVC_TargetMasterGovernanceClassTest {
    @TestSetup
    static void setup(){
        ITOVC_Target__c target1 = new ITOVC_Target__c(Name='TG01',Start_Date__c=Datetime.newInstance(2018, 01, 01), End_Date__c=Datetime.newInstance(2018, 01, 31),Target_Value__c=1);
        insert target1;
    }
  @isTest  static void testDuplicateRecordsForSameStartEndDate(){
        ITOVC_Target__c target2 = new ITOVC_Target__c(Name='TG01',Start_Date__c=Datetime.newInstance(2018, 01, 01), End_Date__c=Datetime.newInstance(2018, 01, 31),Target_Value__c=1);
        try {
           insert target2;
       } catch (Exception e) { 
           System.debug('An error happened, as predicted!');
       }
    }
}
apex class:

public class ITOVC_TargetMasterGovernanceClass {
    public void DuplicateRecordsForSameStartEndDate(List<ITOVC_Target__c> newTgId){
        List<ITOVC_Target__c> TgList = ([Select Name,Target_Value__c,Start_date__c,End_date__c from ITOVC_Target__c limit 10000]);
        for(ITOVC_Target__c tg : TgList){
            system.debug('ITOVC_Target__c tg :  ' + tg);
            for(ITOVC_Target__c newTg : newTgId ){
                system.debug('ITOVC_Target__c newtg :  ' + newtg);
                if(tg.Start_Date__c !=Null || tg.End_Date__c !=Null){
                    if( 
                        ((newTg.End_Date__c >= tg.Start_Date__c && newTg.End_Date__c <= tg.End_Date__c) ||
                        (newTg.Start_Date__c >= tg.Start_Date__c && newTg.End_Date__c <= tg.End_Date__c)||
                        (newTg.Start_Date__c >= tg.Start_Date__c && newTg.Start_Date__c <= tg.End_Date__c)||
                        (newTg.Start_Date__c < tg.Start_Date__c && newTg.End_Date__c > tg.End_Date__c))&&
                        (newTg.Name >= tg.Name)&&
                              (newTg.Target_Value__c >= tg.Target_Value__c)
                      ){

                              newTg.addError('Start date and End date are getting overlapped with existing records.');

                       }
                 }
            }
     }
    }
    public void recordsCantBeDeleted(List<ITOVC_Target__c> oldTgId){

        for(ITOVC_Target__c TgDel : oldTgId){

            TgDel.addError('You can\'t delete master target record');
        }
    }
}
apex trigger:

trigger ITOVC_TargetMasterGovernanceTrigger on ITOVC_Target__c (before insert,before update, before delete) {
     ITOVC_TargetMasterGovernanceClass thClass = new ITOVC_TargetMasterGovernanceClass();
    if(trigger.isInsert || Trigger.isUpdate){
        system.debug('Trigger.new contains :   '+Trigger.new);
        thClass.DuplicateRecordsForSameStartEndDate(Trigger.new);
    }
   if(Trigger.isDelete)
    {
        thClass.recordsCantBeDeleted(Trigger.old);
        system.debug('Trigger.old contains :   '+Trigger.old);
    }

}
 
I can see this has been asked a lot, but the answers given aren't helping me change my code to work, so I am really hoping someone can do it for me?

Code below, I just need the background being white. Thanks you!
 
<apex:page standardController="Group_Relationship__c" >
<head>
<style>

tr {
    display: block;
    border-bottom: 1px solid #e6e6e6;
}
td {
    padding-left: 40px;
}
table{
    min-width: 1350px;
    }
</style>
</head>


<apex:form >
<table width="100%"> 
  <tr>
    <td style="width:10%"><apex:image id="ManheimRemarketingBuyer" value="{!If(Group_Relationship__c.Group_Name__r.Group_Buyer_RMA_Count_Form__c >0, $Resource.Remarketing_Buyer_Colour, $Resource.Remarketing_Buyer_BW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853142000/VolumeBoughtYTDPrevYear2" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Group_Buyer_RMA_Count_Form__c >0, '#004489', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Remarketing_Buyer_Volume_Group_Join__c}" /></apex:outputLabel></td>
    
    <td style="width:10%"><apex:image id="DealerAuction" value="{!If(Group_Relationship__c.Group_Name__r.Dealer_Auction_Volume_Group_Form__c >0, $Resource.DealerAuctionImage, $Resource.DealerAuctionImageBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853196000/VolumeSoldYTDPrevYear" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Dealer_Auction_Volume_Group_Form__c >0, '#25488e', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Dealer_Auction_Volume_Group_Form__c}" /></apex:outputLabel></td>
  </tr>
  <tr>
    <td style="width:10%"><apex:image id="ManheimRemarketingVendor" value="{!If(Group_Relationship__c.Group_Name__r.Group_Vendor_RMA_Count_Form__c >0, $Resource.Remarketing_Vendor_Colour, $Resource.Remarketing_Vendor_BW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853196000/VolumeSoldYTDPrevYear2" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Group_Vendor_RMA_Count_Form__c >0, '#004489', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Remarketing_Vendor_Volume_Group_Join__c}" /></apex:outputLabel></td>
    
    <td style="width:10%"><apex:image id="Motors" value="{!If(Group_Relationship__c.Group_Name__r.Motors_co_uk_Accounts_Group_Form__c >0, $Resource.MotorsImage, $Resource.MotorsImageBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853893000/RevenueRolling12" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Motors_co_uk_Accounts_Group_Form__c >0, '#3BB97C', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Motors_co_uk_Revenue_Group_Form__c}" /></apex:outputLabel></td>
  </tr>
  <tr>
    <td style="width:10%"><apex:image id="Modix" value="{!If(Group_Relationship__c.Group_Name__r.Modix_Accounts_Group_Form__c >0, $Resource.ModixImage, $Resource.ModixImageBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853893000/RevenueRolling12" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Modix_Accounts_Group_Form__c >0, '#FD4F00 ', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Modix_Revenue_Group_Form__c}" /></apex:outputLabel></td>
    
    <td style="width:10%"><apex:image id="NextGear" value="{!If(Group_Relationship__c.Group_Name__r.Next_Gear_Accounts_Group_Form__c = 'Live', $Resource.NextGearImage, $Resource.NextGearImageBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853383000/StatusPaint" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Next_Gear_Accounts_Group_Form__c = 'Live', '#25488e', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Next_Gear_Accounts_Group_Form__c}" /></apex:outputLabel></td>
  </tr>
  <tr>
    <td style="width:10%"><apex:image id="Closit" value="{!If(Group_Relationship__c.Group_Name__r.Lead_Management_Accounts_Group_Form__c >0, $Resource.IncadeaSalesColour, $Resource.IncadeaSalesBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853893000/RevenueRolling12" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Lead_Management_Accounts_Group_Form__c >0, '#FFA000', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Lead_Management_Revenue_Group_Form__c}" /></apex:outputLabel></td>
    
    <td style="width:10%"><apex:image id="RMS" value="{!If(Group_Relationship__c.Group_Name__r.RMS_Accounts_Group_Form__c = 'Live', $Resource.RMSImage, $Resource.RMSImageBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853196000/VolumeSoldYTDPrevYear2" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.RMS_Accounts_Group_Form__c = 'Live', '#205EAA', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.RMS_Volume_Sold_Group_Join__c}" /></apex:outputLabel></td>
  </tr>
  <tr>
    <td style="width:10%"><apex:image id="Xtime" value="{!If(Group_Relationship__c.Group_Name__r.XTime_Accounts_Group_Form__c >0, $Resource.IncadeaServiceColour, $Resource.IncadeaServiceBW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853893000/RevenueRolling12" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.XTime_Accounts_Group_Form__c >0, '#FFA000', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.XTime_Revenue_Group_Form__c}" /></apex:outputLabel></td>
    
    <td style="width:10%"><apex:image id="Movex" value="{!If(Group_Relationship__c.Group_Name__r.Movex_Accounts_Group_Form__c = 'Live', $Resource.Movex_Colour, $Resource.Movex_BW)}" width="200" height="80"/></td>
    <td style="width:10%"><apex:image url="https://c.eu10.visual.force.com/resource/1513853383000/StatusPaint" width="175" height="70"/></td>
    <td style="width:20%"><apex:outputLabel style="vertical-align:top; text-align:center;font-family:calibri;font-size:35px;color:{!IF(Group_Relationship__c.Group_Name__r.Movex_Accounts_Group_Form__c = 'Live', '#0076A6', '#d9d9d9')};"><apex:outputField label="AccNAme" value="{!Group_Relationship__c.Group_Name__r.Movex_Accounts_Group_Form__c}" /></apex:outputLabel></td>
  </tr>
</table>






</apex:form>
</apex:page>

 

Hi all,
I'm having a hard time running an Apex Test for a trigger that I'm trying to use.
The trigger basically matches the External ID of a Custom Object with the same External ID from Contract ID, to bring me the Account ID in the Custom Object.

What Test needs to do is test this trigger, so I can put it into production. But is giving me the following error:
System.DmlException: Insert failed. First exception on row 0; first error: FAILED_ACTIVATION, Choose a valid contract status and save your changes. Ask your admin for details.: [Status]
Class.UpdateAccountId2.testWithExistingAccount: line 31, column 1

The trigger and the Test are the following:
/** # New Version of nKPI Trigger **/
trigger UpdateAccountId2 on nKPI__c (before update, before insert) {

    Map<String, nKPI__c> tintgreMap = new Map<String, nKPI__c>();
    
    for(nKPI__c ti : trigger.new) {
        
        if(trigger.isInsert || (trigger.isUpdate && ti.RDStationID__c != trigger.oldMap.get(ti.Id).rdstationid__c)) {
            tintgreMap.put(ti.rdstationid__c, ti);
        }
    }

    if(tintgreMap == null) return;
    
    Map<String, Contract> accountMap = new Map<String, Contract>();
    for (Contract account : [Select AccountId,externalCode__c FROM Contract WHERE Product_Group__c = 'RD Station' AND externalCode__c = :tintgreMap.KeySet()]) {
        accountMap.put(account.externalCode__c, account);
    }
    
    if(accountMap == null) return;
    
    for(nKPI__c tiRecord : tintgreMap.Values()) {
        
        tiRecord.Account__c = accountMap.get(tiRecord.rdstationid__c).AccountId;
        
    }

}
--------------------------------------------------- TEST

@isTest(OnInstall=true)
private class UpdateAccountId2 {

    public static List<Contract> contractsList;
    public static List<nKPI__c> kpiList;
    public static String rdstation_id_account1;

    static void init(){
    contractsList = new List<Contract>();
    kpiList = new List<nKPI__c>();

    rdstation_id_account1 = '100';

    kpiList.add(new nKPI__c(
                    rdstationid__c = rdstation_id_account1
    ));
    }

    /** Test with an existing account **/
    static testMethod void testWithExistingAccount() {
    init();
    Test.startTest();

    contractsList.add(new Contract(
        Name = 'Test',
        internalid__c = '1000001',
        Status = '0 - Trial',
        externalCode__c = rdstation_id_account1
    ));
    insert contractsList;
    insert kpiList;
    
    kpiList = [
        SELECT Id, Account__c
        FROM nKPI__c
        WHERE Id = :kpiList[0].Id
    ];

    // Verification
    System.assertEquals(kpiList[0].Account__c, contractsList[0].Id);
    Test.stopTest();
    }
}

Anyone could identify what the error could be? I'm a beginner on this apex things.
Thanks.
 
I'm not a dev but getting this error when I try to mass update opps 

AcountUtilityTrigger: System.LimitException: Too many SOQL queries: 101

We installed an app called ContractPod could that of caused this?

I turned off all opp flows and rules and we still get this error. 

As an Admin , what can I do?
I am new to Salesforce and come from a reporting / SQL background and perspective. I started to look at how to write SQL (SOQL) in Salesforce.

This link answered my question exactly - it's painful. So that gave me the quick answer, and a headache as well.

On this link it describes a limitation of Salesforce in regards to SQL:
SOQL doesn’t support all advanced features of the SQL SELECT command. For example, you can’t use SOQL to perform arbitrary join operations, use wildcards in field lists, or use calculation expressions.

So my specific question is now, what does it mean "you can't use SOQL to perform arbitrary join operations"? Is this the same as simply saying "You can't do join operations"? What exactly is the adjective "arbitray" trying to convey.

And per the first link of the guy who was "OMG how do I write a normal SQL statement in Salesforce?", any suggestions on how to get started? I do have the Trailheads, and I see SOQL modules in "Apex Basics & Database", but do you have any tips on getting started.

My perspective is Oracle SQL and BusinessObjects for your traditional reporting.

Also, I think this is my first post, I don't see any Category for "Reporting", "Einstein", etc. So I put it in 
 
Hi,

I am not able to update the contact details for existing account in Lead Conversion. Kindly help in this issue.

This is the code i am using.

Public class AutoConvertLeads
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
        LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 1];
        List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();
        for(id currentlead: LeadIds){
                Database.LeadConvert Leadconvert = new Database.LeadConvert();
                Leadconvert.setLeadId(currentlead);                
                Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
                Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion 
                MassLeadconvert.add(Leadconvert);
        }
        
        if (!MassLeadconvert.isEmpty()) {
            List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
        }
    }
}
I want to write a trigger so that once a status of my object changed from high to low priority field shoud be updated by Null and all the records which has peiority greater than the current record should be decreased by 1. 

Hi Pals,

 

Is it possible to parse/process file uploaded( for e.g. a .csv file) in apex and and fetch records? From what I know, when a file is uploaded from suppose a VF page, we will receive a Blob of that file. But there is no mechanism as such to parse that Blob and see what data is exactly is inside it. I know this I/O processing can be easily done in .Net/Java. But usually a .Net/Java solutions is not what a customer expects because of the extra hosting/costing/whatever the other reasons. So, I want to know if this possible in Apex at all ? I searched boards and also IdeaExchange but did not find any confident answer. Any help is very much appreciated.

 

Thanks

Vishnu

I need to export a report as a CSV to an FTP site or email it on a daily or weekly basis.

 

I have a Report.  I need to get the report out of Salesforce somehow into CSV format.

 

Ideally, this would be scheduled.


I'm a developer so I can do developer stuff.  However, I don't know APEX and I don't know VisualForce.  I can get someone to do that stuff if we need to.


Thanks!

  • July 26, 2011
  • Like
  • 2

Hello All,

I am planning to integrate Salesforce to an email management system(EMS). I wanted to create the case with in salesforce for any email received into EMS or any outbound email. What would be the recommended approach to do this integration? Is there any REST/SOAP API available to create a case in SalesForce? Is there any other method to do this integration?

I am wrting the test method for trigger OnLeadConvert . How can i convert "Lead" in Test Method ?

  • February 19, 2011
  • Like
  • 0

Hello All,

             I'd like to know if there are any "Governing Limits" when we use the enterprise WSDL to access our org's data. Please clarify. Thanks all.

  • March 17, 2009
  • Like
  • 0