• Ana Catarina Brites
  • NEWBIE
  • 90 Points
  • Member since 2013
  • Neeaconsulting

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 19
    Replies
Hello,

The test for the trigger below is accept, but the coverage is 0%!

Surely, something escapes me as my eyes are tired :-(

Your new look will surely find the solution

Thank you in advance


Philippe

The trigger

trigger ContenantPrix on Pepiniere__c (after update) {
List<ContenantRemise__c> subs = new List<ContenantRemise__c>();
// insertion remise  
for (Pepiniere__c PrixApartirde : Trigger.New) {  
subs.add(new ContenantRemise__c(
id_feature_value__c = PrixApartirde.Remise_id_feature_value__c,
id_feature__c = PrixApartirde.Remise_id_feature__c,
Actif__c = true,
Id__c = PrixApartirde.Remise_Id__c,    
Saison__c = PrixApartirde.ID  ));}
upsert subs Id__c; 
// insertion contenant  
for (Pepiniere__c Contenant : Trigger.New) {  
subs.add(new ContenantRemise__c(
id_feature_value__c = Contenant.Contenant_id_feature_value__c,
id_feature__c = Contenant.Contenant_id_feature__c,
Actif__c = true,
Id__c = Contenant.Contenant_Id__c, 
Saison__c = Contenant.ID  ));}
upsert subs Id__c;   }

And the Test :

@istest
private class TestContenantPrix {

static TestMethod void TestContenantPrix() {
Plante__c plante = new Plante__c(Name='Achillea millefolium',id_product__c ='32');    
insert plante;   
Campagne__c campagne = new Campagne__c(name='2014'); 
insert campagne;    

Features__c fea = new Features__c(Name='Conteneur de 12 cm',id_feature__c='8',id_feature_value__c='37');
Insert fea;
Features__c rem = new Features__c(Name='à partir de 3',id_feature__c='15',id_feature_value__c='46');
Insert rem;    
    
Pepiniere__c acc = new Pepiniere__c(Fiche__c=plante.id,Campagne__c=campagne.id,Contenant_pepi__c=fea.id,Prix_partir_de__c=rem.id);
Insert acc; 
Catalogue__c cata = new Catalogue__c(Name='Achillea millefolium',fiche_de_la_plante__c=plante.id,production__c=acc.id,id_product__c='32');
insert cata;
   
ContenantRemise__c testC1 = new ContenantRemise__c(Id__c ='32-8',Saison__c=acc.id,Actif__c = true,id_feature_value__c=acc.Contenant_id_feature_value__c,id_feature__c = acc.Contenant_id_feature__c);
upsert testC1 Id__c;  
ContenantRemise__c testC2 = new ContenantRemise__c(Id__c ='32-15',Saison__c=acc.id,Actif__c = true,id_feature_value__c=acc.Remise_id_feature_value__c,id_feature__c = acc.Remise_id_feature__c);
upsert testC2 Id__c;     
    
 //pull the pepiniere info for that ContenantRemise
ContenantRemise__c SecContenantRemise =[SELECT Id__c,Saison__c,Actif__c,id_feature_value__c,id_feature__c FROM ContenantRemise__c WHERE Id = :testC1.id];
ContenantRemise__c SecContRem =[SELECT Id__c,Saison__c,Actif__c,id_feature_value__c,id_feature__c FROM ContenantRemise__c WHERE Id = :testC2.id];    
//verify that the insert updated by creating another ContenantRemise as in the trigger

  System.assert(SecContenantRemise.Id != null);
  System.assertEquals(SecContenantRemise.id_feature_value__c, testC1.id_feature_value__c);
   
  System.assertEquals(SecContenantRemise.id_feature_value__c, fea.id_feature_value_num__c);
  System.assertEquals(SecContenantRemise.Saison__c, acc.id);   
    
  System.assert(SecContRem.Id != null);
  System.assertEquals(SecContRem.id_feature_value__c, testC2.id_feature_value__c);
 
  System.assertEquals(SecContRem.id_feature_value__c, rem.id_feature_value_num__c);
  System.assertEquals(SecContRem.Saison__c, acc.id);    
 
   }

}

Hi. I'm sure alot of people have run into this type of issue.
Basically, I have a Parent record, and Child record that I want to load via Data Loader.
Since its an Insert (or Upsert), I wouldn't know the "Parent ID" initially.
So I'd have to:
insert/upsert the parent.
Grab the Parent ID and paste the Parent ID to the reference ID in the Child record.

This is a pain especially if i am loading a lot of parent-child related records. Is there even an easier work around in data loader?
Hello All!

I'm trying to inset (upsert) a list of events into my salesforce, but the field ISALLDAYEVENT is not showing up on my list of fields to map.
Am I missing something? Some configuration in my Data Loader?  
Any ideas?!

Thanks.
ACB

Hello.
I have been looking at an unusual situation.

I have a visualforce page with some inputtextareas with a style. When loading the page, it works fine as in getting the values from the controller. When the user changes this values on the page and submits the form, the values are not being set!

The unusual thing is that when I remove the class from the inputtextarea, it works perfectly, but if I keep the class not so much.

Here is an example of a textarea input and the Css code:

 

<!-- Input textarea --> 
<div class="title-form text-bold">Title:</div>
<apex:inputtextarea styleClass="input-textarea" id="msg6" value="{!button.Message_title__c}" rows="2" cols="100"/>

 

When the form is submited I have a script that verifies if the input is not empty.

If someone could help me find a workaround for this I would be very thankful.

Best Regards,
ACB

Hello,

The test for the trigger below is accept, but the coverage is 0%!

Surely, something escapes me as my eyes are tired :-(

Your new look will surely find the solution

Thank you in advance


Philippe

The trigger

trigger ContenantPrix on Pepiniere__c (after update) {
List<ContenantRemise__c> subs = new List<ContenantRemise__c>();
// insertion remise  
for (Pepiniere__c PrixApartirde : Trigger.New) {  
subs.add(new ContenantRemise__c(
id_feature_value__c = PrixApartirde.Remise_id_feature_value__c,
id_feature__c = PrixApartirde.Remise_id_feature__c,
Actif__c = true,
Id__c = PrixApartirde.Remise_Id__c,    
Saison__c = PrixApartirde.ID  ));}
upsert subs Id__c; 
// insertion contenant  
for (Pepiniere__c Contenant : Trigger.New) {  
subs.add(new ContenantRemise__c(
id_feature_value__c = Contenant.Contenant_id_feature_value__c,
id_feature__c = Contenant.Contenant_id_feature__c,
Actif__c = true,
Id__c = Contenant.Contenant_Id__c, 
Saison__c = Contenant.ID  ));}
upsert subs Id__c;   }

And the Test :

@istest
private class TestContenantPrix {

static TestMethod void TestContenantPrix() {
Plante__c plante = new Plante__c(Name='Achillea millefolium',id_product__c ='32');    
insert plante;   
Campagne__c campagne = new Campagne__c(name='2014'); 
insert campagne;    

Features__c fea = new Features__c(Name='Conteneur de 12 cm',id_feature__c='8',id_feature_value__c='37');
Insert fea;
Features__c rem = new Features__c(Name='à partir de 3',id_feature__c='15',id_feature_value__c='46');
Insert rem;    
    
Pepiniere__c acc = new Pepiniere__c(Fiche__c=plante.id,Campagne__c=campagne.id,Contenant_pepi__c=fea.id,Prix_partir_de__c=rem.id);
Insert acc; 
Catalogue__c cata = new Catalogue__c(Name='Achillea millefolium',fiche_de_la_plante__c=plante.id,production__c=acc.id,id_product__c='32');
insert cata;
   
ContenantRemise__c testC1 = new ContenantRemise__c(Id__c ='32-8',Saison__c=acc.id,Actif__c = true,id_feature_value__c=acc.Contenant_id_feature_value__c,id_feature__c = acc.Contenant_id_feature__c);
upsert testC1 Id__c;  
ContenantRemise__c testC2 = new ContenantRemise__c(Id__c ='32-15',Saison__c=acc.id,Actif__c = true,id_feature_value__c=acc.Remise_id_feature_value__c,id_feature__c = acc.Remise_id_feature__c);
upsert testC2 Id__c;     
    
 //pull the pepiniere info for that ContenantRemise
ContenantRemise__c SecContenantRemise =[SELECT Id__c,Saison__c,Actif__c,id_feature_value__c,id_feature__c FROM ContenantRemise__c WHERE Id = :testC1.id];
ContenantRemise__c SecContRem =[SELECT Id__c,Saison__c,Actif__c,id_feature_value__c,id_feature__c FROM ContenantRemise__c WHERE Id = :testC2.id];    
//verify that the insert updated by creating another ContenantRemise as in the trigger

  System.assert(SecContenantRemise.Id != null);
  System.assertEquals(SecContenantRemise.id_feature_value__c, testC1.id_feature_value__c);
   
  System.assertEquals(SecContenantRemise.id_feature_value__c, fea.id_feature_value_num__c);
  System.assertEquals(SecContenantRemise.Saison__c, acc.id);   
    
  System.assert(SecContRem.Id != null);
  System.assertEquals(SecContRem.id_feature_value__c, testC2.id_feature_value__c);
 
  System.assertEquals(SecContRem.id_feature_value__c, rem.id_feature_value_num__c);
  System.assertEquals(SecContRem.Saison__c, acc.id);    
 
   }

}

Hi. I'm sure alot of people have run into this type of issue.
Basically, I have a Parent record, and Child record that I want to load via Data Loader.
Since its an Insert (or Upsert), I wouldn't know the "Parent ID" initially.
So I'd have to:
insert/upsert the parent.
Grab the Parent ID and paste the Parent ID to the reference ID in the Child record.

This is a pain especially if i am loading a lot of parent-child related records. Is there even an easier work around in data loader?
I created a trigger to prevent the deletion of a parent record if a child record exists. I'm having problems with the test class. It says required field missing "Dept_Code__c". I have it in the test class, so I'm not sure what I'm missing.
Parent Object - Order_Request__c (Quantity, Cost Center (lookup), Order Type (lookup) are required fields.

Child Object - Order_Assignment__c (Order Request, Order Center (lookup) are required fields)

Any help is greatly appreciated.

trigger PreventOrderDeletion on Order_Request__c (before delete) {


    for(Order_Request__c lq : [Select Id, Name, (Select Id from Order_Assignments__r) from Order_Request__c where Id IN :trigger.oldMap.KeySet()]){

            if(lq.Order_Assignments__r != null && lq.Order_Assignments__r.size() > 0){

              lq.addError('The order request cannot be deleted because there is an associated order assignment record');

            }
     } 



@IsTest(SeeAllData=true)
public class PreventOrderDeletionTest{

static testMethod void PreventDeleteTest()
{
    //Create Parent Object
    Order_Request__c lic = new Order_Request__c(Name='Salesforce Testing');
    lic.Quantity__c = Decimal.valueOf('1.0');
    lic.Order_Type__c = 'a6xxxxxxxxxxxx';
    lic.Dep_Code__c = 'a6Oxxxxxxxxxxx';
    insert lic;

    //Start Test & create child object
    test.startTest();

    Order_Assignment__c asgn = new Order_Assignment__c();


    //Relate Child to the Parent from the inserted record above
    asgn.Order_Request__c = lic.Id;
    asgn.Dep_Code__c = lic.Default_Code__c;

    //Insert Child Record
    insert asgn;

    try {
    delete lic;
        } catch (Exception e) {
           system.assertEquals('You cannot delete this record!', e.getMessage());
          }
   //Stop Test
   test.stopTest();
}  
}


How to reduce the gap between two images in page

need to reduced the gap between two images and need to show the images parallely.

Thanks & Regards,
Ashish Agrawal
Hello All!

I'm trying to inset (upsert) a list of events into my salesforce, but the field ISALLDAYEVENT is not showing up on my list of fields to map.
Am I missing something? Some configuration in my Data Loader?  
Any ideas?!

Thanks.
ACB

Is it possible to show date month and time in dropdown format... if yes how to do that??????????

 

 

 

Hi

 

i have scenerio to which i am stuck up with. I need help with it.

 

I created a vf page render as pdf type which have two buttons on top SAVE and SAVE&EMAIL. On click of SAVE&EMAIL  it will save as attachment of notesandattachment of some specific object  and also will redirect to send email page of Activity and this vf page(pdf type) should be attached as an attachment of it automatically. So that we dont need to attach file manually and can send it as attachment of email by just hitting the send email button.

 

I am able to attach it to Notes and attachments but i am stuck up with 2nd scenerio. I need help with it. What should be the approch.

 

Thanks 

Ishan Sharma

 

 

trigger code for send one object  record details to another object?

 

Send Some Sample codes

Hello.
I have been looking at an unusual situation.

I have a visualforce page with some inputtextareas with a style. When loading the page, it works fine as in getting the values from the controller. When the user changes this values on the page and submits the form, the values are not being set!

The unusual thing is that when I remove the class from the inputtextarea, it works perfectly, but if I keep the class not so much.

Here is an example of a textarea input and the Css code:

 

<!-- Input textarea --> 
<div class="title-form text-bold">Title:</div>
<apex:inputtextarea styleClass="input-textarea" id="msg6" value="{!button.Message_title__c}" rows="2" cols="100"/>

 

When the form is submited I have a script that verifies if the input is not empty.

If someone could help me find a workaround for this I would be very thankful.

Best Regards,
ACB