• Anju Alexander 8
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies
Hi All,

Is there anyway to know that HARD DELETE has happened? I don't want the data that has been hard deleted....I only want to know that hard delete has happened or not?

Please help ......

Thanks,
Anju
Hi All,

I have a doubt. Suppose I am inserting 10 records of a custom object at exactly at the same time, (say at 2015-11-16T11:19:31.000Z) and I have a trigger on this object on insert. Is there a chance that since I am inserting the 10 records at the same time, the trigger won't work for some record and the trigger will work for only some records out of this 10 records?

Thanks,
Anju
Hi All,

Is there any app in salesforce to send voice messages ?

Thanks,
Anju
Hi All,

Is is possible to get the messages from whatsapp to Salesforce? Please reply...

Thanks and Regards,
Anju Alex
Hi All,

I am using opportunity object and order object(custom object) which is the child of Opportunity. If one user with one profile is uploading an attachment in order object, another user with another profile is not able to see the attachments. I have made the private value of attachment as false only. I don't want to give View All Data permission to the users. Is there any other way to make the attachments visible to other users. Please help.

Thanks
Hi All,

I have Opportunity and Attachment. Now if i am attaching any document with name OPF, the checkbox,OPF_Uploaded__c gets checked. I have written a trigger on Opportunity, for Automated Approval Process with condition that if( OPF_Uploaded__c ==true), then submit for Approval Process. Now this trigger is working.

I have also written a trigger upon Opportunity(after update). If after the uploading of Attachment with name, OPF(now the OPF_Uploaded__c in opportunity gets checked) and after this if I am updating this Opportunity Record and unchecking the OPF_Uploaded__c , the attachment with name,OPF gets deleted using this trigger.

Now the problem is that I have written test class for this trigger. In the test class after insertion, the record is going for Approval Process...So the deletion is not happening...and my trigger is not getting covered?

Below is my trigger code.....
trigger deleteOpportunityDoc on Opportunity(after update) {
deleteOpportunityDocHandler handler=new deleteOpportunityDocHandler();

/*if(Trigger.isDelete)
 {
 handler.AfterDelete(trigger.old);
 }*/
 
 /*if(Trigger.isInsert)
 {
 handler.AfterInsert(trigger.new);
 }*/
 
 if(Trigger.isUpdate)
 {
 handler.AfterUpdate(trigger.new);
 }
 /*if(Trigger.isUndelete)
 {
 handler.AfterUndelete(trigger.new);
 }
 */
 
}
Handler class:

public class deleteOpportunityDocHandler
{
public void AfterUpdate(Opportunity[] newObjects)

{
Set<Id> oppIdOPF=new Set<Id>();
    Set<Id> oppIdPO=new Set<Id>();
    Set<Id> oppIdQuote=new Set<Id>();
    Set<Id> oppIdWS=new Set<Id>();    
    List<Attachment> attachOPF = new List<Attachment>();
    List<Attachment> attachPO = new List<Attachment>();
    List<Attachment> attachQuote = new List<Attachment>();
    List<Attachment> attachWS = new List<Attachment>();
for(Opportunity opp:newObjects)   
{
if(opp.OPF_Uploaded__c==false)
{
  oppIdOPF.add(opp.id);
}
}
attachOPF=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdOPF and name LIKE '%OPF%'];
if(attachOPF.size() > 0){
delete attachOPF;
}

for(Opportunity opp:newObjects)   
{
if(opp.PO_Uploaded__c==false)
{
  oppIdPO.add(opp.id);
}
}
attachPO=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdPO and name LIKE '%PO%'];
if(attachPO.size() > 0){
delete attachPO;
}


for(Opportunity opp:newObjects)   
{
if(opp.Quote_Uploaded__c==false)
{
  oppIdQuote.add(opp.id);
}
}
attachQuote=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdQuote and name LIKE '%Quote%'];
if(attachQuote.size() > 0){
delete attachQuote;
}


for(Opportunity opp:newObjects)   
{
if(opp.Working_Sheet_Uploaded__c==false)
{
  oppIdWS.add(opp.id);
}
}
attachWS=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdWS and name LIKE '%Working%'];
if(attachWS.size() > 0){
delete attachWS;
}


}
}

My test class:

@isTest(SeeAllData=false)
public with sharing class Test_deleteOpportunityDoc {

   static testMethod void myTestMethod() {
    Account ac = new Account();
    ac.name='Test';
    Date myDate = date.newInstance(2012,05,22);
    ac.Date_of_Enquiry__c=myDate;
    ac.E_Mail_ID__c='anju@gmail.com';
       
     insert ac;
       
    Opportunity  oppo=new Opportunity();
    oppo.AccountId=ac.id;
    oppo.name='Test';
    Date myDate1 = date.newInstance(2012,05,22);
    oppo.CloseDate=myDate1;
    oppo.StageName='Prospecting';
    oppo.OPF_Uploaded__c=false; 
    oppo.PO_Uploaded__c=false;
    oppo.Quote_Uploaded__c=false;
    oppo.Working_Sheet_Uploaded__c=false;  
 
       try {
            insert oppo;  
        }
         Catch(DMLException e) {
             system.assertEquals('Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process: []', e.getMessage());
         }  
   
       
    
    Attachment att=new Attachment();
    Blob b = Blob.valueOf('Test Data');  
    att.Name='OPF';
    att.parentid=oppo.id;

    att.body=b;
    insert att;  
       
       Attachment att1=new Attachment();
    Blob b1 = Blob.valueOf('Test Data');  
    att1.Name='OPF';
    att1.parentid=oppo.id;
    att1.body=b1;
    insert att1;
    
    Attachment att2=new Attachment();
    Blob b2 = Blob.valueOf('Test Data');  
    att2.Name='OPF';
    att2.parentid=oppo.id;
    att2.body=b2;
    insert att2;
       
    Attachment att3=new Attachment();
    Blob b3 = Blob.valueOf('Test Data');  
    att3.Name='OPF';
    att3.parentid=oppo.id;
    att3.body=b3;
    insert att3;     
      oppo.OPF_Uploaded__c=false;
      oppo.PO_Uploaded__c=false;
      oppo.Quote_Uploaded__c=false;
      oppo.Working_Sheet_Uploaded__c=false; 
    update oppo; 
    
   }
}
Please help....what to do to cover delete statement
 
Hi All,

I am using Account(Person Account) object and one custom object Recurring Donations. Recurring Donations have a lookup relationship to Account. Now I am sending an email  whenever a donation record is newly created through trigger and I am getting the email address from Account Object  In the email I am using html template from email templates.( I am using html template since i am using images inside the email ). Now if I am using template I need to give targetObjectId. So I gave targetObjectId as accountId. When I give targetObjectId as accountId it is giving error as -You can give only lead,contact and user as targetObjectId. I am not using Contact Object. So guys please help me to find a solution for sending email using Account's email...I can only use email from Account object Below....Please Help

Thanks,
Anju Alexander

 
trigger sendMail on npe03__Recurring_Donation__c (before insert) {
 
Set<id> Ids = new Set<id>();
  
  for(npe03__Recurring_Donation__c donation : trigger.new)
  {
  if(donation.npe03__Organization__c!=null) //npe03__Organization__c is the accountId in recurring donations
  {  
  Ids.add(donation.npe03__Organization__c);
  System.debug('****'+donation.npe03__Organization__c);
  }
  /*catch (NullPointerException e) 
  {
  donation.addError(e);
  }*/
   
  }  
  
  
  // Step 0: Create a master list to hold the emails we'll send
  List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
  
  List<Account> accnt = new List<Account>();
  for(Account acc : [SELECT id,name,PersonEmail,FirstName from Account where id IN:Ids])
  {
  accnt.add(acc);
  }
    
   for(Account acnt : accnt) {
    if (acnt.PersonEmail != null && acnt.FirstName != null) {
      // Step 1: Create a new Email
      Messaging.SingleEmailMessage mail =   new Messaging.SingleEmailMessage();
    
      // Step 2: Set list of people who should get the email
      List<String> sendTo = new List<String>();
      sendTo.add(acnt.PersonEmail );
      mail.setToAddresses(sendTo);
      mail.setTargetObjectId(acnt.Id);
      
    for(OrgWideEmailAddress owa: [SELECT ID,DisplayName,Address FROM OrgWideEmailAddress])
  {
       mail.setOrgWideEmailAddressId(owa.id);
   
     }   
    
    EmailTemplate templateId = [Select id from EmailTemplate where DeveloperName= 'Recurring_Donation'];
    mail.setTemplateID(templateId.id); 
    mails.add(mail);
    }
  }
  Messaging.sendEmail(mails);
  }

 
Hi All,

I have two record types 1)Individual Record Type and 2)Institutional Record Type in Contacts which are both active. For Both record types, records are created. Now when Reports are created only records with Individual Record Type are coming in the report type.Institutional are not shown.
After that, I have tried giving the filter criteria as
1) Contact Record Type equals Institutional
Then it is showing as 0 records.
Guys.....Please help....Its important.

Thanks,
Anju Alex
Hi All,

I am using EchoSign and I wanted to merge standard fields into the word document. The word document is my attachment. The values are not getting merged.
How to merge fields to the word document. Please help.

Thanks
Hi All,

Is is possible to get the messages from whatsapp to Salesforce? Please reply...

Thanks and Regards,
Anju Alex
Hi All,

I have Opportunity and Attachment. Now if i am attaching any document with name OPF, the checkbox,OPF_Uploaded__c gets checked. I have written a trigger on Opportunity, for Automated Approval Process with condition that if( OPF_Uploaded__c ==true), then submit for Approval Process. Now this trigger is working.

I have also written a trigger upon Opportunity(after update). If after the uploading of Attachment with name, OPF(now the OPF_Uploaded__c in opportunity gets checked) and after this if I am updating this Opportunity Record and unchecking the OPF_Uploaded__c , the attachment with name,OPF gets deleted using this trigger.

Now the problem is that I have written test class for this trigger. In the test class after insertion, the record is going for Approval Process...So the deletion is not happening...and my trigger is not getting covered?

Below is my trigger code.....
trigger deleteOpportunityDoc on Opportunity(after update) {
deleteOpportunityDocHandler handler=new deleteOpportunityDocHandler();

/*if(Trigger.isDelete)
 {
 handler.AfterDelete(trigger.old);
 }*/
 
 /*if(Trigger.isInsert)
 {
 handler.AfterInsert(trigger.new);
 }*/
 
 if(Trigger.isUpdate)
 {
 handler.AfterUpdate(trigger.new);
 }
 /*if(Trigger.isUndelete)
 {
 handler.AfterUndelete(trigger.new);
 }
 */
 
}
Handler class:

public class deleteOpportunityDocHandler
{
public void AfterUpdate(Opportunity[] newObjects)

{
Set<Id> oppIdOPF=new Set<Id>();
    Set<Id> oppIdPO=new Set<Id>();
    Set<Id> oppIdQuote=new Set<Id>();
    Set<Id> oppIdWS=new Set<Id>();    
    List<Attachment> attachOPF = new List<Attachment>();
    List<Attachment> attachPO = new List<Attachment>();
    List<Attachment> attachQuote = new List<Attachment>();
    List<Attachment> attachWS = new List<Attachment>();
for(Opportunity opp:newObjects)   
{
if(opp.OPF_Uploaded__c==false)
{
  oppIdOPF.add(opp.id);
}
}
attachOPF=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdOPF and name LIKE '%OPF%'];
if(attachOPF.size() > 0){
delete attachOPF;
}

for(Opportunity opp:newObjects)   
{
if(opp.PO_Uploaded__c==false)
{
  oppIdPO.add(opp.id);
}
}
attachPO=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdPO and name LIKE '%PO%'];
if(attachPO.size() > 0){
delete attachPO;
}


for(Opportunity opp:newObjects)   
{
if(opp.Quote_Uploaded__c==false)
{
  oppIdQuote.add(opp.id);
}
}
attachQuote=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdQuote and name LIKE '%Quote%'];
if(attachQuote.size() > 0){
delete attachQuote;
}


for(Opportunity opp:newObjects)   
{
if(opp.Working_Sheet_Uploaded__c==false)
{
  oppIdWS.add(opp.id);
}
}
attachWS=[SELECT id,parentid,name FROM attachment where parentId IN:oppIdWS and name LIKE '%Working%'];
if(attachWS.size() > 0){
delete attachWS;
}


}
}

My test class:

@isTest(SeeAllData=false)
public with sharing class Test_deleteOpportunityDoc {

   static testMethod void myTestMethod() {
    Account ac = new Account();
    ac.name='Test';
    Date myDate = date.newInstance(2012,05,22);
    ac.Date_of_Enquiry__c=myDate;
    ac.E_Mail_ID__c='anju@gmail.com';
       
     insert ac;
       
    Opportunity  oppo=new Opportunity();
    oppo.AccountId=ac.id;
    oppo.name='Test';
    Date myDate1 = date.newInstance(2012,05,22);
    oppo.CloseDate=myDate1;
    oppo.StageName='Prospecting';
    oppo.OPF_Uploaded__c=false; 
    oppo.PO_Uploaded__c=false;
    oppo.Quote_Uploaded__c=false;
    oppo.Working_Sheet_Uploaded__c=false;  
 
       try {
            insert oppo;  
        }
         Catch(DMLException e) {
             system.assertEquals('Process failed. First exception on row 0; first error: ALREADY_IN_PROCESS, Cannot submit object already in process: []', e.getMessage());
         }  
   
       
    
    Attachment att=new Attachment();
    Blob b = Blob.valueOf('Test Data');  
    att.Name='OPF';
    att.parentid=oppo.id;

    att.body=b;
    insert att;  
       
       Attachment att1=new Attachment();
    Blob b1 = Blob.valueOf('Test Data');  
    att1.Name='OPF';
    att1.parentid=oppo.id;
    att1.body=b1;
    insert att1;
    
    Attachment att2=new Attachment();
    Blob b2 = Blob.valueOf('Test Data');  
    att2.Name='OPF';
    att2.parentid=oppo.id;
    att2.body=b2;
    insert att2;
       
    Attachment att3=new Attachment();
    Blob b3 = Blob.valueOf('Test Data');  
    att3.Name='OPF';
    att3.parentid=oppo.id;
    att3.body=b3;
    insert att3;     
      oppo.OPF_Uploaded__c=false;
      oppo.PO_Uploaded__c=false;
      oppo.Quote_Uploaded__c=false;
      oppo.Working_Sheet_Uploaded__c=false; 
    update oppo; 
    
   }
}
Please help....what to do to cover delete statement
 
Hi All,

I am using Account(Person Account) object and one custom object Recurring Donations. Recurring Donations have a lookup relationship to Account. Now I am sending an email  whenever a donation record is newly created through trigger and I am getting the email address from Account Object  In the email I am using html template from email templates.( I am using html template since i am using images inside the email ). Now if I am using template I need to give targetObjectId. So I gave targetObjectId as accountId. When I give targetObjectId as accountId it is giving error as -You can give only lead,contact and user as targetObjectId. I am not using Contact Object. So guys please help me to find a solution for sending email using Account's email...I can only use email from Account object Below....Please Help

Thanks,
Anju Alexander

 
trigger sendMail on npe03__Recurring_Donation__c (before insert) {
 
Set<id> Ids = new Set<id>();
  
  for(npe03__Recurring_Donation__c donation : trigger.new)
  {
  if(donation.npe03__Organization__c!=null) //npe03__Organization__c is the accountId in recurring donations
  {  
  Ids.add(donation.npe03__Organization__c);
  System.debug('****'+donation.npe03__Organization__c);
  }
  /*catch (NullPointerException e) 
  {
  donation.addError(e);
  }*/
   
  }  
  
  
  // Step 0: Create a master list to hold the emails we'll send
  List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
  
  List<Account> accnt = new List<Account>();
  for(Account acc : [SELECT id,name,PersonEmail,FirstName from Account where id IN:Ids])
  {
  accnt.add(acc);
  }
    
   for(Account acnt : accnt) {
    if (acnt.PersonEmail != null && acnt.FirstName != null) {
      // Step 1: Create a new Email
      Messaging.SingleEmailMessage mail =   new Messaging.SingleEmailMessage();
    
      // Step 2: Set list of people who should get the email
      List<String> sendTo = new List<String>();
      sendTo.add(acnt.PersonEmail );
      mail.setToAddresses(sendTo);
      mail.setTargetObjectId(acnt.Id);
      
    for(OrgWideEmailAddress owa: [SELECT ID,DisplayName,Address FROM OrgWideEmailAddress])
  {
       mail.setOrgWideEmailAddressId(owa.id);
   
     }   
    
    EmailTemplate templateId = [Select id from EmailTemplate where DeveloperName= 'Recurring_Donation'];
    mail.setTemplateID(templateId.id); 
    mails.add(mail);
    }
  }
  Messaging.sendEmail(mails);
  }

 
Hi All,

I have two record types 1)Individual Record Type and 2)Institutional Record Type in Contacts which are both active. For Both record types, records are created. Now when Reports are created only records with Individual Record Type are coming in the report type.Institutional are not shown.
After that, I have tried giving the filter criteria as
1) Contact Record Type equals Institutional
Then it is showing as 0 records.
Guys.....Please help....Its important.

Thanks,
Anju Alex