• Dev87
  • NEWBIE
  • 40 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 43
    Questions
  • 15
    Replies
Hello, 

I have to query 2 objects in the same time (not parent child requet between objects)
Object 1 may have 0 to many Object2
Object 2 may have one and only object 1

I try this query: 
     Select id, name,(Select id,Total_Parcels_Forecast__c,Stage__c, Total_Revenues_Forecast__c, Domestic_Parcels_Forecast__c,Domestic_Revenues_Forecast__r,International_Parcels_Forecast__c from Tender_BU_Response__c) From Opportunity 

I have this error: 
Didn't understand relationship 'Tender_BU_Response__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
 
Hello, 

I have this apex class:
public without sharing class Opp_CalculTotalForcast {

    public static void TotalForcast (List <Opportunity> oppList)
    {
        system.debug('debut: ' +oppList);  
        integer i;
        Decimal TotalForcastparc =0;
        Decimal TotalForcastcurrency = 0;
        Decimal TotalForcastDomPorc = 0;
        Decimal TotalForcastDomcurrency = 0;
        Decimal TotalForcastIntparc = 0;
        Decimal TotalForcastIntcurrency = 0;
        Integer Nb_BUs_participating = 1;
                
        list<Tender_BU_Response__c> allBUList = new list<Tender_BU_Response__c>();
        list<Opportunity> Opp = new list<Opportunity>();
       
        for(Opportunity o:oppList ){
          Id  Id= o.id;
         system.debug('idopp : ' +Id);  
            allBUList = [Select id,BU_Name__c,Total_Parcels_Forecast__c,Stage__c, Total_Revenues_Forecast__c, Domestic_Parcels_Forecast__c,Domestic_Revenues_Forecast__c,International_Parcels_Forecast__c,International_Revenues_Forecast__c    from Tender_BU_Response__c where Tender__c =:  Id];
                    system.debug('allBUList : ' +allBUList);  

            if (allBUList.size()>0)
           {
            for (i=0; i < allBUList.size(); i++)
             { 
               if (allBUList[i].Total_Parcels_Forecast__c != NULL)
               { TotalForcastparc = TotalForcastparc +allBUList[i].Total_Parcels_Forecast__c;}                             
               if (allBUList[i].Total_Revenues_Forecast__c != NULL)    
               {TotalForcastcurrency = TotalForcastcurrency +  allBUList[i].Total_Revenues_Forecast__c;}    
               if (allBUList[i].Domestic_Parcels_Forecast__c != NULL)
               {TotalForcastDomPorc = TotalForcastDomPorc +  allBUList[i].Domestic_Parcels_Forecast__c;} 
               if (allBUList[i].Domestic_Revenues_Forecast__c != NULL)
               {TotalForcastDomcurrency = TotalForcastDomcurrency + allBUList[i].Domestic_Revenues_Forecast__c;}
               if (allBUList[i].International_Parcels_Forecast__c != NULL)
               { TotalForcastIntparc = TotalForcastIntparc + allBUList[i].International_Parcels_Forecast__c;}
               if (allBUList[i].International_Revenues_Forecast__c != NULL)
               {TotalForcastIntcurrency = TotalForcastIntcurrency + allBUList[i].International_Revenues_Forecast__c;}
                
                 {Nb_BUs_participating = Nb_BUs_participating+i;}    
              }
               system.debug('TotalForcast: ' +TotalForcastparc);
           }
            Opp = [Select id,Parcels_Forecasted__c,Amount, Total_Forecast_Domestic_Parcels__c, Total_Forecast_Domestic__c,Total_Forecast_International_Parcels__c,Total_Foreast_International__c from Opportunity  where id =:  o.Id];
            system.debug('opp: ' +Opp);
    if (Opp.size()>0)
    {
          for (Opportunity Opport: Opp) 
          {
              system.debug('ok:' );
            Opport.Amount    = TotalForcastcurrency;
            Opport.Parcels_Forecasted__c    = TotalForcastparc;
            Opport.Total_Forecast_Domestic_Parcels__c = TotalForcastDomPorc;
            Opport.Total_Forecast_Domestic__c  = TotalForcastDomcurrency;
            Opport.Total_Forecast_International_Parcels__c =TotalForcastIntparc;  
            Opport.Total_Foreast_International__c  =  TotalForcastIntcurrency;
            Opport.Nb_BUs_participating__c =   Nb_BUs_participating;
            upsert (Opport);
             }  
    }
         }
        
    }
    
    
}


I created test class

@isTest
public class Opp_CalculTotalForcast_Test {
    
@isTest
static void Opp_CalculTotalForcast_Test()
    {
        //Profil admin pour lancer le trigger
        
        Profile p = [select id from profile where Name='System Administrator' limit 1];   
        
        User u = new User(alias = 'test3', email='testemail@gmail.com', emailencodingkey='ISO-8859-1', lastname='Testing', languagelocalekey='fr',   
        localesidkey='fr_FR_EURO', profileid = p.Id, timezonesidkey='Europe/Paris', username='test1834'+String.valueOf(date.today())+'@csc.com');   
        insert u;
          system.runAs(u){
        //debut test    
     system.test.startTest();
     DateTime myDateTime = DateTime.newInstance(2014, 12, 16, 12, 6, 13);
     Date myDate = myDateTime.date();
     Id RecordTypeIdBUtypeAccount = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Account').getRecordTypeId();
        //Create new account  
     Account acc = new Account (Name = 'testdeaicha23', recordTypeId = RecordTypeIdBUtypeAccount);
     insert acc;
      Account acc1 = new Account (Name = 'testdeaicha2', recordTypeId = RecordTypeIdBUtypeAccount);
     insert acc1;
    
      //create new opportunity      
     Opportunity opp = new Opportunity (AccountId = acc.id, Name = 'opptestaicha', StageName = '0. Pre-Alert', CloseDate = myDate);
     opp.Date_Received__c=Date.today();
     opp.Deadline_to_respond__c=Date.today();
     insert opp;    
              // create new BU Response attached to Opportunity
     Tender_BU_Response__c  BURespons = new Tender_BU_Response__c (Tier__c = acc.id,Tender__c=opp.id,  Name= 'BUtestaicha1', Domestic_New_Business_Parcels__c= 100, Domestic_Revenues_Forecast__c= 200, International_Parcels_Forecast__c    = 400, International_Revenues_Forecast__c= 350 );
     insert BURespons;
       update opp;

        system.test.stopTest();
          }
    }
}

But covrage is 64%, can someone help me
Hello, I have a table in my visualforce page and I need to sort on some column like this:
    <apex:column >                                                                                            
                        <apex:facet name="header" >
                            <apex:commandLink action="{!empty}">
                              <apex:outputText value="Type d'inscription" />
                              <apex:outputText escape="false" rendered="{!sortBy=='Type d\'inscription'&&sortDir=='ASC'}">
                                <img src="/s.gif" alt="Sorted Ascending" class="sortAsc" title="Sorted Ascending" />
                              </apex:outputText>
                              <apex:outputText escape="false" rendered="{!sortBy=='Type d\'inscription'&&sortDir=='DESC'}">
                                <img src="/s.gif" alt="Sorted Descending" class="sortDesc" title="Sorted Descending" />
                              </apex:outputText>
                              <apex:param value="Type d'inscription" name="column" assignTo="{!sortBy}" />
                              <apex:param value="{!IF(sortDir=='ASC'&&sortBy=='Type d\'inscription', 'DESC', 'ASC')}" name="direction" assignTo="{!sortDir}" />
                            </apex:commandLink>
                        </apex:facet>                        
                        <apex:outputText value="{!cmber.campMember.Type_d_inscription__c}" rendered="{!cmber.campMember.Type_d_inscription__c != null}"/>
             <apex:outputText value="-" rendered="{!cmber.campMember.Type_d_inscription__c == null}"/>                        
                    </apex:column>

When I try to sort, the number of columns decreases( juste 3 lines appears from 10 lines)
Can u help me
Hello, 
I have to convert lead to many opportunities (based on multiselect list Country) - creating as many opportunities as selected countries.
When converting a lead, there is always one more opportunity that is created (the standard opportunity).
How can I eliminate the creation of this opportunity?
Thanks
 
Good Morning, 

In my lightning page , I want to enter a percentage and update the line in the database.
When I insert for exemple 5.99 I have this error in my log:

User-added image

<div class="slds-col slds-size--1-of-8 slds-m-left_small">
                                <span><lightning:input type="number" aura:id="perczone" min="0" formatter="percent-fixed" onchange="{!c.updateZoneValues}"  step="0.01" name="globalObjective" label="" class="slds-p-horizontal_x-small" value="{!item.globalObjective}" onblur="{!c.alertpercent}"/></span>
                            </div>
 
Hello, 
I want to pass an object from my lightning js to my class apex.

My class apex:
  @AuraEnabled
    public static void updateEntityInfos(string entityWrapperList, String year) {         
     List<Opportunity> opportunityList = new List<Opportunity>();            
      opportunityList =(List<Opportunity>)System.JSON.deserialize(entityWrapperList, List<Opportunity>.class);
...
}

In my debug log I have in entityWrapperList :
[{"b2b":0,
"globalObjective":"56"
,"name":"test1"
,"newBusiness":"05"
,"opportunityId":"0065E00000CDMurQAH"
,"others":0,
"turnover":672},
{"b2b":0,
"globalObjective":"05"
,"name":"test2"
,"newBusiness":"05"
,"opportunityId":"0065E00000CDMuqQAH"
,"others":0,
"turnover":60},
{"b2b":0,
"globalObjective":"05"
,"name":"test3",
"newBusiness":"50",
"opportunityId":"0065E00000CDMupQAH"
,"others":0,
"turnover":60},
{"b2b":0
,"globalObjective":"65"
,"name":"test4"
,"newBusiness":"05"
,"opportunityId":"0065E00000CDMuoQAH"
,"others":0,
"turnover":780}]

but in my opportunityList  I have just the name:
opportunityList (Opportunity:{Name=EMEA RUSSIE},
Opportunity:{Name=APAC}, 
Opportunity:{Name=Grande Chine},
Opportunity:{Name=Ameriques})
   

Can someone help me.      


  
Hello,
 work with lightning component. I have a calculated field based on the multiplication of 2 fields in my lightning page. when trying to fill in one of the fields I get this error.
User-added image

Hello, That's my problem.
I have a list of buttons in my lightning page. The button labels are retrieved from a table SF (iterations). The idea of ​​registering opportunities with the name of the label buttons.

my label-buttion itération:
                <div class="slds-col slds-size--1-of-12" >
                 <aura:iteration items="{!v.zones}" var="item">                
                <lightning:button label="{!item}" aura:id ="{!item}" name ="{!item}" class="{!'customButton' + v.indexBtn + ' slds-size--1-of-1 slds-p-horizontal_x-small'}" onclick="{!c.myAction}"/>
                   </aura:iteration>
                </div>  


can someone help me.
 
Hello, 
I'm working with Lightning component.
I have lightning input type number and format Percent, but when I want to test that I have wrong value.
Exmple I put 8  (normaly I have 8%) but I have 800%.
My inputResult
Can someone help me please.
Hello everyone, 
I created lightning component. I created cmp file and controller.js file.
I want to call controller in my cmp file but i have this error "Failed to save ObjectifsYear.cmp: Invalid definition for null:ObjectifsYear: null: Source"
Ca u help me.
 
Hello Every one, 
I want to automatically calculate a field in my visualforce page from the multiplication of two other fields (in the same page).
Thank you in advance