-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
43Questions
-
15Replies
Event Related List - Lightning Component
Hello,
I want to expose object as related list in Event object in Salesforce. I would like to create lightning component for this related list.
Has someone an exemple?
I want to expose object as related list in Event object in Salesforce. I would like to create lightning component for this related list.
Has someone an exemple?
-
- Dev87
- July 09, 2018
- Like
- 0
- Continue reading or reply
Lightning Component called when click on button.
Hello,
I have Lightning Component called when I click on button.
I want to increase the width of lightning page opened.
Can u help me
I have Lightning Component called when I click on button.
I want to increase the width of lightning page opened.
Can u help me
-
- Dev87
- July 06, 2018
- Like
- 0
- Continue reading or reply
Trigger -Too many SOQL queries: 101
Hello,
I have trigger before insert, et before update d'un objet
When I deploy in Prod environnement, I have this error:
Too many SOQL queries: 101
Stack Trace: Trigger.CampaignMemberupdate: line 13, column 1
Can someone help me.
I have trigger before insert, et before update d'un objet
trigger CampaignMemberupdate on CampaignMember (before insert,before update) { List <campaignmember> Cmember = new List<campaignmember>(); for(campaignmember cmb:Trigger.new){ { Cmember.add(cmb); } if(!Cmember.isEmpty()){ id cmsourceid; for (campaignmember cmemb:Cmember ) { if (cmemb.CampaignId != null) { for (campaignmember cmemberold :[Select id, name,ContactId, Registation_Date2__c,RegistrationDate__c, type__c, appel_telephonique_orga__c, Discount_Code__c, Type_d_inscription__c from CampaignMember where CampaignId in (select CampagneSource__c from Campaign where id =: cmemb.CampaignId) ]) { if(cmemb.ContactId == cmemberold.ContactId) { cmemb.Discountcodeold__c = cmemberold.Discount_Code__c; cmemb.AppelTelephoniqueorgold__c = cmemberold.appel_telephonique_orga__c; cmemb.Registrationdateold__c = cmemberold.RegistrationDate__c; cmemb.TypeInscriptionOld__c = cmemberold.type__c; } } } } } } }
When I deploy in Prod environnement, I have this error:
Too many SOQL queries: 101
Stack Trace: Trigger.CampaignMemberupdate: line 13, column 1
Can someone help me.
-
- Dev87
- June 29, 2018
- Like
- 0
- Continue reading or reply
Apex- Oreder by - Field cannot be sorted
Hello,
I tried to sort an object in Query Editor but I get this error:
[object Object]: name from campaignmember ORDER BY Type_d_inscription__c ^ ERROR at Row:1:Column:65 field 'Type_d_inscription__c' can not be sorted in a query call
This is my query:
select Type_d_inscription__c, name from campaignmember ORDER BY Type_d_inscription__c
My Field is Multi-Select Filed type.
I tried to sort an object in Query Editor but I get this error:
[object Object]: name from campaignmember ORDER BY Type_d_inscription__c ^ ERROR at Row:1:Column:65 field 'Type_d_inscription__c' can not be sorted in a query call
This is my query:
select Type_d_inscription__c, name from campaignmember ORDER BY Type_d_inscription__c
My Field is Multi-Select Filed type.
-
- Dev87
- June 28, 2018
- Like
- 0
- Continue reading or reply
VisualForce Page - Next command - return to the top of the page
Hello,
I have a visualforce page that displays a table of data. The table can be displayed on several pages. I have two buttons following and preceding which allow to go from one page to another, the 2 buttons are displayed at the bottom of the page. My issue is the following: When click on next, the next page will be displayed but I remain at the bottom of the page. How can I return to the top of the page and move to the other page at the same time?
this is my visualforce code
I have a visualforce page that displays a table of data. The table can be displayed on several pages. I have two buttons following and preceding which allow to go from one page to another, the 2 buttons are displayed at the bottom of the page. My issue is the following: When click on next, the next page will be displayed but I remain at the bottom of the page. How can I return to the top of the page and move to the other page at the same time?
this is my visualforce code
<span class="prevNext"> <img src="/s.gif" class="prevoff" alt="Précédent"/> <apex:commandLink action="{!Previous}" title="Page Précédente" value="Précédent" rendered="{!NOT(disablePrevious)}" rerender="my_call_list" status="changeCamp"/> <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!disablePrevious}">Précédent</apex:outputPanel> </span> <span class="prevNext"> <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!disableNext}">Suivant</apex:outputPanel> <apex:commandLink title="Page Suivante" value="Suivant" rendered="{!NOT(disableNext)}" action="{!Next}" rerender="my_call_list" status="changeCamp"/> <img src="/s.gif" class="nextoff" alt="Suivant"/> </span> <span class="prevNext"> <apex:commandLink action="{!End}" title="Fin" type="image/gif" rendered="{!NOT(disableNext)}" rerender="my_call_list" status="changeCamp"> <apex:image value="/s.gif" styleClass="lastoff" alt="Fin"/> </apex:commandlink> </span>
-
- Dev87
- June 28, 2018
- Like
- 0
- Continue reading or reply
Two Queries in the same time -> error
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.
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.
-
- Dev87
- June 26, 2018
- Like
- 0
- Continue reading or reply
Test Class - Coverage
Hello,
I created update trigger to update opportunity and I have a probleme with covrage.
This is my apex class
and this is my test class:
My covarege is 68%.

I created update trigger to update opportunity and I have a probleme with covrage.
This is my 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<Tender_BU_Response__c> BUREPONSE = new list<Tender_BU_Response__c>(); list<Opportunity> Opp = new list<Opportunity>(); for(Opportunity o:oppList ){ Id oppId= o.id; system.debug('oppId--' +oppId); string soqlQuery = 'Select id,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 =:oppId'; BUREPONSE = database.query(soqlQuery); system.debug('BUREPONSE.size()--' +BUREPONSE.size()); if (BUREPONSE.size()!= NULL) { system.debug('test1---'); for (i=0; i < BUREPONSE.size(); i++) { {Nb_BUs_participating = Nb_BUs_participating+i;} if (BUREPONSE[i].Total_Parcels_Forecast__c != NULL) { TotalForcastparc = TotalForcastparc +BUREPONSE[i].Total_Parcels_Forecast__c;} if (BUREPONSE[i].Total_Revenues_Forecast__c != NULL) {TotalForcastcurrency = TotalForcastcurrency + BUREPONSE[i].Total_Revenues_Forecast__c;} if (BUREPONSE[i].Domestic_Parcels_Forecast__c != NULL) {TotalForcastDomPorc = TotalForcastDomPorc + BUREPONSE[i].Domestic_Parcels_Forecast__c;} if (BUREPONSE[i].Domestic_Revenues_Forecast__c != NULL) {TotalForcastDomcurrency = TotalForcastDomcurrency + BUREPONSE[i].Domestic_Revenues_Forecast__c;} if (BUREPONSE[i].International_Parcels_Forecast__c != NULL) { TotalForcastIntparc = TotalForcastIntparc + BUREPONSE[i].International_Parcels_Forecast__c;} if (BUREPONSE[i].International_Revenues_Forecast__c != NULL) {TotalForcastIntcurrency = TotalForcastIntcurrency + BUREPONSE[i].International_Revenues_Forecast__c;} } } 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]; if (Opp.size()>0) { for (Opportunity Opport: Opp) { 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); } } } } }this is my trigger
trigger OppAfterUpdate on Opportunity (after update) { Set<String> accIdSet = new Set<String>(); List <Opportunity> oppList = new List<Opportunity>(); if(checkRecursive.isFirstTime) { checkRecursive.isFirstTime = false; for(Opportunity Opp:Trigger.new){ { oppList.add(Opp); } } if(!oppList.isEmpty()){ Opp_CalculTotalForcast.TotalForcast(oppList); }} }
and this is my test class:
@isTest(SeeAllData=true) public class Opp_CalculTotalForcasttest { @isTest static void Opp_CalculTotalForcast_Test() { system.test.startTest(); 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){ id recordtypeid; List <recordtype> RecordtypeOpp= [Select id from recordtype where id =: Label.GATERFI limit 1]; if (RecordtypeOpp.size() > 0) { recordtypeid = RecordtypeOpp[0].id; } 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; system.debug('accid--' +acc.id); //create new opportunity Opportunity opp = new Opportunity (AccountId = acc.id, Name = 'opptestaicha', StageName = '0. Pre-Alert', CloseDate = myDate,Date_Received__c=Date.today(),Deadline_to_respond__c=Date.today()); insert opp; system.debug('oppid--' +opp.id); 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.debug('BUResponsinset ' +BURespons.id); opp.Comments__c= '--' ; // update opp; system.debug('oppid2 ' +opp.id); } } }
My covarege is 68%.
-
- Dev87
- June 26, 2018
- Like
- 0
- Continue reading or reply
VisualForce page - Syntax Error
I have a visualforce page that displays campaign member information (object that links the campaign and contacts). In the table I have the status column of the campgne member exposed as follows:
VF Page:
<apex:column headerValue="Statut">
<apex:selectList value="{!cmber.campMember.Status}" size="1" onchange="updateRecords();">
<apex:selectOptions value="{!StatusByCampaign[cmber.campMember.campaignid]}"/>
</apex:selectList>
</apex:column>
In my apex class:
....
public Map<String,List<SelectOption>> StatusByCampaign {
get {
Map<String,List<SelectOption>> StatusByCampaign = new Map<String,List<SelectOption>>();
for (Campaign c: getCampaignIDList()){
StatusByCampaign.put(c.Id, getStatusItemsFromCampaign(c.Id));
}
system.debug('--StatusByCampaign--' +StatusByCampaign);
return StatusByCampaign;
}
}
...
public List<SelectOption> getStatusItemsFromCampaign(String campId) {
List<SelectOption> options = new List<SelectOption>();
String query = 'SELECT Label FROM CampaignMemberStatus WHERE IsDeleted = false AND CampaignId = \'' + campId + '\'';
List<CampaignMemberStatus> listCampId = Database.query(query);
for (CampaignMemberStatus c: listCampId){
options.add(new SelectOption(c.Label, c.Label));
}
return options;
}
...
When Saving I have this error in my VF page: Erreur de syntaxe. Valeur 'StatusByCampaign' trouvée
Can someone help me.
VF Page:
<apex:column headerValue="Statut">
<apex:selectList value="{!cmber.campMember.Status}" size="1" onchange="updateRecords();">
<apex:selectOptions value="{!StatusByCampaign[cmber.campMember.campaignid]}"/>
</apex:selectList>
</apex:column>
In my apex class:
....
public Map<String,List<SelectOption>> StatusByCampaign {
get {
Map<String,List<SelectOption>> StatusByCampaign = new Map<String,List<SelectOption>>();
for (Campaign c: getCampaignIDList()){
StatusByCampaign.put(c.Id, getStatusItemsFromCampaign(c.Id));
}
system.debug('--StatusByCampaign--' +StatusByCampaign);
return StatusByCampaign;
}
}
...
public List<SelectOption> getStatusItemsFromCampaign(String campId) {
List<SelectOption> options = new List<SelectOption>();
String query = 'SELECT Label FROM CampaignMemberStatus WHERE IsDeleted = false AND CampaignId = \'' + campId + '\'';
List<CampaignMemberStatus> listCampId = Database.query(query);
for (CampaignMemberStatus c: listCampId){
options.add(new SelectOption(c.Label, c.Label));
}
return options;
}
...
When Saving I have this error in my VF page: Erreur de syntaxe. Valeur 'StatusByCampaign' trouvée
Can someone help me.
-
- Dev87
- June 21, 2018
- Like
- 0
- Continue reading or reply
Apex- Phone Contact List - Remove spaces and caracters
Hello
I have string List of contact phone number,and I want to delete spaces and all caracteres like +, (, ) from this list.
this is my apex code:
list <Contact> cont = [Select id, phone from contact];
string contphone;
string phone;
List<string> contphonelist = new List<String>();
List<string> contphonelistvide = new List<String>();
if (cont.size() != null)
{
for (integer i=0; i< cont.size(); i++)
{
contphone = cont[i].phone;
contphone = contphone.replaceAll( '\\s+', '');
contphonelist.add(contphone);
}
}
system.debug('---contphonelist--- ' +contphonelist);
if (contphonelist.size() != null)
{
for (integer j=0; j< contphonelist.size(); j++)
{
phone= contphonelist[j];
}}
I have error in my page : Attempt to de-reference a null object
Une erreur inattendue s'est produite. Votre organisation de développement a été notifiée.
Can someone help me.
I have string List of contact phone number,and I want to delete spaces and all caracteres like +, (, ) from this list.
this is my apex code:
list <Contact> cont = [Select id, phone from contact];
string contphone;
string phone;
List<string> contphonelist = new List<String>();
List<string> contphonelistvide = new List<String>();
if (cont.size() != null)
{
for (integer i=0; i< cont.size(); i++)
{
contphone = cont[i].phone;
contphone = contphone.replaceAll( '\\s+', '');
contphonelist.add(contphone);
}
}
system.debug('---contphonelist--- ' +contphonelist);
if (contphonelist.size() != null)
{
for (integer j=0; j< contphonelist.size(); j++)
{
phone= contphonelist[j];
}}
I have error in my page : Attempt to de-reference a null object
Une erreur inattendue s'est produite. Votre organisation de développement a été notifiée.
Can someone help me.
-
- Dev87
- June 19, 2018
- Like
- 0
- Continue reading or reply
apex test class - couvrage
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
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
-
- Dev87
- June 14, 2018
- Like
- 0
- Continue reading or reply
Trigger Apex Class before upfate
I want to create test class for this trigger:
trigger TriggerApprovalCommentOpp on Opportunity (before update) {
if(trigger.isUpdate){
List<Opportunity> opptyList = [Select id,
(Select Id,
IsPending,
ProcessInstanceId,
TargetObjectId,
StepStatus,
OriginalActorId,
ActorId,
RemindersSent,
Comments,
IsDeleted,
CreatedDate,
CreatedById,
SystemModstamp
FROM ProcessSteps
ORDER BY CreatedDate DESC)
From opportunity
WHERE Id IN : Trigger.new];
if(opptyList.size() > 0){
for(Opportunity opp : opptyList){
for(Opportunity opp1 : Trigger.new) {
//check copy comment is true
if(opp.id == opp1.id && opp1.CopierCommentaires__c) {
if (opp.ProcessSteps.size() > 0) {
opp1.Drniercommentairedapprobation__c = opp.ProcessSteps[1].Comments;
opp1.CopierCommentaires__c = false;
}
}
}
}
}
}
}
Can you help me.
trigger TriggerApprovalCommentOpp on Opportunity (before update) {
if(trigger.isUpdate){
List<Opportunity> opptyList = [Select id,
(Select Id,
IsPending,
ProcessInstanceId,
TargetObjectId,
StepStatus,
OriginalActorId,
ActorId,
RemindersSent,
Comments,
IsDeleted,
CreatedDate,
CreatedById,
SystemModstamp
FROM ProcessSteps
ORDER BY CreatedDate DESC)
From opportunity
WHERE Id IN : Trigger.new];
if(opptyList.size() > 0){
for(Opportunity opp : opptyList){
for(Opportunity opp1 : Trigger.new) {
//check copy comment is true
if(opp.id == opp1.id && opp1.CopierCommentaires__c) {
if (opp.ProcessSteps.size() > 0) {
opp1.Drniercommentairedapprobation__c = opp.ProcessSteps[1].Comments;
opp1.CopierCommentaires__c = false;
}
}
}
}
}
}
}
Can you help me.
-
- Dev87
- June 13, 2018
- Like
- 0
- Continue reading or reply
apex Class Test : System.QueryException: SOQL offset must be a non-negative value
I have test class
@isTest
public class ListeAppelsTest
{
public static List<Campaign> newCampaign;
static void init() {
newCampaign = new List<Campaign>();
}
public static testMethod void ListeAppels()
{
// Set test page passing initial parameters.
PageReference aPage = Page.ListeAppels;
aPage.getParameters().put('filterCampaignId', '999');
aPage.getParameters().put('filterStatus', '1');
aPage.getParameters().put('filterUserId', '0');
aPage.getParameters().put('filterSearch', '0678945312');
integer counter = 0;
test.setCurrentPage(aPage);
init();
Test.startTest();
//---------------------------------------------------------
List<Account> accounts = new List<Account>();
List<Contact> contacts = new List<Contact>();
List<CampaignMember> campaignMembers = new List<CampaignMember>();
Campaign csource = new Campaign (
Name = 'CSource' , Nom_Evenement__c='Agence'
);
insert csource;
for (Integer i=1;i<40; i++) {
Campaign c = new Campaign (
Name = 'Test' + i, Nom_Evenement__c='Agence', CampagneSource__c=csource.id
);
newCampaign.add(c);
}
insert newCampaign;
Integer i = 0;
for(Campaign campaign : newCampaign) {
for(Integer index = 0; index < 3; index++){
Account act1 = new Account(Name = 'Test'+index+i, Description=campaign.Id);
accounts.add(act1);
}
i++;
}
insert accounts;
for(Account account: accounts){
Contact cntct = new Contact(LastName = account.Name,phone='0678945313', mobilephone='0678945313',accountId = account.Id, Email='testContact@domain.com', Description = account.Description,Type_de_contact__c='Speaker');
contacts.add(cntct);
}
insert contacts;
Integer integ = 0;
for(Contact contact: contacts){
integ++;
String happel = null;
String pappel = null;
if(integ ==1){
pappel='2';
} else if(integ==2){
pappel=':2';
}else if(integ==3){
pappel='44:99';
}else if(integ==4){
pappel='aa:99';
}else if(integ==5){
pappel='aa:bb';
} else
if(integ ==11){
happel='2';
} else if(integ==12){
happel=':2';
}else if(integ==13){
happel='44:99';
}else if(integ==14){
happel='aa:99';
}else if(integ==15){
happel='aa:bb';
}
CampaignMember cm = null;
if(integ<=5) {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent', Heure_Dernier_Appel__c=pappel);
} else if (integ >= 10 && integ <= 15) {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent', Heure_Prochain_Appel__c=happel);
} else {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent');
}
campaignMembers.add(cm);
}
insert campaignMembers;
// Récuperation des CampaignMembers en Base
List<Id> newCampaignIds = new List<Id>();
for (Campaign C : newCampaign) {
newCampaignIds.add(C.Id);
}
newCampaign = [
SELECT Id, Name
FROM Campaign
WHERE Id IN :newCampaignIds
];
upsert newCampaign;
//---------------------------------------------------------
Account act = new Account();
act = new Account(Name = 'Test0');
upsert act;
Apexpages.StandardController sc = new Apexpages.standardController(act);
// Instantiate the extension
ListeAppels ext = new ListeAppels();
CampaignMembers = ext.sortListCM(campaignMembers);
ext.getData();
ext.UpdateRecords();
ext.userOwnerGroup();
ext.getBooleanValue('Non');
ext.getBooleanValue('Oui');
ext.Next();
ext.End();
ext.Previous();
ext.Beginning();
ext.getDisablePrevious();
ext.getDisableNext();
ext.getCampaignIDList();
ext.getDisableNext();
ext.getDisablePrevious();
ext.getTotalPages();
ext.getCmTotal();
ext.getPageNumber();
Boolean bln = ext.getBooleanValue('Oui');
bln = ext.getBooleanValue('Non');
string url = ext.getSfInstance() ;
Set<Id> usersForGroup = ext.usersForGroup;
List<SelectOption> CampaignItems = new List<SelectOption>();
CampaignItems.add(new SelectOption('', '-- Campagne --'));
// System.assertEquals(CampaignItems, ext.getCampaignItems());
List<SelectOption> StatusItems = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = CampaignMember.Status.getDescribe();
List<Schema.PicklistEntry> plv = fieldResult.getPickListValues();
StatusItems.add(new SelectOption('', '-- Statut --'));
for (Schema.PickListEntry s: plv){
StatusItems.add(new SelectOption(s.getValue(), s.getLabel()));
}
// System.assertEquals(StatusItems, ext.getStatusItems());
Map<String,List<SelectOption>> StatusByCampaign = new Map<String,List<SelectOption>>();
// System.assertEquals(StatusByCampaign, ext.StatusByCampaign);
List<SelectOption> StatusItemsEmpty = new List<SelectOption>();
// System.assertEquals(StatusItemsEmpty, ext.getStatusItemsFromCampaign(''));
Set<Id> setGpId = new Set<Id>();
setGpId = ext.getGroupUserIds(setGpId);
// System.assertEquals(setGpId, ext.getGroupUserIds(setGpId));
List<SelectOption> ContactTypes = new List<SelectOption>();
Schema.DescribeFieldResult fieldResultcCType = CampaignMember.Type_de_contact__c.getDescribe();
List<Schema.PicklistEntry> plvct = fieldResultcCType.getPickListValues();
ContactTypes.add(new SelectOption('', '-- Type de contact --'));
for (Schema.PickListEntry ct: plvct){
ContactTypes.add(new SelectOption(ct.getValue(), ct.getLabel()));
}
// System.assertEquals(ContactTypes, ext.getContactType());
ext.filterCampaignId ='97989U';
ext.filterSearch ='Test';
ext.filterStatus ='New';
ext.filterContactType ='Speaker';
aPage.getParameters().put('filterStatus', '1');
aPage.getParameters().put('filterUserId', '0');
List<ListeAppels.cCampaignMember> ccampaignMember = ext.getCampaignMembersFromQuery(true);
String queryFields = 'SELECT Id, DateHeureAppel__c, Date_Dernier_Appel__c,Heure_Dernier_Appel__c,Date_Prochain_Appel__c,Heure_Prochain_Appel__c, Date_Heure_Prochain_Appel__c, ContactId, contact.email, contact.title, contact.salutation, contact.MobilePhone, contact.phone, contact.pi__comments__c ,Potentiel__c ,CampaignId, Contact.Id, Contact.Account.Id, Status, Contact.Account.Name, contact.name, contact.Type_d_inscription__c, contact.Service__c, contact.Secteur__c, Campaign.name, CommentaireAppel__c, Type_de_contact__c, appel_telephonique_orga__c, Discount_Code__c,RegistrationDate__c';
String query = ' FROM CampaignMember';
List<CampaignMember> cmembre =Database.query(queryFields + query);
ext.CampaignMembers = new List<ListeAppels.cCampaignMember>();
for (CampaignMember cmpMbr: cmembre){
ext.CampaignMembers.add(new ListeAppels.cCampaignMember(cmpMbr, ext.cMap ));
}
ext.sortBy = 'Registration Date';
ext.sortDir = 'Registration Date';
ext.CampaignMembers = ext.sortList(ext.CampaignMembers);
aPage =ext.UpdateRecords();
Test.stopTest();
}
private static List<Campaign> createNewCampaign(Integer numCampaign) {
//System.debug(clients);
for (Integer i=0;i<numCampaign; i++) {
Campaign c = new Campaign (
Name = 'Test' + i
);
newCampaign.add(c);
}
insert newCampaign;
// Récuperation des CampaignMembers en Base
List<Id> newCampaignIds = new List<Id>();
for (Campaign C : newCampaign) {
newCampaignIds.add(C.Id);
}
newCampaign = [
SELECT Id, Name
FROM Campaign
WHERE Id IN :newCampaignIds
];
upsert newCampaign;
return newCampaign;
}
}
when I execute i have this error:
System.QueryException: SOQL offset must be a non-negative value
@isTest
public class ListeAppelsTest
{
public static List<Campaign> newCampaign;
static void init() {
newCampaign = new List<Campaign>();
}
public static testMethod void ListeAppels()
{
// Set test page passing initial parameters.
PageReference aPage = Page.ListeAppels;
aPage.getParameters().put('filterCampaignId', '999');
aPage.getParameters().put('filterStatus', '1');
aPage.getParameters().put('filterUserId', '0');
aPage.getParameters().put('filterSearch', '0678945312');
integer counter = 0;
test.setCurrentPage(aPage);
init();
Test.startTest();
//---------------------------------------------------------
List<Account> accounts = new List<Account>();
List<Contact> contacts = new List<Contact>();
List<CampaignMember> campaignMembers = new List<CampaignMember>();
Campaign csource = new Campaign (
Name = 'CSource' , Nom_Evenement__c='Agence'
);
insert csource;
for (Integer i=1;i<40; i++) {
Campaign c = new Campaign (
Name = 'Test' + i, Nom_Evenement__c='Agence', CampagneSource__c=csource.id
);
newCampaign.add(c);
}
insert newCampaign;
Integer i = 0;
for(Campaign campaign : newCampaign) {
for(Integer index = 0; index < 3; index++){
Account act1 = new Account(Name = 'Test'+index+i, Description=campaign.Id);
accounts.add(act1);
}
i++;
}
insert accounts;
for(Account account: accounts){
Contact cntct = new Contact(LastName = account.Name,phone='0678945313', mobilephone='0678945313',accountId = account.Id, Email='testContact@domain.com', Description = account.Description,Type_de_contact__c='Speaker');
contacts.add(cntct);
}
insert contacts;
Integer integ = 0;
for(Contact contact: contacts){
integ++;
String happel = null;
String pappel = null;
if(integ ==1){
pappel='2';
} else if(integ==2){
pappel=':2';
}else if(integ==3){
pappel='44:99';
}else if(integ==4){
pappel='aa:99';
}else if(integ==5){
pappel='aa:bb';
} else
if(integ ==11){
happel='2';
} else if(integ==12){
happel=':2';
}else if(integ==13){
happel='44:99';
}else if(integ==14){
happel='aa:99';
}else if(integ==15){
happel='aa:bb';
}
CampaignMember cm = null;
if(integ<=5) {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent', Heure_Dernier_Appel__c=pappel);
} else if (integ >= 10 && integ <= 15) {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent', Heure_Prochain_Appel__c=happel);
} else {
cm= New CampaignMember(CampaignId=contact.Description,ContactId=contact.Id,Status='Sent');
}
campaignMembers.add(cm);
}
insert campaignMembers;
// Récuperation des CampaignMembers en Base
List<Id> newCampaignIds = new List<Id>();
for (Campaign C : newCampaign) {
newCampaignIds.add(C.Id);
}
newCampaign = [
SELECT Id, Name
FROM Campaign
WHERE Id IN :newCampaignIds
];
upsert newCampaign;
//---------------------------------------------------------
Account act = new Account();
act = new Account(Name = 'Test0');
upsert act;
Apexpages.StandardController sc = new Apexpages.standardController(act);
// Instantiate the extension
ListeAppels ext = new ListeAppels();
CampaignMembers = ext.sortListCM(campaignMembers);
ext.getData();
ext.UpdateRecords();
ext.userOwnerGroup();
ext.getBooleanValue('Non');
ext.getBooleanValue('Oui');
ext.Next();
ext.End();
ext.Previous();
ext.Beginning();
ext.getDisablePrevious();
ext.getDisableNext();
ext.getCampaignIDList();
ext.getDisableNext();
ext.getDisablePrevious();
ext.getTotalPages();
ext.getCmTotal();
ext.getPageNumber();
Boolean bln = ext.getBooleanValue('Oui');
bln = ext.getBooleanValue('Non');
string url = ext.getSfInstance() ;
Set<Id> usersForGroup = ext.usersForGroup;
List<SelectOption> CampaignItems = new List<SelectOption>();
CampaignItems.add(new SelectOption('', '-- Campagne --'));
// System.assertEquals(CampaignItems, ext.getCampaignItems());
List<SelectOption> StatusItems = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = CampaignMember.Status.getDescribe();
List<Schema.PicklistEntry> plv = fieldResult.getPickListValues();
StatusItems.add(new SelectOption('', '-- Statut --'));
for (Schema.PickListEntry s: plv){
StatusItems.add(new SelectOption(s.getValue(), s.getLabel()));
}
// System.assertEquals(StatusItems, ext.getStatusItems());
Map<String,List<SelectOption>> StatusByCampaign = new Map<String,List<SelectOption>>();
// System.assertEquals(StatusByCampaign, ext.StatusByCampaign);
List<SelectOption> StatusItemsEmpty = new List<SelectOption>();
// System.assertEquals(StatusItemsEmpty, ext.getStatusItemsFromCampaign(''));
Set<Id> setGpId = new Set<Id>();
setGpId = ext.getGroupUserIds(setGpId);
// System.assertEquals(setGpId, ext.getGroupUserIds(setGpId));
List<SelectOption> ContactTypes = new List<SelectOption>();
Schema.DescribeFieldResult fieldResultcCType = CampaignMember.Type_de_contact__c.getDescribe();
List<Schema.PicklistEntry> plvct = fieldResultcCType.getPickListValues();
ContactTypes.add(new SelectOption('', '-- Type de contact --'));
for (Schema.PickListEntry ct: plvct){
ContactTypes.add(new SelectOption(ct.getValue(), ct.getLabel()));
}
// System.assertEquals(ContactTypes, ext.getContactType());
ext.filterCampaignId ='97989U';
ext.filterSearch ='Test';
ext.filterStatus ='New';
ext.filterContactType ='Speaker';
aPage.getParameters().put('filterStatus', '1');
aPage.getParameters().put('filterUserId', '0');
List<ListeAppels.cCampaignMember> ccampaignMember = ext.getCampaignMembersFromQuery(true);
String queryFields = 'SELECT Id, DateHeureAppel__c, Date_Dernier_Appel__c,Heure_Dernier_Appel__c,Date_Prochain_Appel__c,Heure_Prochain_Appel__c, Date_Heure_Prochain_Appel__c, ContactId, contact.email, contact.title, contact.salutation, contact.MobilePhone, contact.phone, contact.pi__comments__c ,Potentiel__c ,CampaignId, Contact.Id, Contact.Account.Id, Status, Contact.Account.Name, contact.name, contact.Type_d_inscription__c, contact.Service__c, contact.Secteur__c, Campaign.name, CommentaireAppel__c, Type_de_contact__c, appel_telephonique_orga__c, Discount_Code__c,RegistrationDate__c';
String query = ' FROM CampaignMember';
List<CampaignMember> cmembre =Database.query(queryFields + query);
ext.CampaignMembers = new List<ListeAppels.cCampaignMember>();
for (CampaignMember cmpMbr: cmembre){
ext.CampaignMembers.add(new ListeAppels.cCampaignMember(cmpMbr, ext.cMap ));
}
ext.sortBy = 'Registration Date';
ext.sortDir = 'Registration Date';
ext.CampaignMembers = ext.sortList(ext.CampaignMembers);
aPage =ext.UpdateRecords();
Test.stopTest();
}
private static List<Campaign> createNewCampaign(Integer numCampaign) {
//System.debug(clients);
for (Integer i=0;i<numCampaign; i++) {
Campaign c = new Campaign (
Name = 'Test' + i
);
newCampaign.add(c);
}
insert newCampaign;
// Récuperation des CampaignMembers en Base
List<Id> newCampaignIds = new List<Id>();
for (Campaign C : newCampaign) {
newCampaignIds.add(C.Id);
}
newCampaign = [
SELECT Id, Name
FROM Campaign
WHERE Id IN :newCampaignIds
];
upsert newCampaign;
return newCampaign;
}
}
when I execute i have this error:
System.QueryException: SOQL offset must be a non-negative value
-
- Dev87
- June 11, 2018
- Like
- 0
- Continue reading or reply
visualforce Page - Sort Columns
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
<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
-
- Dev87
- June 11, 2018
- Like
- 0
- Continue reading or reply
Error Visualforce page Too many SOQL queries: 101
Hello,
I have problem when I want to open my visualforce page
Too many SOQL queries: 101
Can you help me please.
I have problem when I want to open my visualforce page
Too many SOQL queries: 101
Can you help me please.
-
- Dev87
- June 08, 2018
- Like
- 0
- Continue reading or reply
Apex test class coverage 57%
Hello,
I have apex class and apex test_Class. my coverage is on 57%. Please can someone help me.
My Apex Class:
public class show_opp {
@AuraEnabled
public static void updateEntityInfos(string entityWrapperList, String year,Decimal Amount, Decimal GrandC,Decimal NewBus, String Zone,Decimal AutresC) {
Decimal Amounts = Amount;
string zonee= Zone;
ID currentiduser;
List <user> currentiduserlist=[Select id from user where id =: Label.userassign limit 1];
if (currentiduserlist.size() > 0)
{
currentiduser = currentiduserlist[0].id;
}
List<String> zones = new list<String> { 'A1' , 'A2' , 'A3', 'A4'};
If (entityWrapperList != null){
id recordtypeid;
List <recordtype> RecordtypeOpp= [Select id from recordtype where id =: Label.ObjectifGlobalOpp limit 1];
if (RecordtypeOpp.size() > 0)
{
recordtypeid = RecordtypeOpp[0].id;
}
List<EntityWrapperClass> ObjList = new List<EntityWrapperClass>();
ObjList =(List<EntityWrapperClass>)System.JSON.deserialize(entityWrapperList,List<EntityWrapperClass>.class);
List<Opportunity> opportunityList = new List<Opportunity>();
List<Opportunity> opportunityListup = new List<Opportunity>();
for(EntityWrapperClass obj:ObjList ){
opportunity o=new opportunity();
string zonename= obj.name;
if (zones.contains(zonename))
{
o.Zone__C=obj.name;
o.ObjZoneEuro__c = obj.turnover;
o.Objectif_Global_Zone__c=obj.globalObjective;
}
else
{
o.Agence__c=obj.name;
o.Zone__C=zonee;
o.Objectif_Global_Agence__c=obj.globalObjective;
}
o.Global_New_Business__c=obj.newBusiness;
o.Global_Major_Account__c=obj.b2b;
o.Global_Other__c=obj.others;
o.Objectif_CA__c=Amounts;
o.Id= obj.opportunityId;
o.ObjectifYear__c = year;
o.OwnerId = currentiduser;
o.CloseDate = Date.newInstance(Integer.valueOf(year), 12, 31);
o.StageName = 'Qualification';
opportunityList.add(o);
}
for (Opportunity o:opportunityList)
{
}
upsert opportunityList;
}
{
id recordtypeidg;
List <recordtype> RecordtypeOppg= [Select id from recordtype where id =: Label.ObjectifGlobalOpp limit 1];
if (RecordtypeOppg.size() > 0)
{
recordtypeidg = RecordtypeOppg[0].id;
}
List<Opportunity> OpportunityGlobal = [Select id, Objectif_CA__c, Global_New_Business__c,Global_Major_Account__c, Global_Other__c from Opportunity where recordtypeid =: recordtypeidg and ObjectifYear__c =: year ORDER BY Createddate DESC LIMIT 1];
system.debug('OpportunityGlobal ' +OpportunityGlobal );
if (OpportunityGlobal.size()>0){
Decimal NewBusiness = NewBus;
Decimal GrandCs = GrandC;
Decimal AutresCs = AutresC;
OpportunityGlobal[0].CloseDate = Date.newInstance(Integer.valueOf(year), 12, 31);
OpportunityGlobal[0].Objectif_CA__c = Amounts;
OpportunityGlobal[0].Global_New_Business__c = NewBusiness;
OpportunityGlobal[0].Global_Major_Account__c = GrandCs;
OpportunityGlobal[0].Global_Other__c = AutresCs;
OpportunityGlobal[0].ObjectifYear__c = year;
OpportunityGlobal[0].OwnerId = currentiduser;
OpportunityGlobal[0].recordtypeid = recordtypeidg;
Database.upsert(OpportunityGlobal);
}
}
}
}
My Apex Test_Class:
@IsTest
public class show_opp_Test {
@isTest
// run the the class test
static void showoppTest() {
// Test data setup
String result;
Test.startTest();
LNCO5_ShowObjectifAnnuelSopexa.updateEntityInfos ('[{"b2b":10,"globalObjective":21,"name":"A1","newBusiness":"6","opportunityId":"0065E00000CDKWwQAP","others":80,"turnover":14910000},{"b2b":20,"globalObjective":22,"name":"A2","newBusiness":10,"opportunityId":"0065E00000CDKWvQAP","others":"8","turnover":15620000},{"b2b":3,"globalObjective":12,"name":"A3","newBusiness":4,"opportunityId":"0065E00000CDKWuQAP","others":80,"turnover":8520000},{"b2b":3,"globalObjective":14,"name":"A4","newBusiness":60,"opportunityId":"0065E00000CDKWtQAP","others":"10","turnover":9940000}]','2019', 7000, 20 ,19, 'A1', 35);
Test.stopTest();
// System.assertEquals('SUCCESS' , result);
}
}
I have apex class and apex test_Class. my coverage is on 57%. Please can someone help me.
My Apex Class:
public class show_opp {
@AuraEnabled
public static void updateEntityInfos(string entityWrapperList, String year,Decimal Amount, Decimal GrandC,Decimal NewBus, String Zone,Decimal AutresC) {
Decimal Amounts = Amount;
string zonee= Zone;
ID currentiduser;
List <user> currentiduserlist=[Select id from user where id =: Label.userassign limit 1];
if (currentiduserlist.size() > 0)
{
currentiduser = currentiduserlist[0].id;
}
List<String> zones = new list<String> { 'A1' , 'A2' , 'A3', 'A4'};
If (entityWrapperList != null){
id recordtypeid;
List <recordtype> RecordtypeOpp= [Select id from recordtype where id =: Label.ObjectifGlobalOpp limit 1];
if (RecordtypeOpp.size() > 0)
{
recordtypeid = RecordtypeOpp[0].id;
}
List<EntityWrapperClass> ObjList = new List<EntityWrapperClass>();
ObjList =(List<EntityWrapperClass>)System.JSON.deserialize(entityWrapperList,List<EntityWrapperClass>.class);
List<Opportunity> opportunityList = new List<Opportunity>();
List<Opportunity> opportunityListup = new List<Opportunity>();
for(EntityWrapperClass obj:ObjList ){
opportunity o=new opportunity();
string zonename= obj.name;
if (zones.contains(zonename))
{
o.Zone__C=obj.name;
o.ObjZoneEuro__c = obj.turnover;
o.Objectif_Global_Zone__c=obj.globalObjective;
}
else
{
o.Agence__c=obj.name;
o.Zone__C=zonee;
o.Objectif_Global_Agence__c=obj.globalObjective;
}
o.Global_New_Business__c=obj.newBusiness;
o.Global_Major_Account__c=obj.b2b;
o.Global_Other__c=obj.others;
o.Objectif_CA__c=Amounts;
o.Id= obj.opportunityId;
o.ObjectifYear__c = year;
o.OwnerId = currentiduser;
o.CloseDate = Date.newInstance(Integer.valueOf(year), 12, 31);
o.StageName = 'Qualification';
opportunityList.add(o);
}
for (Opportunity o:opportunityList)
{
}
upsert opportunityList;
}
{
id recordtypeidg;
List <recordtype> RecordtypeOppg= [Select id from recordtype where id =: Label.ObjectifGlobalOpp limit 1];
if (RecordtypeOppg.size() > 0)
{
recordtypeidg = RecordtypeOppg[0].id;
}
List<Opportunity> OpportunityGlobal = [Select id, Objectif_CA__c, Global_New_Business__c,Global_Major_Account__c, Global_Other__c from Opportunity where recordtypeid =: recordtypeidg and ObjectifYear__c =: year ORDER BY Createddate DESC LIMIT 1];
system.debug('OpportunityGlobal ' +OpportunityGlobal );
if (OpportunityGlobal.size()>0){
Decimal NewBusiness = NewBus;
Decimal GrandCs = GrandC;
Decimal AutresCs = AutresC;
OpportunityGlobal[0].CloseDate = Date.newInstance(Integer.valueOf(year), 12, 31);
OpportunityGlobal[0].Objectif_CA__c = Amounts;
OpportunityGlobal[0].Global_New_Business__c = NewBusiness;
OpportunityGlobal[0].Global_Major_Account__c = GrandCs;
OpportunityGlobal[0].Global_Other__c = AutresCs;
OpportunityGlobal[0].ObjectifYear__c = year;
OpportunityGlobal[0].OwnerId = currentiduser;
OpportunityGlobal[0].recordtypeid = recordtypeidg;
Database.upsert(OpportunityGlobal);
}
}
}
}
My Apex Test_Class:
@IsTest
public class show_opp_Test {
@isTest
// run the the class test
static void showoppTest() {
// Test data setup
String result;
Test.startTest();
LNCO5_ShowObjectifAnnuelSopexa.updateEntityInfos ('[{"b2b":10,"globalObjective":21,"name":"A1","newBusiness":"6","opportunityId":"0065E00000CDKWwQAP","others":80,"turnover":14910000},{"b2b":20,"globalObjective":22,"name":"A2","newBusiness":10,"opportunityId":"0065E00000CDKWvQAP","others":"8","turnover":15620000},{"b2b":3,"globalObjective":12,"name":"A3","newBusiness":4,"opportunityId":"0065E00000CDKWuQAP","others":80,"turnover":8520000},{"b2b":3,"globalObjective":14,"name":"A4","newBusiness":60,"opportunityId":"0065E00000CDKWtQAP","others":"10","turnover":9940000}]','2019', 7000, 20 ,19, 'A1', 35);
Test.stopTest();
// System.assertEquals('SUCCESS' , result);
}
}
-
- Dev87
- June 04, 2018
- Like
- 0
- Continue reading or reply
lightning error deploy
Hello,
I have lightning component to deploy in production environnement.
When validate Inbound changes set, I have this error
The attribute "id" was not found on the COMPONENT markup://lightning:input
I have lightning component to deploy in production environnement.
When validate Inbound changes set, I have this error
The attribute "id" was not found on the COMPONENT markup://lightning:input
-
- Dev87
- June 04, 2018
- Like
- 0
- Continue reading or reply
lightning page -add section to Related Lists
Hello,
I have a lightning page to view the details of an opportunity. I need to add a section containing fields of opportunity, the section will be added in the 'Related Lists' section. Is it possible? How else can I add the section in the page?
I have a lightning page to view the details of an opportunity. I need to add a section containing fields of opportunity, the section will be added in the 'Related Lists' section. Is it possible? How else can I add the section in the page?
-
- Dev87
- June 01, 2018
- Like
- 0
- Continue reading or reply
Convert Lead - Apex
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
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
-
- Dev87
- May 30, 2018
- Like
- 0
- Continue reading or reply
Lightning - Error when updating record (Percent Field)
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:

<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>
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:
<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>
-
- Dev87
- May 30, 2018
- Like
- 0
- Continue reading or reply
Salesforce- upadate Workflow in Prod
Hello,
I want to modify my Workflow in my Production environnement.
I deactivate it but I can't modify conditions to execute Actions de workflow.
I want to modify my Workflow in my Production environnement.
I deactivate it but I can't modify conditions to execute Actions de workflow.
-
- Dev87
- May 24, 2018
- Like
- 0
- Continue reading or reply
Two Queries in the same time -> error
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.
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.
- Dev87
- June 26, 2018
- Like
- 0
- Continue reading or reply
apex test class - couvrage
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
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
- Dev87
- June 14, 2018
- Like
- 0
- Continue reading or reply
visualforce Page - Sort Columns
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
<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
- Dev87
- June 11, 2018
- Like
- 0
- Continue reading or reply
Convert Lead - Apex
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
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
- Dev87
- May 30, 2018
- Like
- 0
- Continue reading or reply
Lightning - Error when updating record (Percent Field)
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:

<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>
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:
<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>
- Dev87
- May 30, 2018
- Like
- 0
- Continue reading or reply
Pass List <object> from lightning to apex
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.
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.
- Dev87
- May 11, 2018
- Like
- 0
- Continue reading or reply
lightning Component -Uncaught Action failed
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.
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.
- Dev87
- April 23, 2018
- Like
- 0
- Continue reading or reply
lightning Component - Save records
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.
- Dev87
- April 03, 2018
- Like
- 0
- Continue reading or reply
Salesforce lightning component-Input Number format %
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%.


Can someone help me please.
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%.
Can someone help me please.
- Dev87
- March 29, 2018
- Like
- 0
- Continue reading or reply
Lightning component: error when saving cmp file
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.
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.
- Dev87
- March 26, 2018
- Like
- 0
- Continue reading or reply
VisualForse Page: Calculated Field
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
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
- Dev87
- March 21, 2018
- Like
- 0
- Continue reading or reply