web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create an Opportunity ...
Power Automate
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!
Categories:
I have the same question (0)
  • Suggested answer
    abc 123 Profile Picture
    789 Moderator on at
    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.
  • fsuarezoedt Profile Picture
    46 on at
    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.
  • abc 123 Profile Picture
    789 Moderator on at
    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
    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
    789 Moderator on at
    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.)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard