• Whitney Klein 10
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 16
    Replies
Hello, I would like to send out an email alert to users when an account has not ordered in 75 days. I have a formula field that tracks the Days Since Last Order. The formula will not trigger the workflow rule I created and I believe I need to write a trigger. I am a huge newbie so any help is greatly appreciated!! 
Hello, I have a trigger that works fine except it is doing it for every instance. I want to have the trigger happen only on tasks where the Quick Call Log field is checked (Quick_Call_Log__c = True). Where should I add this to the trigger below? Thanks for any help in advance!! 

trigger TaskTrg on Task( after insert, after update ) 
{
    Map<Id, Account> accountsToBeUpdated = new Map<Id, Account>();
    
    for( Task t : trigger.new )
    {
        if( trigger.isInsert
            || ( trigger.isUpdate
                && ( trigger.oldMap.get( t.Id ).Call_Date__c != t.Call_Date__c
                    || trigger.oldMap.get( t.Id ).Description__c != t.Description__c )
                )
            )
        {
            if( t.WhatId != null && String.valueOf( t.WhatId ).startsWith( '001' ))
            {
                Account acc = new Account( Id = t.WhatId );
                acc.Last_Call_Date__c = t.Call_Date__c;
                acc.Last_Call_Description__c = t.Description__c;
                
                accountsToBeUpdated.put( acc.Id, acc );
            }
        }
    }
    
    if( accountsToBeUpdated.values().size() > 0 )
        update accountsToBeUpdated.values();
}
Hello, I got the following code to work on accounts but I need to have it do the same thing for leads. What do I need to update to make this happen? I tried putting Lead everywhere Account was but got an error that "leadsToBeUpdated" was invalid. Thanks for any help!!!


trigger TaskTrg on Task( after insert, after update ) 
{
    Map<Id, Account> accountsToBeUpdated = new Map<Id, Account>();
    
    for( Task t : trigger.new )
    {
        if( trigger.isInsert
            || ( trigger.isUpdate
                && ( trigger.oldMap.get( t.Id ).Call_Date__c != t.Call_Date__c
                    || trigger.oldMap.get( t.Id ).Description__c != t.Description__c )
                )
            )
        {
            if( t.WhatId != null && String.valueOf( t.WhatId ).startsWith( '001' ))
            {
                Account acc = new Account( Id = t.WhatId );
                acc.Last_Call_Date__c = t.Call_Date__c;
                acc.Last_Call_Description__c = t.Description__c;
                
                accountsToBeUpdated.put( acc.Id, acc );
            }
        }
    }
    
    if( accountsToBeUpdated.values().size() > 0 )
        update accountsToBeUpdated.values();
}
Hello, I have made a quick action on my accounts tab that allows faster Log a Call. I have two fields on my account that I want to have updated with this quick call info. The fields are Last Sales Call Date (date of log a call) and Last Sales Call Description (description field from log a call).

I know I need to do this with a trigger as opposed to workflow rules but I have absolutely no experience with Apex. Any help is greatly appreciated!! 
Hello, 

I have a payment object (called transaction) that is a custom object related to the opportunity object. We use and app called Chargent to process CC's in salesforce which automatically create the transaction. I have a formula on the transaction level that puts in the payment date. I would like to take this payment date from the transaction to the opportunity. I tried workflows and I couldn't access transaction fields from the opportunity. I'm hopping a trigger can copy the date from the transaction to a field in the opportunity. Any help is greatly appreciated!!!! (I have zero experience with apex and triggers)
Hello, 

I received the following error message. I believe it is coming from a trigger but I am not sure. Thanks for any help! 

Error Message: 

Developer script exception from E-Gains Distrubuting, LLC : geocodeAccountAddress : geocodeAccountAddress: execution of AfterUpdate caused by: System.AsyncException: Future method cannot be called from a future or batch method: AccountGeocodeAddress.geocodeAddress(Id) Class.AccountGeocodeAddress.DoAddressGeocode: line 17, column 1 Trigger.geocodeAccountAddress: line 34, column 1
Apex script unhandled trigger exception by user/organization: 005i0000005QIhN/00Di0000000i0Xa

geocodeAccountAddress: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a future or batch method: AccountGeocodeAddress.geocodeAddress(Id)

Class.AccountGeocodeAddress.DoAddressGeocode: line 17, column 1
Trigger.geocodeAccountAddress: line 34, column 1
 
Hello, I have made a quick action on my accounts tab that allows faster Log a Call. I have four fields on my account that I want to have updated with this quick call info. The fields are Last Sales Call Date (date of log a call) and Last Sales Call Description (description from log a call).

The tricky part is I also have Last SERVICE Call Date and Last SERVICE Call Description. I'd like these fields updated based on the user/profile from the quick log a call.

I know I need to do this with a trigger as opposed to workflow rules but I have absolutely no experience with Apex. Any help is greatly appreciated!! 
Hello, I have a trigger that works fine except it is doing it for every instance. I want to have the trigger happen only on tasks where the Quick Call Log field is checked (Quick_Call_Log__c = True). Where should I add this to the trigger below? Thanks for any help in advance!! 

trigger TaskTrg on Task( after insert, after update ) 
{
    Map<Id, Account> accountsToBeUpdated = new Map<Id, Account>();
    
    for( Task t : trigger.new )
    {
        if( trigger.isInsert
            || ( trigger.isUpdate
                && ( trigger.oldMap.get( t.Id ).Call_Date__c != t.Call_Date__c
                    || trigger.oldMap.get( t.Id ).Description__c != t.Description__c )
                )
            )
        {
            if( t.WhatId != null && String.valueOf( t.WhatId ).startsWith( '001' ))
            {
                Account acc = new Account( Id = t.WhatId );
                acc.Last_Call_Date__c = t.Call_Date__c;
                acc.Last_Call_Description__c = t.Description__c;
                
                accountsToBeUpdated.put( acc.Id, acc );
            }
        }
    }
    
    if( accountsToBeUpdated.values().size() > 0 )
        update accountsToBeUpdated.values();
}
Hello, I have made a quick action on my accounts tab that allows faster Log a Call. I have two fields on my account that I want to have updated with this quick call info. The fields are Last Sales Call Date (date of log a call) and Last Sales Call Description (description field from log a call).

I know I need to do this with a trigger as opposed to workflow rules but I have absolutely no experience with Apex. Any help is greatly appreciated!! 
Hello, 

I have a payment object (called transaction) that is a custom object related to the opportunity object. We use and app called Chargent to process CC's in salesforce which automatically create the transaction. I have a formula on the transaction level that puts in the payment date. I would like to take this payment date from the transaction to the opportunity. I tried workflows and I couldn't access transaction fields from the opportunity. I'm hopping a trigger can copy the date from the transaction to a field in the opportunity. Any help is greatly appreciated!!!! (I have zero experience with apex and triggers)
Hello, 

I received the following error message. I believe it is coming from a trigger but I am not sure. Thanks for any help! 

Error Message: 

Developer script exception from E-Gains Distrubuting, LLC : geocodeAccountAddress : geocodeAccountAddress: execution of AfterUpdate caused by: System.AsyncException: Future method cannot be called from a future or batch method: AccountGeocodeAddress.geocodeAddress(Id) Class.AccountGeocodeAddress.DoAddressGeocode: line 17, column 1 Trigger.geocodeAccountAddress: line 34, column 1
Apex script unhandled trigger exception by user/organization: 005i0000005QIhN/00Di0000000i0Xa

geocodeAccountAddress: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a future or batch method: AccountGeocodeAddress.geocodeAddress(Id)

Class.AccountGeocodeAddress.DoAddressGeocode: line 17, column 1
Trigger.geocodeAccountAddress: line 34, column 1
 
Hello, I have made a quick action on my accounts tab that allows faster Log a Call. I have four fields on my account that I want to have updated with this quick call info. The fields are Last Sales Call Date (date of log a call) and Last Sales Call Description (description from log a call).

The tricky part is I also have Last SERVICE Call Date and Last SERVICE Call Description. I'd like these fields updated based on the user/profile from the quick log a call.

I know I need to do this with a trigger as opposed to workflow rules but I have absolutely no experience with Apex. Any help is greatly appreciated!! 

Hi 

 

I am trying this

 

AND( 
(Interesado_en_demo_online__c = TRUE), 
NOT(
ISBLANK(
ISPICKVAL(Purchasing_Authority__c ),
ISPICKVAL(Total_of_Employees__c ))))

 

Interesado is a checkbox that when is checked must make the 2 picklist fields mandatories?

 

got the : Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 1

 

Any ideas?

Thank you

  • September 16, 2011
  • Like
  • 0