Skip to main content
Sara Monksfield (RSC) ha fatto una domanda in #Flow

I have a flow button to create an opportunity, from the contact record. Users select products and quantity and the flow gets contact and related account details, creating the opportunity and populating the related contact fields. 

 

I need exactly the same button on account, so that an opportunity can be created even if the user doesn't have a contact to associate it to. I could create another version of the flow, missing the get contact element, but is there a way I can use just one flow?  

 

I'm essentially looking to skip the get contact element if the flow is started from the account record. 

 

Any idea how I can do this? I have added a screenshot of the start of the flow.

  

Screen flow from button on 2 different objects - do I need 2 different flows?

 

 

#Flow

4 risposte
  1. 14 mag, 20:50

    Yes — you can use a single flow for both Contact and Account records instead of creating two separate versions.

    A clean way to handle this is to use the standard `recordId` input variable and add a Decision element at the start of the flow to determine whether the flow was launched from a Contact or an Account.

    For example:

    * Contact IDs start with `003`

    * Account IDs start with `001`

    So you can:

    * Run the “Get Contact” element only when the flow is launched from a Contact record

    * Skip it entirely when launched from an Account record

    From there, populate shared variables like:

    * AccountId

    * PrimaryContactId

    Then let the rest of the opportunity creation logic stay the same for both paths.

    That way:

    * you avoid maintaining two flows,

    * keep product/opportunity logic centralized,

    * and make future updates much easier.

    One thing to watch for: if you create Opportunity Contact Roles or reference Contact fields later in the flow, make those steps conditional so they only run when a Contact exists.

0/9000