Resources for IT Professionals > Dynamics Forums > CRM Development > Contracts not visible for Custom Entity
Ask a questionAsk a question
 

QuestionContracts not visible for Custom Entity

  • Monday, November 02, 2009 10:23 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello Community,

    Quick question: I've created a new Custom Entity for which I have created a different relationships to system entities, such as a relationship to the contract entity.

    Funny enough, when I try to lookup any contract to create a relationship between my custom entity and a contract, no contracts show up. My first thought was this had maybe something to do with the contract status, but I have different contracts in different status (draft, invoiced, cancelled) but still no contracts show up.

    My second thought was that maybe some filtering is done around the contract entity. So I created further relationships between my custom entity and the contact entity and the account entity. Unfortunately, selecting neither a contact nor a account for my custom entity, does the job. I still can't see no contracts.

    Funny thing is: My contracts are all valid (valid dates, contract templates, etc.) and they all have contract lines. So I created a new relationship between my custom entity and the contract line entity. Here I have no problem. I can select any contract line from my custom entity.

    Is there any pre-lookup-filtering done around the contract entity?

    Thanks a lot,
    Manuel
    manuel_altermatt@hotmail.com

All Replies

  • Tuesday, November 03, 2009 1:36 AMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Are you using any code on the Lookup field on your custom entity, such as the unsupported Lookup Filtering code from Adi Katz/Michael Hoene?  I personally have several custom entities in my deployment that are related to Contracts, and their Lookup fields work perfectly.

    Dave Berry
  • Tuesday, November 03, 2009 3:08 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dave,

    Thanks a lot for your reply. Unfortunately no, I am not using any Lookup Filtering code. Just a plain simple relation between my custom entity and the account.
    manuel_altermatt@hotmail.com
  • Tuesday, November 03, 2009 4:47 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Update: We've been doing some research and it seems that the lookup URL is wrong. Clicking "Advanced Search" Icon (next to the Field), the Search Lookup Dialogue is opened with the following URL:

    http://192.168.37.111/MicrosoftCRM/_controls/lookup/lookupsingle.aspx?class=null&objecttypes=1010&browse=0&ShowNewButton=1&ShowPropButton=1&DefaultType=0

    I believe the class=null is wrong and should rather be class=BasicContract.

    Any ideas why this may happen?


    manuel_altermatt@hotmail.com
  • Tuesday, November 03, 2009 5:38 PMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    "class=null" is fine, and appears in my custom deployments as well.  I believe this is because the "BasicContract" class you're talking about has parameters for the special view filters (Draft, Invoiced, etc.) which are available from any of the system entities that relate to the Contract.  What piques my curiosity is the parameter "DefaultType" which is being set to "0".  Question:  are you using CRM 3 or CRM 4?  How did you establish the relationship between the Contract and your custom entity?
    Dave Berry
  • Wednesday, November 04, 2009 12:57 AMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Dave,

    Thanks a lot for your time and interest in my problem.

    We're using CRM 4.0. Creation of the relationship was done through the standard, supported way: Settings - Customization - Customize my Custom Entity - Create a N:1 Relationship with the Contract Entity.

    Are you sure the problem could lie within that URL I mentioned? Using JavaScript, I changed the URL of the LookUp Dialoge to something like this and it worked like a charm. Suddenly I could see all Contracts:
     

    http://192.168.37.111/MicrosoftCRM/_controls/lookup/lookupsingle.aspx?class=BasicContract&objecttypes=1010&browse=0&parentId={B0090886-2CBF-DE11-A83D-0003FFEFDE03}&parentType=2&ShowNewButton=1&ShowPropButton=1&DefaultType=0

    But then again I understand you say your URL has the "class=null" parameter and it's working fine, right? Weird.

    Does anyone in the forum know about the DefaultType parameter that is set to "0"?

    Thanks again for your time !


    manuel_altermatt@hotmail.com
  • Wednesday, November 04, 2009 1:33 AMDavidBerry Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I couldn't find any particular reason that the DefaultType should need setting for this.  It's use is strictly for Lookup fields that reference many types of records (e.g. the Customer field can use Accounts or Contacts, so the DefaultType specifies which one is loaded first in the dialog window).  As for the class, I definitely have the Lookups on my custom entities using "null" there, and there is no problem viewing contracts.

    Have you tried tearing down the relationship and building it again?  It's possible that some platform operation failed when it was originally created, and you just don't know it.  Also, if that fails, try establishing a new custom entity with only a relationship to Contracts, and a single field on its form for the Lookup and test if the behavior is similar there.  Hopefully these simple tests will help identify the source of the problem.
    Dave Berry
  • Wednesday, November 04, 2009 2:56 PMManuel Altermatt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Dave,

    I will try to reproduce the error like you said and I will post my update.

    I've run into another small problem with the Contract Entity that I will post in a different post in this forum.
    Thanks
    manuel_altermatt@hotmail.com