• Adrian Gawryszewski
  • NEWBIE
  • 220 Points
  • Member since 2015
  • PwC

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 53
    Replies
Hi,

I'm trying to deploy an change set to my org, but is saying my trigger has a code coverage of 0%, but i already created a teste class and the code covergare doesn't update! I'v already tried everything i know. Here's the code:

P.S.: The API names are in portuguese, but i think i doesn't matter because i need to know why the trigger is not been activaded

Trigger:
 
trigger triggerMembroDisparo on MembroDisparo__c (before insert, before update, before delete) {

	if(Trigger.isBefore) {
		if(Trigger.isInsert) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.new);
		}

		if(Trigger.isUpdate) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.new);
		}

		if(Trigger.isDelete) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.old);
		}
	}
}

and here's the test class, where i'm inserting new records in the object:
 
@isTest
private class triggerMembroDisparoTest {
	
	@isTest 
	static void testaTrigger()
	{
		try 
		{
		  
			AgrupamentoCampanhas__c agrupamentoPai;
			AgrupamentoCampanhas__c agrupamentoFilho;
			Campanha__c campanhaConceito;
			Campanha__c campanhaPadrao;
			Map<String, RecordType> mapRecordTypeCampanha;
			DisparoEfetuado__c disparoEfetuado;
			List<MembroDisparo__c> lstMembrosDisparo;

			mapRecordTypeCampanha = RecordTypeDAO.getInstance().getRecordTypeBySobjectType('Campanha__c');

			agrupamentoPai = new AgrupamentoCampanhas__c();
			agrupamentoPai.Name = 'Agrupamento Pai';
			insert agrupamentoPai;

			agrupamentoFilho = new AgrupamentoCampanhas__c();
			agrupamentoFilho.Name = 'Agrupamento Filho';
			agrupamentoFilho.NomeAgrupamentoPai__c = agrupamentoPai.Id;
			insert agrupamentoFilho;

			PecaPublicitaria__c pecaPublicitaria = new PecaPublicitaria__c();
			pecaPublicitaria = InstanciaSObjectsForClassCoverage.getPecaPublicitaria();
			pecaPublicitaria.Segmento__c = 'Azul';
			insert pecaPublicitaria;

			campanhaConceito = new Campanha__c();
			campanhaConceito.RecordTypeId = mapRecordTypeCampanha.get('Conceito').Id;
			campanhaConceito.AgrupamentoCampanha__c = agrupamentoFilho.Id;
			campanhaConceito.PecaPublicitaria__c = pecaPublicitaria.Id;
			campanhaConceito.Segmento__c = 'Azul';
			campanhaConceito.DisponibilizarPortal__c = false;
			insert campanhaConceito;

			campanhaPadrao = new Campanha__c();
			campanhaPadrao.RecordTypeId = mapRecordTypeCampanha.get('Padrao').Id;
			campanhaPadrao.CampanhaConceito__c = campanhaConceito.Id;
			campanhaPadrao.PecaPublicitaria__c = pecaPublicitaria.Id;
			campanhaPadrao.Segmento__c = 'Azul';
			campanhaConceito.DisponibilizarPortal__c = false;
			insert campanhaPadrao;

			disparoEfetuado = new DisparoEfetuado__c();
			disparoEfetuado.Campanha__c = campanhaPadrao.Id;
		

			insert disparoEfetuado;

			lstMembrosDisparo = new List<MembroDisparo__c>();
			for(Integer i=0; i<5; i++) {
				MembroDisparo__c membroDisparo = new MembroDisparo__c();
				membroDisparo.Campanha__c = campanhaPadrao.Id;
				membroDisparo.DisparoEfetuado__c = disparoEfetuado.Id;
				membroDisparo.DataAbertura__c = System.today();
				membroDisparo.DataEnvio__c = System.today();
				membroDisparo.QuantidadeCliques__c = 1;

				lstMembrosDisparo.add(membroDisparo);
			}

			insert lstMembrosDisparo;
            
            MembroDisparo__c updateMembroDisparo;
            updateMembroDisparo = [SELECT QuantidadeCliques__c FROM MembroDisparo__c WHERE DataEnvio__c = :System.today()];
            updateMembroDisparo.QuantidadeCliques__c = 2;
            update updateMembroDisparo;
            
            


		} catch(Exception e) 
		{
		  System.debug(e.getMessage());
		}

	}
}

can someone help me please?
Hi All, 
question when I query TaskRelation table it comes back with a TaskId column ( for exapmle 00TU000000Sp000000). When I take this ID and paste it into URL it takes me dorectly into the Task, all look good. 
But now I try to query Task table (SELECT Id,OwnerId,Status,Subject FROM Task WHERE Id = '00TU000000Sp000000') it comes back empty: 
"Sorry, no records returned."
How is this possible? 
Please help. 
Apart from providing Sweatshirt for those who earned 5 badges are you providing any other gifts which are shown in the picture like Camera ,bottle ,etc.
If so how many badges should we earn 
 
The challenge (aka "Hello Kitty"):
Upload a specified zip file as a static resource. The zip will have directories with images and you have to display a specific image on a Visualforce page.The page must be named 'ShowImage'.
This file must be uploaded as a Static Resource named 'vfimagetest'.
The page must have a Visualforce apex:image tag that displays the 'kitten1.jpg' image from the 'cats' directory of the static resource.


I have uploaded vfimagetest and made it public. I unzipped the file (maybe my first mistake) and can see the kitten1.jpg file. My code is:
<apex:page>
  <apex:image url="{!URLFOR($Resource.vfimagetest,'images/kitten1.jpg')}" width="50" height="50"/>
  </apex:page> 
The code saves; however, I cannot see the file. I know that I am missing something simple. If someone can assist, I can start my self flogging in earnest. Thanks. 
Struggling with how to make an update to a date field on the Contact object when a related child object is edited and meets specific conditions. Here are the details...
Custom object Requests has a lookup field back to Contact object. A single Contact can be related to MANY requests. When a Request record is edited to meet specific values (status=Complete, etc) have a working Process that fires and distributes an email alert whihc is a suvey Invitation. At that time, I also need to update the related Contact record field, Last Survey Invite Date, with the current date.  I assume  many- to-one relationship of Requests to Contacts is why Process builder, workflow or anything else doesn't give me access to the Contact field to update.  I suspect this will require a trigger and corresponding apex class to make happen, but that's above my skill set.  Great at declarative development, but not at coding.  Any suggestions/corrections/clarifications would be appreciated.  Thanks!     
  • January 27, 2016
  • Like
  • 0
I'm trying to delete few classes from Production environment. 
At first I tried to delete these without the help of Eclipse Force.com IDE and deleted those classes directly from sandbox env.

However, I still see those classes in Production. So I installed Eclipse and Force.com IDE and trying to mark the class "Deleted" in xml and deploy them. The problem is I can't find these classes in Sandbox at all as I deleted from website directly.

Any idea how to deal with this situation?
Hi,

I'm trying to deploy an change set to my org, but is saying my trigger has a code coverage of 0%, but i already created a teste class and the code covergare doesn't update! I'v already tried everything i know. Here's the code:

P.S.: The API names are in portuguese, but i think i doesn't matter because i need to know why the trigger is not been activaded

Trigger:
 
trigger triggerMembroDisparo on MembroDisparo__c (before insert, before update, before delete) {

	if(Trigger.isBefore) {
		if(Trigger.isInsert) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.new);
		}

		if(Trigger.isUpdate) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.new);
		}

		if(Trigger.isDelete) {
			Campanhas_MembroDisparoBO.getInstance().calcularTotalHierarquia(Trigger.old);
		}
	}
}

and here's the test class, where i'm inserting new records in the object:
 
@isTest
private class triggerMembroDisparoTest {
	
	@isTest 
	static void testaTrigger()
	{
		try 
		{
		  
			AgrupamentoCampanhas__c agrupamentoPai;
			AgrupamentoCampanhas__c agrupamentoFilho;
			Campanha__c campanhaConceito;
			Campanha__c campanhaPadrao;
			Map<String, RecordType> mapRecordTypeCampanha;
			DisparoEfetuado__c disparoEfetuado;
			List<MembroDisparo__c> lstMembrosDisparo;

			mapRecordTypeCampanha = RecordTypeDAO.getInstance().getRecordTypeBySobjectType('Campanha__c');

			agrupamentoPai = new AgrupamentoCampanhas__c();
			agrupamentoPai.Name = 'Agrupamento Pai';
			insert agrupamentoPai;

			agrupamentoFilho = new AgrupamentoCampanhas__c();
			agrupamentoFilho.Name = 'Agrupamento Filho';
			agrupamentoFilho.NomeAgrupamentoPai__c = agrupamentoPai.Id;
			insert agrupamentoFilho;

			PecaPublicitaria__c pecaPublicitaria = new PecaPublicitaria__c();
			pecaPublicitaria = InstanciaSObjectsForClassCoverage.getPecaPublicitaria();
			pecaPublicitaria.Segmento__c = 'Azul';
			insert pecaPublicitaria;

			campanhaConceito = new Campanha__c();
			campanhaConceito.RecordTypeId = mapRecordTypeCampanha.get('Conceito').Id;
			campanhaConceito.AgrupamentoCampanha__c = agrupamentoFilho.Id;
			campanhaConceito.PecaPublicitaria__c = pecaPublicitaria.Id;
			campanhaConceito.Segmento__c = 'Azul';
			campanhaConceito.DisponibilizarPortal__c = false;
			insert campanhaConceito;

			campanhaPadrao = new Campanha__c();
			campanhaPadrao.RecordTypeId = mapRecordTypeCampanha.get('Padrao').Id;
			campanhaPadrao.CampanhaConceito__c = campanhaConceito.Id;
			campanhaPadrao.PecaPublicitaria__c = pecaPublicitaria.Id;
			campanhaPadrao.Segmento__c = 'Azul';
			campanhaConceito.DisponibilizarPortal__c = false;
			insert campanhaPadrao;

			disparoEfetuado = new DisparoEfetuado__c();
			disparoEfetuado.Campanha__c = campanhaPadrao.Id;
		

			insert disparoEfetuado;

			lstMembrosDisparo = new List<MembroDisparo__c>();
			for(Integer i=0; i<5; i++) {
				MembroDisparo__c membroDisparo = new MembroDisparo__c();
				membroDisparo.Campanha__c = campanhaPadrao.Id;
				membroDisparo.DisparoEfetuado__c = disparoEfetuado.Id;
				membroDisparo.DataAbertura__c = System.today();
				membroDisparo.DataEnvio__c = System.today();
				membroDisparo.QuantidadeCliques__c = 1;

				lstMembrosDisparo.add(membroDisparo);
			}

			insert lstMembrosDisparo;
            
            MembroDisparo__c updateMembroDisparo;
            updateMembroDisparo = [SELECT QuantidadeCliques__c FROM MembroDisparo__c WHERE DataEnvio__c = :System.today()];
            updateMembroDisparo.QuantidadeCliques__c = 2;
            update updateMembroDisparo;
            
            


		} catch(Exception e) 
		{
		  System.debug(e.getMessage());
		}

	}
}

can someone help me please?
My production system is at 75% and I'm trying to deploy a trigger. It's 100% covered. The deployment fails saying code coverage is 74%.

I'm wondering how the code coverage decreased when I'm testing all the lines I'm trying to push from Sandbox. 

Any pointers?
Is there any way to cutomize classic visualforce page to look like lightning VF page (without to switching to lightning)? 

My requirement is to build a new VF page that is about to be used in salesforce classic but the styling should be like lightning.

 
I am using ANT tool to reterive and deploy my org data.
I had reterived the data and when i try to deploy the data back to same org( same version )
I am getting error :
leadSharingRules/Lead.sharingRules -- Error: Not available for deploy for this API version.

i checked the tool version and my version are same.
What am i missing?
please guide me.

thank you
Hi All, 
question when I query TaskRelation table it comes back with a TaskId column ( for exapmle 00TU000000Sp000000). When I take this ID and paste it into URL it takes me dorectly into the Task, all look good. 
But now I try to query Task table (SELECT Id,OwnerId,Status,Subject FROM Task WHERE Id = '00TU000000Sp000000') it comes back empty: 
"Sorry, no records returned."
How is this possible? 
Please help. 
i wrote the code but not work out can help me find the error in this
===================================================
public class outboardmessages {
    public account acc{set;get;}
    public void outbourdmessages(){
       Messaging.SingleEmailMessage email1 = new messaging.SingleEmailMessage();
            string[] ad =new string[]{bethasrinivasareddy@gmail.com};
         string[] ad2 =new string[]{sandeepambati4512@gmail.com};
         email1.setToAddresses(ad);
        email1.setCcAddresses(ad2);
        email1.setsubject('my first email');
        email1.setPlainTextBody('how are you srinu');
        messaging.Email email2 = new messaging.Email{email1};
            messaging.sendEmail(email2);
      
       
    }

}
 
Hi. I'm trying to get a image to display on a Visualforce page. I have added a Static Resource, and can get it to display if I cite its name directly, but if I try to reference it using a variable, I either get an error in compilation, or a small 'dummy' image like it can't find the one I've specified.

The code that works find is as follows:

<apex:page standardController="Account">
  <apex:variable var="imageVar" value="MMC_Logo"/>
  <p>Resource name {!imageVar}</p>
<apex:image url="{!$Resource.MMC_Logo}"/>
</apex:page>

However, if I add a penultimate line of 

<apex:image url="{!$Resource.(imageVar)"/>

I get the small 'dummy' image displayed.
Surely this is just a minor syntaxical error, but nothing I have tried will work! Can someone point me in the right direction? 
Thanks..
Hello, 

For a lookup relationship, is it possibel to have a control over the child depennding on the parent ?

thanks
  • February 23, 2016
  • Like
  • 0
Hello,

In the related list of contacts i have "Notes & Attachments" but i dont find this in objects or i dont find any relationship between two objects.
I have duplicated teh contact object, hence i also wanted to duplicate teh relationship.

Thank youf for suggestion !
  • February 23, 2016
  • Like
  • 0
Hi,
I need to insert some records through excel. I have a VF page where i upload the excel file and create records for my custom object. i have a custom field which has Datetime stored. So when i tried to upload the excel with datetime in VF it is going to exception loop. It is not creating records.
This is my class method. 
public void importCSVFile(){
           try{
               csvAsString = csvFileBody.toString();
               csvFileLines = csvAsString.split('\n'); 
               inputvalues = new String[]{};
               for(string st:csvfilelines[0].split(','))
               fieldList.add(st);  
                
               for(Integer i=1;i<csvFileLines.size();i++){
                   AgendaTopics__c accObj = new AgendaTopics__c();
                   string[] csvRecordData = csvFileLines[i].split(',');
                   Datetime dt = Datetime.valueOf(csvRecordData[0]);
                   accObj.Time__c = dt;
                   accObj.Estimated_Duration_minutes__c = Decimal.valueOf(csvRecordData[1]);
                   accObj.Topic_Name__c = csvRecordData[2];    
                   accObj.Owner__c = String.valueOf(csvRecordData[3]);                                                                           
                   acclist.add(accObj);  
               }
}
            catch (Exception e)
            {
                ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
                ApexPages.addMessage(errorMessage);
            }

Thanks
Vivek
 
My scenario : I am having custom object called Module__c, where users can able to type module names/name in a multiline textbox and that module should be assigned to users/user(standard user object users).

for example :                  Module Name                                                                User
                                     Account Management                                                 
                                                                                                                        Username
                                     Asset Management

for the above example both Account and Asset management Modules this username is assigned( Many To One i.e, N : 1). Likewise for single Module Many users can assign. How can I achieve this functionalities. Any link, suggestions, idea, code snippet is helpful.

Thanks