-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
11Questions
-
8Replies
Hi...Can any one help me how to do this?
I rendered one pdf page. In that pdf page attachment file is there. I have 4 or 5 attachments. First attachment will be display as an image( like thumb nail) and remaing attachments will be display as an links.
-
- nandana
- April 13, 2017
- Like
- 0
- Continue reading or reply
Could you please tell me how to do this.
I have 3 incident types like A,B,C. Incident type A only having incident description field. And incident type B and incident type C having no incident description field. So if i choose incident type A then incident description div tag it should be display in pdf page. If i choose incident type B or incident type C then incident description div tag it shouldn't be display in pdf page(hide that div tag).
-
- nandana
- April 08, 2017
- Like
- 0
- Continue reading or reply
Hi... can any one tell me. How to write test class of this code.
public class Testcontroller{
public string getsname(){
return 'raj';
}
public string Tname{get; set;}
public Account acc{get; set;}
public Testcontroller(){
Tname = 'ram';
acc = new Account();
acc = [select id,name,phone from account where name='adf'];
changeTname();
}
public void changeTname(){
if(Tname=='hai'){
Tname = label.namet;
}
else{
Tname = label.label_val;
}
}
public void accsave(){
if(acc!=null){
upsert acc;
}
}
public pageReference googlepage(){
//agereference p = new pagereference('/001/o');
//pagereference p = new pagereference('/apex/Testpage1');
pagereference p = page.Testpage1;
p.getParameters().put('id', acc.id);
p.getParameters().put('testb', 'fdsgs');
p.setRedirect(true);
return p;
}
}
public string getsname(){
return 'raj';
}
public string Tname{get; set;}
public Account acc{get; set;}
public Testcontroller(){
Tname = 'ram';
acc = new Account();
acc = [select id,name,phone from account where name='adf'];
changeTname();
}
public void changeTname(){
if(Tname=='hai'){
Tname = label.namet;
}
else{
Tname = label.label_val;
}
}
public void accsave(){
if(acc!=null){
upsert acc;
}
}
public pageReference googlepage(){
//agereference p = new pagereference('/001/o');
//pagereference p = new pagereference('/apex/Testpage1');
pagereference p = page.Testpage1;
p.getParameters().put('id', acc.id);
p.getParameters().put('testb', 'fdsgs');
p.setRedirect(true);
return p;
}
}
-
- nandana
- January 04, 2017
- Like
- 0
- Continue reading or reply
-
- nandana
- December 26, 2016
- Like
- 0
- Continue reading or reply
Could you please tell me how to do this.
I have 3 incident types like A,B,C. Incident type A only having incident description field. And incident type B and incident type C having no incident description field. So if i choose incident type A then incident description div tag it should be display in pdf page. If i choose incident type B or incident type C then incident description div tag it shouldn't be display in pdf page(hide that div tag).
- nandana
- April 08, 2017
- Like
- 0
- Continue reading or reply
Hi... can any one tell me. How to write test class of this code.
public class Testcontroller{
public string getsname(){
return 'raj';
}
public string Tname{get; set;}
public Account acc{get; set;}
public Testcontroller(){
Tname = 'ram';
acc = new Account();
acc = [select id,name,phone from account where name='adf'];
changeTname();
}
public void changeTname(){
if(Tname=='hai'){
Tname = label.namet;
}
else{
Tname = label.label_val;
}
}
public void accsave(){
if(acc!=null){
upsert acc;
}
}
public pageReference googlepage(){
//agereference p = new pagereference('/001/o');
//pagereference p = new pagereference('/apex/Testpage1');
pagereference p = page.Testpage1;
p.getParameters().put('id', acc.id);
p.getParameters().put('testb', 'fdsgs');
p.setRedirect(true);
return p;
}
}
public string getsname(){
return 'raj';
}
public string Tname{get; set;}
public Account acc{get; set;}
public Testcontroller(){
Tname = 'ram';
acc = new Account();
acc = [select id,name,phone from account where name='adf'];
changeTname();
}
public void changeTname(){
if(Tname=='hai'){
Tname = label.namet;
}
else{
Tname = label.label_val;
}
}
public void accsave(){
if(acc!=null){
upsert acc;
}
}
public pageReference googlepage(){
//agereference p = new pagereference('/001/o');
//pagereference p = new pagereference('/apex/Testpage1');
pagereference p = page.Testpage1;
p.getParameters().put('id', acc.id);
p.getParameters().put('testb', 'fdsgs');
p.setRedirect(true);
return p;
}
}
- nandana
- January 04, 2017
- Like
- 0
- Continue reading or reply
How do I test for an exception('addError') in a class?
Hi everyone,
I have to test this class:
List<Account> oldAccounts = Trigger.old;
for(Account check : oldAccounts){
if(check.Account_ID__c!=null){
check.addError('Accounts that have SAP Account ID can not be deleted');
}
}
I know that in theese cases one has to use try/catch methods to solve the test.
But I've been trying for hours and I don't know how to solve it.
I post what I did so far, it covers everything except last line ('addError'):
@isTest
public class TriggerAccountDeleteTest {
public class MyException extends Exception {}
static testMethod void metodoDeletAccount(){
//Create an Account with his required fields
Account accountPrueba = new Account();
accountPrueba.Name = 'Siemens2';
accountPrueba.Account_Country__c = 'a014E000005XNKh';
accountPrueba.Language__c = 'a064E0000060Wnr';
accountPrueba.Department__c = 'Services';
//Insert it
insert accountPrueba ;
//Test.startTest();
try{
delete accountPrueba;
Account deletedAccount = [SELECT Id, IsDeleted FROM Account WHERE Id = :accountPrueba.Id ALL ROWS];
System.assertEquals(deletedAccount.IsDeleted, true);
}
catch(Exception e){
Boolean b = null;
accountPrueba2.Account_ID__c = String.valueOf(b);
System.assert(e.getMessage().contains('Accounts that have SAP Account ID can not be deleted'));
}
Test.stopTest();
}
}
Thank you for your time
Cheers,
Alberto
I have to test this class:
List<Account> oldAccounts = Trigger.old;
for(Account check : oldAccounts){
if(check.Account_ID__c!=null){
check.addError('Accounts that have SAP Account ID can not be deleted');
}
}
I know that in theese cases one has to use try/catch methods to solve the test.
But I've been trying for hours and I don't know how to solve it.
I post what I did so far, it covers everything except last line ('addError'):
@isTest
public class TriggerAccountDeleteTest {
public class MyException extends Exception {}
static testMethod void metodoDeletAccount(){
//Create an Account with his required fields
Account accountPrueba = new Account();
accountPrueba.Name = 'Siemens2';
accountPrueba.Account_Country__c = 'a014E000005XNKh';
accountPrueba.Language__c = 'a064E0000060Wnr';
accountPrueba.Department__c = 'Services';
//Insert it
insert accountPrueba ;
//Test.startTest();
try{
delete accountPrueba;
Account deletedAccount = [SELECT Id, IsDeleted FROM Account WHERE Id = :accountPrueba.Id ALL ROWS];
System.assertEquals(deletedAccount.IsDeleted, true);
}
catch(Exception e){
Boolean b = null;
accountPrueba2.Account_ID__c = String.valueOf(b);
System.assert(e.getMessage().contains('Accounts that have SAP Account ID can not be deleted'));
}
Test.stopTest();
}
}
Thank you for your time
Cheers,
Alberto
- AlbertoSM
- January 03, 2017
- Like
- 0
- Continue reading or reply
- nandana
- December 26, 2016
- Like
- 0
- Continue reading or reply