• albonill
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 16
    Replies

Hello,

 

I am trying to set up a Workflow Rule to send an email to a certain department when a Lead is converted to an Account.  Here is the Workflow formula:

AND(
 IsConverted  = true,
OR (ISPICKVAL (LeadSource, 'Trial Lead')), (ISPICKVAL (LeadSource, 'Campaign Lead')), (ISPICKVAL (LeadSource, 'Web Lead ')), (ISPICKVAL (LeadSource, 'Free 30-day Trial'))
)

 When I convert the test Lead, nothing is sent.  The Workflow Rule is active and I have added the respective email notification as well.  Any help would be greatly appreciated.

Hello,

 

I have created a workflow rule that will alert a specific department when a change is made to the Account Status field.  The alert works fine, but the only thing is that I don't want the email alert to trigger if the Account Status is changed to a blank field.  We have three options in the picklist, but we also allow for the field to be left empty even after it has been populated.  The workflow alert triggers is the formula evaluates to TRUE.

 

Here is the basic formula I have. 

 

ISCHANGED( Account_Status__c )

 

Thanks in advance.

 

Hello,

 

Excuse my ignorance, but I am not familiar on how to go about testing the trigger below.  The trigger is basically desinged to avoid an Opportunity from being deleted if there is an Invoice, Sales Order, Agreement or Attachment.  Many thanks for the assistance.

 

Trigger:

 

trigger OppDeleteCheck on Opportunity (before delete) 
{
    Set<Id> stId = new Set<Id>();
    List<echosign_dev1__SIGN_Agreement__c> lstRe =[Select Id, echosign_dev1__Opportunity__c from echosign_dev1__SIGN_Agreement__c where echosign_dev1__Opportunity__c in : Trigger.oldMap.KeySet() ];
    for(echosign_dev1__SIGN_Agreement__c objp : lstRe)
    {
        stId.add(objp.echosign_dev1__Opportunity__c);
    }

    Set<Id> stIdS = new Set<Id>();
    List<Sales_Order__c> lstReS =[Select Id, Opportunity__c from Sales_Order__c where opportunity__c in : Trigger.oldMap.KeySet() ];
    for(Sales_Order__c objp : lstReS)
    {
        stIdS.add(objp.opportunity__c);
    }

    Set<Id> stIdSI = new Set<Id>();
    List<Sales_Invoice__c> lstReI =[Select Id, Opportunity__c from Sales_Invoice__c where opportunity__c in : Trigger.oldMap.KeySet() ];
    for(Sales_Invoice__c objp : lstReI)
    {
        stIdSI.add(objp.opportunity__c);
    }
    
    Set<Id> stIdAtt = new Set<Id>();
    List<Attachment> lstAtt =[Select Id, ParentId from Attachment where ParentId in : Trigger.oldMap.KeySet() ];
    for(Attachment objp : lstAtt)
    {
        stIdSI.add(objp.ParentId);
    }
  
    for(Opportunity objA : Trigger.old)
    {
        if(stId.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Agreement and cannot be deleted.');
           return;
        }

    if(stIdS.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains a Sales Order and cannot be deleted.');
           return;
        }

    if(stIdSI.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Invoice and cannot be deleted');
           return;
        }

    if(stIdAtt.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Attachment and cannot be deleted');
           return;
        }

    }
}

 Regards,

Alex

Hello,

 

I need assistance in the creation of a trigger that will not allow the deletion of an Opportunity under the following circumstances:

 

  • If there is an Agreement Name (Name) (echosign_dev1__SIGN_Agreement__c is object)
  • Or if there is a Sales Order No (Name) (Sales_Order__c is object)
  • Or if there is an Sales Invoice No (Name) (Sales_Invoice__c is the object)
  • Or if there is an attachment present in the Agreement

 

Thank you for your help.

 

Regards,

Alex

Hello,

 

I need assistance in the creation of a trigger that will not allow the deletion of an Opportunity under the following circumstances:

 

  • If there is an Agreement Name (Name) (echosign_dev1__SIGN_Agreement__c is object)
  • Or if there is a Sales Order No (Name) (Sales_Order__c is object)
  • Or if there is an Sales Invoice No (Name) (Sales_Invoice__c is the object)
  • Or if there is a Google doc, note or attachment present in the Opp

Thank you for your help.

 

Regards,

Alex

 

Hi,

 

I got assistance creating my trigger and now I find out that it needs to be tested in order to be uploaded to production.  The trigger is designed to auto-populate the Opportunity_Contact__c field, with the Contact that has been designated as the Renewal Owner, when a record is originally created only.  Any assistance would be greatly appreciated.

 

trigger setRenewalOwnerContact on Opportunity (before insert) {

 

 List<Opportunity > optylist = Trigger.new; 
  for ( Opportunity opty : optylist ) {
   if (opty.Opportunity_Contact__c == null) {
    for (List<Contact> contactlist : [SELECT id FROM Contact WHERE Accountid = :opty.Accountid AND Contact_Type__c = 'Renewal Owner' LIMIT 1]) { 
     for(Contact con : contactlist ) {
        opty.Opportunity_Contact__c = con.id;
     }
    }
   }
  }
  
}

 Regards,

 

Alex

Hello,

 

I am new to Apex so I would like assistance in creating a trigger to automatically update the Opportunity Contact field, with the contact designated as the Renewal Owner (Contact Type) in the contact description.  We have added a field named Contact Type to the Contacts so that we know who to send renewal contracts to.

 

Field Name (field type): API Name:
Opportunity Contact (Lookup(Contact)): Opportunity_Contact__c

Contact type (Picklist): Contact_Type__c

 

The objective of the trigger is to eliminate the need to have to select the contact in the Opportunity Contact lookup field.  This trigger should only fire once (when a new Opportunity is created) and not when someone updates the Opportunity.  If someone wants to change the Opportunity contact to someone else, later on, they should be able to edit that field as well.  Thanks for the help with this.

Hello,

 

I am trying to set up a Workflow Rule to send an email to a certain department when a Lead is converted to an Account.  Here is the Workflow formula:

AND(
 IsConverted  = true,
OR (ISPICKVAL (LeadSource, 'Trial Lead')), (ISPICKVAL (LeadSource, 'Campaign Lead')), (ISPICKVAL (LeadSource, 'Web Lead ')), (ISPICKVAL (LeadSource, 'Free 30-day Trial'))
)

 When I convert the test Lead, nothing is sent.  The Workflow Rule is active and I have added the respective email notification as well.  Any help would be greatly appreciated.

Hello,

 

I have created a workflow rule that will alert a specific department when a change is made to the Account Status field.  The alert works fine, but the only thing is that I don't want the email alert to trigger if the Account Status is changed to a blank field.  We have three options in the picklist, but we also allow for the field to be left empty even after it has been populated.  The workflow alert triggers is the formula evaluates to TRUE.

 

Here is the basic formula I have. 

 

ISCHANGED( Account_Status__c )

 

Thanks in advance.

 

Hello,

 

Excuse my ignorance, but I am not familiar on how to go about testing the trigger below.  The trigger is basically desinged to avoid an Opportunity from being deleted if there is an Invoice, Sales Order, Agreement or Attachment.  Many thanks for the assistance.

 

Trigger:

 

trigger OppDeleteCheck on Opportunity (before delete) 
{
    Set<Id> stId = new Set<Id>();
    List<echosign_dev1__SIGN_Agreement__c> lstRe =[Select Id, echosign_dev1__Opportunity__c from echosign_dev1__SIGN_Agreement__c where echosign_dev1__Opportunity__c in : Trigger.oldMap.KeySet() ];
    for(echosign_dev1__SIGN_Agreement__c objp : lstRe)
    {
        stId.add(objp.echosign_dev1__Opportunity__c);
    }

    Set<Id> stIdS = new Set<Id>();
    List<Sales_Order__c> lstReS =[Select Id, Opportunity__c from Sales_Order__c where opportunity__c in : Trigger.oldMap.KeySet() ];
    for(Sales_Order__c objp : lstReS)
    {
        stIdS.add(objp.opportunity__c);
    }

    Set<Id> stIdSI = new Set<Id>();
    List<Sales_Invoice__c> lstReI =[Select Id, Opportunity__c from Sales_Invoice__c where opportunity__c in : Trigger.oldMap.KeySet() ];
    for(Sales_Invoice__c objp : lstReI)
    {
        stIdSI.add(objp.opportunity__c);
    }
    
    Set<Id> stIdAtt = new Set<Id>();
    List<Attachment> lstAtt =[Select Id, ParentId from Attachment where ParentId in : Trigger.oldMap.KeySet() ];
    for(Attachment objp : lstAtt)
    {
        stIdSI.add(objp.ParentId);
    }
  
    for(Opportunity objA : Trigger.old)
    {
        if(stId.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Agreement and cannot be deleted.');
           return;
        }

    if(stIdS.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains a Sales Order and cannot be deleted.');
           return;
        }

    if(stIdSI.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Invoice and cannot be deleted');
           return;
        }

    if(stIdAtt.contains(objA.Id))
        {
           objA.addError('WARNING!!! This Opportunity contains an Attachment and cannot be deleted');
           return;
        }

    }
}

 Regards,

Alex

Hello,

 

I need assistance in the creation of a trigger that will not allow the deletion of an Opportunity under the following circumstances:

 

  • If there is an Agreement Name (Name) (echosign_dev1__SIGN_Agreement__c is object)
  • Or if there is a Sales Order No (Name) (Sales_Order__c is object)
  • Or if there is an Sales Invoice No (Name) (Sales_Invoice__c is the object)
  • Or if there is an attachment present in the Agreement

 

Thank you for your help.

 

Regards,

Alex

Hello,

 

I need assistance in the creation of a trigger that will not allow the deletion of an Opportunity under the following circumstances:

 

  • If there is an Agreement Name (Name) (echosign_dev1__SIGN_Agreement__c is object)
  • Or if there is a Sales Order No (Name) (Sales_Order__c is object)
  • Or if there is an Sales Invoice No (Name) (Sales_Invoice__c is the object)
  • Or if there is a Google doc, note or attachment present in the Opp

Thank you for your help.

 

Regards,

Alex

 

Hi,

 

I got assistance creating my trigger and now I find out that it needs to be tested in order to be uploaded to production.  The trigger is designed to auto-populate the Opportunity_Contact__c field, with the Contact that has been designated as the Renewal Owner, when a record is originally created only.  Any assistance would be greatly appreciated.

 

trigger setRenewalOwnerContact on Opportunity (before insert) {

 

 List<Opportunity > optylist = Trigger.new; 
  for ( Opportunity opty : optylist ) {
   if (opty.Opportunity_Contact__c == null) {
    for (List<Contact> contactlist : [SELECT id FROM Contact WHERE Accountid = :opty.Accountid AND Contact_Type__c = 'Renewal Owner' LIMIT 1]) { 
     for(Contact con : contactlist ) {
        opty.Opportunity_Contact__c = con.id;
     }
    }
   }
  }
  
}

 Regards,

 

Alex

Hello,

 

I am new to Apex so I would like assistance in creating a trigger to automatically update the Opportunity Contact field, with the contact designated as the Renewal Owner (Contact Type) in the contact description.  We have added a field named Contact Type to the Contacts so that we know who to send renewal contracts to.

 

Field Name (field type): API Name:
Opportunity Contact (Lookup(Contact)): Opportunity_Contact__c

Contact type (Picklist): Contact_Type__c

 

The objective of the trigger is to eliminate the need to have to select the contact in the Opportunity Contact lookup field.  This trigger should only fire once (when a new Opportunity is created) and not when someone updates the Opportunity.  If someone wants to change the Opportunity contact to someone else, later on, they should be able to edit that field as well.  Thanks for the help with this.