+ Start a Discussion
Deanna Aaron 11Deanna Aaron 11 

Create "Note" when "Task" is Complete

Hi. 

We create "tasks" as reminders and also run reports on tasks. Sometimes those reminders are added in as notes for future reference (but we can't run reports on notes). So, sometimes things are entered in as tasks for reporting reasons.

What we want to do:
Create a checkbox on the task record that says "Create Note"
Once the task is complete, a note will be created on the record. Is there a way to do this? 
On the task itself, there's a "related to [record type] [lookup field]
Name [Contact/Lead] [Lookup Field]
We would want to create the note based on the record indicated on the task.

I created the custom field on the task already. I'm in the process builder, but can't seem to figure it out.

Thank you.
Best Answer chosen by Deanna Aaron 11
kd Komalkd Komal
Hi Deanna,

Following the idealogy of salesforce of point and click, i would suggest go with the process builder  + Flow.

Please mark this as the best answer if it helps you resolve the issue.

Here are the steps for the same. :-

Create a Flow :-
Go to Quick Find/Search and Search for Flow. Create a new Flow. On the displayed(you will have to enable the adobe flash Player) select "Record create under the "Palette--> Data" and drag it out on the right screen canvas. It will open up a popup window asking for the name and unique name. Fill out the details as shown/As per need.


User-added image

As shown above select what ever field you want to  have in your note record. Under value, create a sObject Variable as highlighted. It will open up a popup window. fill in the details as shown and click ok.
User-added image

Now you should be getting something like this in value(Its more like mapping the values)
User-added image
Map whatever fields you want, for the most basic fields it should like this.
User-added image
Click the Down arrow symbol(in green). It will make your record Create the first instance to get fired when called upon.
User-added image

Save your flow. And just to be sure, log out of your org. login again and create a process builder with on task object . 

Under action type select flow, type the name of your flow. Automatically the sObject Variable will get populated. Assign it to the task record.

Save and Activate your Process builder.


 

All Answers

kd Komalkd Komal

Hi Deanna,

Please confirm if my understanding is right, you want to create a note on the record(Contact/Lead) present on the task ?

Deanna Aaron 11Deanna Aaron 11
Yes, that is correct.
kd Komalkd Komal
Hi Deanna,

Note object is not available in process builder. For that you can either have Trigger to create the note or a Flow which will be fired from your process builder.

Please let us know which way suits you. 
 
Deanna Aaron 11Deanna Aaron 11
Thank you Kd! Either method will work. Do you have a recommendation if one method is best? Also, would you be able to help us by providing steps to acheive this using Trigger/Flow?

Thank you, again.
kd Komalkd Komal
Hi Deanna,

Following the idealogy of salesforce of point and click, i would suggest go with the process builder  + Flow.

Please mark this as the best answer if it helps you resolve the issue.

Here are the steps for the same. :-

Create a Flow :-
Go to Quick Find/Search and Search for Flow. Create a new Flow. On the displayed(you will have to enable the adobe flash Player) select "Record create under the "Palette--> Data" and drag it out on the right screen canvas. It will open up a popup window asking for the name and unique name. Fill out the details as shown/As per need.


User-added image

As shown above select what ever field you want to  have in your note record. Under value, create a sObject Variable as highlighted. It will open up a popup window. fill in the details as shown and click ok.
User-added image

Now you should be getting something like this in value(Its more like mapping the values)
User-added image
Map whatever fields you want, for the most basic fields it should like this.
User-added image
Click the Down arrow symbol(in green). It will make your record Create the first instance to get fired when called upon.
User-added image

Save your flow. And just to be sure, log out of your org. login again and create a process builder with on task object . 

Under action type select flow, type the name of your flow. Automatically the sObject Variable will get populated. Assign it to the task record.

Save and Activate your Process builder.


 
This was selected as the best answer
Deanna Aaron 11Deanna Aaron 11
Kd -- The instructions you provided are EXCELLENT. I feel like I'm SO close. I completed the steps and tested it out, but recieved this error:

Can’t Save Record
We can't save this record because the “Complete Task > Create Note” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Error ID: 331407408-42644 (12342592)

I'm not sure where I went wrong. These are the steps that I took:

User-added image

User-added image

User-added image

User-added imageUser-added image

 
Deanna Aaron 11Deanna Aaron 11
I made sure to activate both the Flow and Process Builder.
Final Image:
User-added image
 
kd Komalkd Komal
Hi Deanna,

You must have received a mail also. Could you please check what was the reason stated in the mail for this issue ?
 
Deanna Aaron 11Deanna Aaron 11
Yes, Kd - I looked at this right after I submitted my response to you. I think I need to delete "ParentID". I still have OwnerID. That's more important.

Error element Create_Note (FlowRecordCreate).
This error occurred when the flow tried to create records: REQUIRED_FIELD_MISSING: Required fields are missing: [ParentId]. You can look up ExceptionCode values in the SOAP API Developer Guide (https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.salesforce.com_docs_atlas.en-2Dus.api.meta_api_sforce-5Fapi-5Fcalls-5Fconcepts-5Fcore-5Fdata-5Fobjects.htm-23&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=zwrPLWXZK5F6HTSmOiDLoF_eiqE1bvaE07F4hgGuNug&m=E-0Y6PRglWfWEkkbxqVLCzFIeKZnpD3eK5PYXp3zMmA&s=YubVEzhN2eaYurIc44OggPKAFczMAkzjFs0HHcIlz0I&e=).

Deanna Aaron 11Deanna Aaron 11
I deleted ParentID from my flow and removed it from my "mapped" list. And I still got the same error. The 'Note' must have a ParentID in order to be created and saved. When the task is being saved the ParentID in the 'Note' is null.

RECORD CREATE: Create_Note
Create one Note record where:
Body = {!ThisTask.Description} (ABC XYZ)
OwnerId = {!ThisTask.OwnerId} (0051N000004tH3aQAE)
ParentId = {!ThisTask.WhoId} (null)
Title = {!ThisTask.Subject} (Call to THANK)
Result
Failed to create record.

Maybe it shouldn't be mapped this way: ParentID {!ThisTask.WhoId}
kd Komalkd Komal
Hi Deanna,

The ownerId defines the User and ParentId defines the Contact/account to which you want to associate this note. If it the task is created on the account please make ParentId = {!ThisTask.WhatId}
Deanna Aaron 11Deanna Aaron 11
Kd - Thank you. I was curious and changed it to: ParentId = {!ThisTask.WhatId} and it worked the way we wanted it (On the account). Your last comment was correct. **Thank you SO very much for your patience. You did a good deed today in helping us! I'm marking as best answer. Well deserved!
kd Komalkd Komal
I am glad i could help you out .
Deanna Aaron 11Deanna Aaron 11
Hi Kd-- I have a new question that may be resolved with "Flows". Are you able to help with this? Please see question here: https://success.salesforce.com/answers?id=9063A000000lKlw
I sincerely appreciate your help.
kd Komalkd Komal
Hi Deanna,

First of all thank you :) .

I saw your question and sorry to say the requirement cannot be fulfilled with flows. As Note object is netiher available in process builder nor in workflow so it is not possible to fire any flow via these. Though we can fire a flow from a custom button but in this case we cannot add custom buttons on a note record layout hence trigger would be the simplest approach.

Do you need it to be done via configuration only ?
Deanna Aaron 11Deanna Aaron 11

kd-- You seriously rock! I can't thank you enough for your reply. So, I'm trying to play around with triggers. I tried this, but it didn't work:

trigger updateMost_Recent_Note__c on Note (after insert) {
    List<Account> accLstToUpdate = new List<Account>();
    for(Note nt : Trigger.new){
        if(nt.ParentId != null && nt.ParentId.getSObjectType() == Account.sObjectType){
            Account acc=new Account(Id=nt.parentId,Most_Recent_Note__c=nt.Body);
            accLstToUpdate.add(acc);

       } 
    }
    
    if(!accLstToUpdate.isEmpty()){
        update accLstToUpdate;
    }
}

I'm not sure what you mean by "do you need it to be done via configuration only?"
When a new note is created, I want the system to automatically update the account field to show the body of the newest note. I also want to create another account field that automatically updates to show the date of the most recent note. Thank you, AGAIN.

kd Komalkd Komal
Hi Deanna,

Please let me reply you back on the orginal question so that other might help/get help.
Ricki ReayRicki Reay
Hi All,

I am trying to use the Flow + Process Builder to auto-create a note on an account record when a lead is created and related to the account. The note will have a body = description of the lead. Unfortunately, I cannot figure out what I am doing wrong as I keep getting a flow error. Any help and assistance is greatly appreciated. Here are some screenshots for context:

Picture 1 - Flow: Create new note
User-added image
Picture 2 - Flow
User-added image
Picture 3 - Flow
User-added image
Picture 4 - Flow
User-added image
Picture 5 - Process Builder: trigger flow upon creation of new lead where Related Account is not null and Description is not null
User-added image
...cont'd in next post

 
Ricki ReayRicki Reay
Picture 6 - Process Builder (Flow Trigger)
User-added image

Error Message - When trying to create a test lead from an existing account (so Related Account = Existing Account) and Description field on lead populated
User-added image

Thanks in advance for any and all help!!!

Ricki