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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Can't disable or delete a mapping in a 1-to-N relationship - can I delete a lookup field's relationship instead?

(4) ShareShare
ReportReport
Posted on by 2

I have a relationship that was created between the Account and Opportunity entities due to the creation of an Account lookup field that was added to the Opp entity.  The point of this lookup field is to track a third party account that is part of the sale effort but not the customer/prospect.

The problem is that when an opportunity is created from within the potential customer's account, this relationship and its mapping is auto-populating this third party account lookup field with the customer's account in addition to the potential customer field.  I don't want this.

I'd like to avoid any need to write a plug-in to stop this (and I'm not sure I can even do that with a quick create form anyways).  I've found out I can't delete the mapping.  But can I safely delete the relationship without breaking the lookup field? 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Royal King Profile Picture
    27,686 on at

    If you delete relationship it will remove lookup field as well from the Opportunity entity.  Write a script to clear the custom lookup value if potential customer and custom lookup value contains same value .

    function clearCustomLookup() {
    if (Xrm.Page.ui.getFormType() == 1) {

    var cust = Xrm.Page.getAttribute("customerId").getValue();
    var cust1 = Xrm.Page.getAttribute("custom").getValue();
    if (cust != null && cust1 != null) {
    if (cust[0].id == cust1[0].id)
    Xrm.Page.getAttribute("custom").setValue(null);
    }
    }
    }

  • Phillip U. Profile Picture
    2 on at

    I considered this.  I've already got a nearly identical script in place on another form that has a similar lookup field issue but I'm not a big fan of doing this client side plus, it won't help tablet users as I understand it.  

    I guess it's time to hit Connect and suggest this be a configurable thing.

  • Royal King Profile Picture
    27,686 on at

    Javascript is executed in the tablet as well so you should be fine.

  • Peter Bohn Profile Picture
    on at

    Hi Philipp.

    You'll have my vote.

    This Problem exists since years and no one cares, esspecially  ms Not.

    But  i think...this is  a no go to need to write scripts to correct bugs which are really  i mean reeeaaaaallllly Bad Work from  ms.

    And  especially if  it is  such  easy to elaminate from ms side  

    just make no  automatic mapping for new lookups,when a lookup to the same entity  still  exists and/or make a mapping manually removeable .

    I am really Happy, that someone other has found the problem to.

    ...Band once again... IT EXISTS FOR YEARS...UNBELIEVABLE.

    greets  peb

  • Blundern Profile Picture
    2 on at

    Workaround to avoid code usage:

    Realtime workflow on create

    Check condition

    IF Opportunity:Account equals Opportunity:2ndAccountrelationship

    IF True

    Update and clear 2ndAccountRelationship field value

    Works great.

  • Conor Gallagher Profile Picture
    715 on at

    2 years later and still a bug! Writing a plugin or JavaScript to fix this is such a hack. For the plugin you really are just guessing if the fields were mapped with these values or if the user did actually select them. JavaScript on-load is a tad safer... but how do you know which relationship they came from?

    Did you ever raise that connect bug Phillip? I'll give it a vote if you did!

  • Community Member Profile Picture
    on at

    It's 2017 and I have this issue too.

    Is there anything out there that facilitates that?

  • Piotr Gaszewski Profile Picture
    424 on at

    2019 - issue still exists :D

  • meelamri Profile Picture
    13,216 User Group Leader on at

    2020 :)

  • waleedbinafzal Profile Picture
    347 on at

    Here is 2021, the issue is still the same.

    Going to use workflow for this to work for now.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans