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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Assigning Spouse/Partner connection on contact record

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I've got data coming into my Dynamics 365 from our website to create contacts, however we couldn't get it to create the family connections between the two.  So we've made a unique field called spouse ID and copy the Contact ID of the spouse to that.

 

How do I get flow, Power Automate sorry, to create the connection Spouse/Partner based on this?  When I go to create a new connection I cannot get it to bring up the connection roles and I'm not good with expressions

 

Any help would be great!

 

Cheers

I have the same question (0)
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at
    Re: Assigning Spouse/Partner connection on contact record

    @Anonymous 

    Hi there.  So....how would Power Automate "know" who the spouse was?  I want to chase this upstream a bit so we find a good solution.

     

    Thanks,

    -Ed

  • Community Power Platform Member Profile Picture
    on at
    Re: Assigning Spouse/Partner connection on contact record

    Hi @edgonzales 

     

    So flow would know that there is a spouse because the field Spouse ID would have data, and that data is the Contact ID of their spouse.  So if you use that Spouse ID field to search for a contact it brings up their spouse

     

    Does that help?

     

    Cheers

     

     

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at
    Re: Assigning Spouse/Partner connection on contact record

    I may be missing something, so here's what I understand and you tell me what needs work:

     

    A contact is created in D365 through a form on your website.

    You want to relate that contact to another existing contact in a (possibly) 1:1 relationship (not judging).

    The Out-of-the-box D365 Field, "Spouse/Partner Name" is a free form text field and not a lookup like you want.

     

    You've created a custom field (on the contact entity?) for Spouse ID where you are manually putting the ID (GUID?) of the related contact.

     

    If all that is correct, here is where I get lost:

    What is it you want Power Automate to do, exactly?

    If you have to manually add the spouse, would it not work to make that custom field a lookup on the contact entity?

     

    Keep us posted.

    -Ed

     

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Assigning Spouse/Partner connection on contact record

    Hello,

     

    Yes that's what I've got, what I want power automate to do is create the connection between the two using the connection role 'Spouse/Partner' rather than have someone manually do that.

     

     
     
     
     
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at
    Re: Assigning Spouse/Partner connection on contact record

    So there will be a text value in the Spouse/Partner field (that someone else had manually entered) and you want a flow that will search contacts for that string, and then drop the winning GUID into your custom field?  Is the Spouse/Partner information coming from the original form?

     

    If not, it would seem if someone still has to manually enter text into the existing Spouse/Partner field, they could just as easily select an existing record (which would create the relationship in one step vs. 2 or 3).  Sorry for all of the questions, but I want to make sure I understand it right.  

     

    If I've got the first part right and you still want to move forward, it would looks something like this:

    On new form submission, create a contact record in D365.

    If the "Spouse/Partner" information is not present.  end there.  If there's something there, then list D365 contact records that match.

    Take the first result back in the array and grab that id and drop it into your custom field.  If there's no match, then the custom field stays blank.

     

    That approach obviously won't be 100% accurate because of the ambiguity of the search and will definitely give you trouble with common names and misspellings.  BUT, it might get you closer.

     

    You could then have a view in D365 that looked for records that had data in the Spouse/Partner field and nothing in the custom field.  These would be candidates for manual intervention.

     

    What do you think?

    -Ed

  • Community Power Platform Member Profile Picture
    on at
    Re: Assigning Spouse/Partner connection on contact record

    Annotation 3.pngAnnotation 4.pngAnnotation 5.pngSo what I have is this so far, but the create Spouse/Partner doesn't work

     

     

  • Verified answer
    Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at
    Re: Assigning Spouse/Partner connection on contact record

    @Anonymous 

    Ah, ok.  I think I understand.  So, Connection Role is an option set, so it is probably looking for the associated ID rather than the label.  If you haven't added the "Spouse/Partner" role in the connections entity, then try the default value for family in both fields, which is 2.  If that works, then that's probably the issue.  Here's a link to that optionset:

     

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/entities/connectionrole

     

    Other things to consider:

    • I suggest using the CDS trigger "When a Record is Created" rather than the D365 version.
    • I don't think you need the "Split On" flag turned on since your trigger body won't be an array.
    • Renaming your steps will help keep everything sorted out when you're dealing with multiple actions in the same connector.

    Hope that helps, keep us posted.

    -Ed

     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Community Power Platform Member Profile Picture
    on at
    Re: Assigning Spouse/Partner connection on contact record

    Hello,

     

    So I have figured it out with your help, the connection role has data in it so I needed the unique ID for the role Spouse/Partner to go into the roles field once first, but then run it again in reverse as an update

     

    All working thank you

     

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 647 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 350 Moderator

#3
developerAJ Profile Picture

developerAJ 256

Last 30 days Overall leaderboard