Skip to main content

Update the Record and Debug the Flow

Updating a Record in Two Steps

You don't just want to send an acknowledgment email—you also want to record that the donation was acknowledged. In Nonprofit Success Pack (NPSP) you can record those values in the Acknowledgment Status and Acknowledgment Date fields on an opportunity record.

Start by using an Assignment element to change your opportunity's record variable—that special type of variable in flow that holds details about a Salesforce record—to reflect what you want to change. You then use an Update Records element to make those changes in the database.

Add an Assignment Element to the Flow

Start with the Assignment element.

  1. Click Add element () after the Send Email Action. If your flow is getting too big for the page and you can’t find the Add element button, you can use the Zoom out () or Fit to canvas () buttons on the canvas to make space.
  2. Select Assignment in the Logic section.
  3. Label: Acknowledgment Status (Check your spelling and make sure your Assignment element has this exact name to pass the challenge.)
  4. API Name: Acknowledgment_Status (This should automatically generate.)
  5. Description: The assignment element sets the values for the opportunity record before we update it in the database.
  6. In Set Variable Values:
    The New Assignment panel corresponding to the following steps
    • In the first row:
      • Variable: Click in to Search variables... and find and select Opportunity from Get_Opportunity then npsp__Acknowledgment_Status__c (Acknowledgment Status) so that {!Get_Opportunity.npsp__Acknowledgment_Status__c} is in the Variable field.
      • Operator: Equals
      • Value: Find and select the Acknowledged Text Picklist Value.
    • Click + Add Assignment.
    • In the second row:
      • Variable: Click in to Search variables... and find and select Opportunity from Get_Opportunity and then npsp__Acknowledgment_Date__c (Acknowledgment Date) so that {!Get_Opportunity.npsp__Acknowledgment_Date__c} is in the Variable field.
      • Operator: Equals
      • Value: Click in to the field and select the $Flow Global Variable and then Current Date so that the Value is {!$Flow.CurrentDate}.
  7. Click Close.

The flow with the Assignment element

Click Save in Flow Builder to save your work.

Update the Record

Now that the Assignment element is storing the values, it's time to use Update Records to put those values on the original opportunity where they belong.

  1. Click Add element () after the Acknowledgement Status Assignment element.
  2. Select Update Records in the Data section.
  3. Label: Enter Update Opportunity
  4. API Name: EnterUpdate_Opportunity (This should automatically generate.)
  5. Description: Enter Update the opportunity record and save the new Acknowledgment Status and Acknowledgment Date to the database.
  6. How to Find Records to Update and Set Their Values: Use the IDs and all field values from a record or record collection, the default.
  7. Record or Record Collection: Find and select Opportunity from Get Opportunity.
    The New Update Records panel corresponding to the preceding steps
  8. Click Close.

Your flow now has all the elements you need!

The completed flow

Click Save in the Flow Builder to make sure you don't lose any of this work.

Testing and Debugging the Flow

Before you move out of Flow Builder, you can test your work two ways: either by clicking Run or Debug.

If you click Run, you'll be able to see your flow as it will appear to your users, with both screens you created. It can be helpful to see your screens, but it doesn't show us everything that will happen in practice. For this flow, for example, Run doesn't pass details from an opportunity record to the flow, so your email template appears mostly empty and there's no email address to send to.

If you click Debug, you get many more options and details about the flow and how it works. Debug is especially helpful for this flow because you can input the variables the flow needs on the first screen. For example, if you pasted in an opportunity ID (the 18-character code right after /Opportunity/ in the URL) and clicked Run in Debug, you could see the flow with all of its functionality, plus Debug Details that would tell us exactly what the flow is doing as it does it. If you run the whole flow and it's successful, the part of the interface where your flow appears will read All done and you'll see a Transaction Committed message under Debug Details. If you encounter an error, Debug Details will include error messages.

Debug Details on the flow's second screen

Try both Run and Debug to see how they work. Once you're done, close the tabs in your browser to go back to the Flow Builder.

Activate the Flow

It's the big moment! Activate the flow!

In the Flow Builder, click Activate. That's it. The flow is active!

The active flow in Flow Builder

That doesn't mean that users can find it, though. In the next step you place the flow on the opportunity page, create a test record, and send yourself the email to see how it all works together.

To complete this step and move on, launch your Trailhead Playground and click Verify to check that Update Records is properly configured and the flow is activated. 

Resources

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities