• Fahad Khan 2
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I have a custom object and using dataloader records get loaded. on create i have a trigger that does some processing and creates/update product2 records. Most of the times trigger runs successfully but sometimes i get the following error:
RawAircraftTrigger: execution of AfterInsert

caused by: System.UnexpectedException: common.exception.SfdcSqlException: Invalid column index

Class.RawAircraftsTriggerHandler.loadCrafts: line 58, column 1
Trigger.RawAircraftTrigger: line 3, column 1

My line 58 starts as follows
for(Account a : [Select id, Name, Account_Name_2__c from Account where Name in :accountKeys OR
                         Account_Name_2__c in :accountKeys])
{
    existingaccounts.put(a.Name, a);
    existingaccounts.put(a.Account_Name_2__c, a);
}

I am clueless what could be the main issue here.
I have an apex rest webservice and it has query where it takes around 30 to 40 seconds to execute. query is as follows and debug logs are attached. Funny and frustrating thing is for the first time when i call that WS it takes 30 to 40 seconds but if i try to call the same again it takes no time to execute. and if i wait like 1.5 to 2 hours and try again to execute that call it again takes 30 to 40 seconds. I am not sure if oracle keeps compiled queries or what. please help. Thanks in advance

SOQL: [Select  ActivityDateTime, subject
                                    From Event
                                    Where ActivityDateTime > :now and 
                                    isChild = false and
                                    (/*Subject Like '%handover%' OR*/ Subject Like '%survey appt%' OR
                                     /*   Subject Like '%remeasure%' OR Subject Like '%spot check%' OR*/
                                        Subject Like '%misc appt%' OR
                                        Subject Like '%showroom visit%' OR Subject Like '%general appt%' ) and
                                    ActivityDateTime <= NEXT_N_DAYS:14 ]


Debug logs both executions:
User-added image

 
I haven't published any app yet, and i am working on one. I have connected app set up for Oauth authentication. I have to use ajax to make some calls form external server to salesforce, and i had to set up whitelist under CORS configurations. while ultimately publishing the app to appexhange, would the CORS setting go along as the part of app ? other wise i am in big trouble
I have a custom object and using dataloader records get loaded. on create i have a trigger that does some processing and creates/update product2 records. Most of the times trigger runs successfully but sometimes i get the following error:
RawAircraftTrigger: execution of AfterInsert

caused by: System.UnexpectedException: common.exception.SfdcSqlException: Invalid column index

Class.RawAircraftsTriggerHandler.loadCrafts: line 58, column 1
Trigger.RawAircraftTrigger: line 3, column 1

My line 58 starts as follows
for(Account a : [Select id, Name, Account_Name_2__c from Account where Name in :accountKeys OR
                         Account_Name_2__c in :accountKeys])
{
    existingaccounts.put(a.Name, a);
    existingaccounts.put(a.Account_Name_2__c, a);
}

I am clueless what could be the main issue here.
This is a bit of breif bit of code:

controller:
<pre>

public List<String> partTypes = new List<String>{'Accessories', 'Electronics', 'Fishing', 'Fun and Entertainment', 'Graphics and Decals', 'Pontoon Covers', 'Safety', 'Seating', 'Trailering and Covers'};

 public Map<String, List<Product2>> availablePartOptions{ get; set;}
.
.
.
List<Product2> boatOptions = [SELECT Id, Name, RecordType.Name, Family,
                                                        (SELECT Id, Name, UnitPrice, Pricebook2Id
                                                          FROM PricebookEntries WHERE Pricebook2Id = :pb2Id),
                                                        (SELECT Id, Standard__c, Maximum__c FROM From_Product_Options__r)
                                                        FROM Product2
                                                        WHERE Id IN :ids];

availablePartOptions = new Map<String,List<Product2>>();
for(String partName : partTypes) {
   availablePartOptions.put( partName, new List<Product2>() );
 }

for(Product2 opt: boatOptions() ) {
  if(opt.RecordType.Name == 'Part'){
    availablePartOptions.get(opt.Family).add(opt);
  }
}

</pre>

Visualforce test:

<pre>

<ul>
    <apex:repeat value="{!availablePartOptions}" var="key">
        <li>
              <apex:outputText value="{!key}" /> -
               <apex:outputText value="{!availablePartOptions[key].size}" />
        </li>
    </apex:repeat>
</ul>

</pre>

This all results in:

Incorrect parameter type for subscript. Expected Number, received Text
Error is in expression '{!availablePartOptions[key].size}' in component <apex:outputText> in page boatbuilder

If I omit the offending line I get a ugly but valid list of keys which is the same as my partTypes List

Accessories -
Electronics -
Fishing -
Fun and Entertainment -
Graphics and Decals -
Pontoon Covers -
Safety -
Seating -
Trailering and Covers -

This is the method every doc I have read said to use when dealing with maps in visualforce.
If anyone has any Ideas it would be a tremendous help


Hi All,

 

I am new to Saleforce development. Please can any one guide me to sample apex code to create(add) custom fields to custom or standard objects dynamically using Salesforce Metadata API in my development org.

 

Thanks in advance.

  • June 29, 2011
  • Like
  • 0