• Kellie Millard
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 14
    Replies
Scenario:
I have a custom Related Activity List which, (through the use of a custom field called "hubspot generated activity" , a workflow that updates the Custom field based on subject line of the task and a process builder), gives me the listing of all activity not generated by hubspot and this is working brilliantly - with the exception of those tasks that are created using the BCC email (email to salesforce)

For some reason the workflow is not "seeing" the email tasks as they are created in salesforce, so the workflow is not triggering and subsquently the process builder is not pulling them into the right list.  If I open each of these tasks and re-save it, the workflow is started and the rest of the process works through to the end- so i just need a way to set the workflow off without having to manually open the record. (we are talking about 250 records+ per day). 

I understood that the standard functionality of workflow rules couldnt do this so needed to created an Apex trigger... 

The apex trigger set to run when an email (bcc) is sent which populates the "hubspot generated activity" field to "To Sync" so that I can see which records need to be updated and the workflow process in place says if hubspot generated activity field equals "To Sync"- change field to "no" 

What can I do to make the task be seen? 

I did wonder if i need the Apex trigger to be an update after the record is created? But not sure if thats the right thing to do and if so how to change the code to reflect that?   Below is the Apex Trigger I have currently..

trigger HubspotGenActivity on Task (before insert) {
 for(Task newTask : trigger.new){
if(
            !String.isBlank(newTask.Subject) &&
            newTask
                .Subject
                .toLowerCase()
                .startsWith('email:')
        ){
            newTask.Hubspot_generated__c = 'To Sync';
        }
    }
}


Any ideas please? 
Thanks in Advance
Kellie 
 
Scenario:
I have been asked to present information at an Account, Opportunity, Contact and Lead level where we have a simple date field that shows the Date of Last Activity for each of these objects. However, I need to specify which activity... ensuring that it is only giving us the teams activity (and not marketing generated) 

So Far:
I have a custom field against the task object - "Hubspot generated" - Y/N which is populated by workflow. 

I have created new custom formula (date) fields against each of the objects (which are currently pulling in the date of last activity (any activity including hubspot generated).  

I had previously been coming at this from a workflow or formula based approach but now understand Apex is the way to go.. but I have no experience in this whatsoever! 

trigger lastactivitydate ex hubspot (after insert, after update)
?????
and then i am lost in code! I believe i need to incorporate Task = Closed, Hubspot Generated = No  but not sure how to present this.

Any helpers?  Thanks In Advance!
Kellie 
Scenario:
I have a custom Related Activity List which, (through the use of a custom field called "hubspot generated activity" , a workflow that updates the Custom field based on subject line of the task and a process builder), gives me the listing of all activity not generated by hubspot and this is working brilliantly - with the exception of those tasks that are created using the BCC email (email to salesforce)

For some reason the workflow is not "seeing" the email tasks as they are created in salesforce, so the workflow is not triggering and subsquently the process builder is not pulling them into the right list.  If I open each of these tasks and re-save it, the workflow is started and the rest of the process works through to the end- so i just need a way to set the workflow off without having to manually open the record. (we are talking about 250 records+ per day). 

I understood that the standard functionality of workflow rules couldnt do this so needed to created an Apex trigger... 

The apex trigger set to run when an email (bcc) is sent which populates the "hubspot generated activity" field to "To Sync" so that I can see which records need to be updated and the workflow process in place says if hubspot generated activity field equals "To Sync"- change field to "no" 

What can I do to make the task be seen? 

I did wonder if i need the Apex trigger to be an update after the record is created? But not sure if thats the right thing to do and if so how to change the code to reflect that?   Below is the Apex Trigger I have currently..

trigger HubspotGenActivity on Task (before insert) {
 for(Task newTask : trigger.new){
if(
            !String.isBlank(newTask.Subject) &&
            newTask
                .Subject
                .toLowerCase()
                .startsWith('email:')
        ){
            newTask.Hubspot_generated__c = 'To Sync';
        }
    }
}


Any ideas please? 
Thanks in Advance
Kellie 
 
Scenario:
I have been asked to present information at an Account, Opportunity, Contact and Lead level where we have a simple date field that shows the Date of Last Activity for each of these objects. However, I need to specify which activity... ensuring that it is only giving us the teams activity (and not marketing generated) 

So Far:
I have a custom field against the task object - "Hubspot generated" - Y/N which is populated by workflow. 

I have created new custom formula (date) fields against each of the objects (which are currently pulling in the date of last activity (any activity including hubspot generated).  

I had previously been coming at this from a workflow or formula based approach but now understand Apex is the way to go.. but I have no experience in this whatsoever! 

trigger lastactivitydate ex hubspot (after insert, after update)
?????
and then i am lost in code! I believe i need to incorporate Task = Closed, Hubspot Generated = No  but not sure how to present this.

Any helpers?  Thanks In Advance!
Kellie