Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Suggested answer

Create an Opportunity with and without a contact

(1) ShareShare
ReportReport
Posted on by 46
Hi
 
Can somebody guide me in the process of creating an Opportunity?
When I create an Opportunity There are two possible cases. I have an existing associated contact, and the contact does not exists.
 
So in my flow, I'm currently asking if the contact exists and then two different actions to create the Opportunity with all the fileds AND the contact or all the fileds WITHOUT the contact.
I can´t use only one action and put the client's odata value because when there's no client, the flow with fail telling me that the value can't be empty.
 
My question is: is there an easy way to use only one action to create the Opportunity with/without the contact?
 
Thanks!
  • abc 123 Profile Picture
    784 Super User 2025 Season 1 on at
    Create an Opportunity with and without a contact
    I believe that I read that the Update action used to require a value in every column, but then they changed it to ignore anything blank (not set the column to blank when left blank.)
     
    Add wouldn't have this issue, as if you don't populate a column, then it, by nature, would leave it blank (or let the default value kick in.)
  • fsuarezoedt Profile Picture
    46 on at
    Create an Opportunity with and without a contact
    Thanks! I'll give it a spin.
     
    Do you know if the Add action has the same bahavior as the Update action?
     
    Regards,
  • abc 123 Profile Picture
    784 Super User 2025 Season 1 on at
    Create an Opportunity with and without a contact
    When you're using the Update Item action. 
     
    init myvar = null
    set myvar = {get value from somewhere}
    If(equals(myvar, null), null, myvar)
     
    Use the expression builder to craft this in the column of the Update Item action that might need a null. 
     
    ---
     
    I dynamically craft many a Save, in which I make the JSON code.  Unfortunately, setting a null is different from a value, which has to be explicitly handled: 
     
    Here is the JSONBody when the columns will receive a value
    "value1" : "This is the value"
    "contact" : "varContact"
     
    And if you need to leave a column blank, it needs to NOT have the quotes on the value side of the pairing:
    "value1"  : null
    "contact" : null
     
  • fsuarezoedt Profile Picture
    46 on at
    Create an Opportunity with and without a contact
    Hey "@abc 123", it's not a Required proble. 
     
    The action to add an Opportunity to the table have the filed "Contact" (a relationship to other table), so I have to put the ODATA there. But if I create a "generic" action to create the Opportunity and put an ODATA that I get in a previous action, the action will fail if the ODATA is empty.
    That's why I created a switch asking if the Get Contact is empty and created two actions for Add Opportunity, one with the Contact and another without the Contact.
    But this is not nice because I use a lot of fields when creating an Opportunity so doing everything twice is a burden.
     
    That's why I'm asking if there's a better way to create an Opportunity with/without the Contact.
  • Suggested answer
    abc 123 Profile Picture
    784 Super User 2025 Season 1 on at
    Create an Opportunity with and without a contact
    Does the underlying list have the person field set to Required? If so, remove it, such that you can save with, or without, a contact.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >