• -1 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 12
I've inherited a Sales Cloud org, that until recently had the following trigger working. Now the Original Total Cost is no longer populated at the trigger points.
However the Error at deletion is still being sucessfuly fired.
trigger OLITrigger on OpportunityLineItem (before insert, before update, before delete) {
 //Code block to enable bypassing of triggers using field off users record  
    String currentUserId = UserInfo.getUserId();
    User currentUser = [SELECT Bypass_Triggers__c FROM User WHERE Id = :currentUserId LIMIT 1];
    if (currentUser.Bypass_Triggers__c) return;
      For(OpportunityLineItem oli: Trigger.New){
        oli.Original_Total_Cost__c = oli.TotalPrice;

       For(OpportunityLineItem oli : [SELECT TotalPrice,Original_Total_Cost__c,Opportunity.StageName FROM OpportunityLineItem Where Id IN: Trigger.New]){
      if(oli.Opportunity.StageName == 'Closed Won')
         //Do Nothing
      else  if(Trigger.oldmap.get(oli.id).TotalPrice == Trigger.newmap.get(oli.id).TotalPrice)
               // Do nothing  
     else if(Trigger.oldmap.get(oli.id).TotalPrice != Trigger.newmap.get(oli.id).TotalPrice)
          oli.Original_Total_Cost__c = Trigger.oldmap.get(oli.id).TotalPrice;
  If(System.Trigger.isBefore &&System.Trigger.isDelete){
  For(OpportunityLineItem oli : Trigger.old)
        if(oli.number_of_invoice_lines__c == 0 || oli.number_of_invoice_lines__c == null){

        list<Line_Item_Details__c> LineItemDetailsId=[Select Id FROM Line_Item_Details__c Where id =:oli.Line_Item_Details__c];     
        delete LineItemDetailsId;
        else if(oli.number_of_invoice_lines__c >= 1) 
            oli.addError('You can not delete this Product as it has Invoiced Schedules');



I am working with a developer on a button that pushes several demographic fields from the account object in Salesforce to an external system through API. The form where users will be filling out field values and pressing update is built within a lightning component. It was tested in a sandbox org. and was working, but since it has been pushed into production, the button is no longer worker for any user other than the developer who created the component and pushed it into SF. 

When any user but the developer tries to update the fields and push it into the external system, the push (from the backend where the developer is checking) shows no values (i.e. it is reading the fields as null even though users are putting in updated values) and therefore, nothing is being updated in the external system. I tried to see if there were any differences in permissions between the developer's user account and the other accounts we have been testing with, but have not found any. If anything, the other user accounts we are testing with have more permissions/access within the produciton SF org. than the developer's user account. Additionally, the developer has confirmed that nothing on the component's code has changed since the testing done in the sandbox.

I am wondering if any of you have any suggestions or insight on where I may look to try and troubleshoot this error? Is there any obvious reason why the push is only working for the developer and no other user? Why would the fields being pushed be showing null even when users are filling them in with updated values?

Thanks in advance for any and all help/insight.

My requirement is to display Account and its related contacts using accordion and accordion section.

I am able to display account and when I expand account it will show Rating and Phone but Under each account I want a separate accordion to show contact firstname and contact lastname.

Here's my code
public with sharing class MyController {

    public static List<Account> showAccountsForAccordion()
        List<Account> accList = [select Id,Name,Rating,Phone,(select firstname,lastname from contacts)
                                 Order By name LIMIT 4];
        return accList;

<aura:component implements="flexipage:availableForAllPageTypes" 
                access="global" >
    <aura:attribute name="accnList"
    <aura:handler name="init"
    <div class="demo-only slds-grid" style="height: 150px; width: 300px; padding: 2rem;">
    <div class="slds-is-fixed">
    <div style="position: absolute; top: 1rem; left: 1rem; border: 1px solid red; background: rgb(244, 246, 249);">
          <aura:iteration items="{!v.accnList}" 
              <lightning:accordionSection name="{!acc.Name}" 
                   <aura:set attribute="body">
                        <p>Rating : {!acc.Rating}</p>
                        <p>Phone : {!acc.Phone}</p>
              <aura:iteration items="{!v.accnList.contacts}" 
                  <lightning:accordionSection name="{!con.Name}" 
                   <aura:set attribute="body">
                        <p>FirstName : {!con.FirstName}</p>
                        <p>LastNamePhone : {!con.LastName}</p>

	doInit : function(component, event, helper) {
        var action=component.get('c.showAccountsForAccordion');
            var state = response.getState();
            console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.accnList", response.getReturnValue());

Please tell me how to achieve this.

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
Error is in expression '{!genDoc2}' in component <apex:commandButton> in page doccontrolgather: Class.DocControlQuery.SavePDF: line 203, column 1
Class.DocControlQuery.genDoc2: line 120, column 1

I need help with this apex code.  I am not a coder :-S


I am working in enterprise edition. As winter 14 changed... i am unable to see the option reset security token . In devoloper edition it is visible. So from Enterprise edition i am unable to find.

  • December 16, 2013
  • Like
  • 2



Is there a guide for adding 3rd party phonegap/cardova plugins to exisiting hybrid projects created using frocedroid create or forceios commands ??