locked
CRM 4: How to detect parent entity type RRS feed

  • Question

  • Hi all, here is the situation:

    I have created a custom entity with a picklist field, this entity appears as child entity for 2 system entities let them be: account and opportunity.

    My requirements when creating a record of this custom entity under a record of type account the picklist items are: item1, item2, item3

    if the record of this custom entity is under a record of type opportunity the picklist items are: item1

     

    I know how to deal with picklists, but I can't find a way to detect the parent entity typename property using javascript.

    Thursday, September 15, 2011 9:33 AM

Answers

  • you add two lookup field on form, and when create form type, detect two fields value
    daemon lin
    Thursday, September 15, 2011 10:34 AM
  • Hi Mostafa,

     

           you can also use following java script to find the parent entity type code

     

    // getting parent window context in child page

    var parcontext = window.top.opener.parent.Xrm.Page.context;

     

    //Getting Parent Object type code

    var parentEnityTypeCode = window.top.opener.parent.Xrm.Page.context.getQueryStringParameters().etc ;


    Guru Prasad
    Thursday, September 15, 2011 12:55 PM
  • try the following java script code for CRM 4.0 

    var Parenttypecode = window.opener.parent.document.crmForm.ObjectTypeCode ;

    var ParenttypeName = window.opener.parent.document.crmForm.ObjectTypeName ;

     


    Guru Prasad
    Thursday, September 15, 2011 1:09 PM

All replies

  • you add two lookup field on form, and when create form type, detect two fields value
    daemon lin
    Thursday, September 15, 2011 10:34 AM
  • Hi Mostafa,

     

           you can also use following java script to find the parent entity type code

     

    // getting parent window context in child page

    var parcontext = window.top.opener.parent.Xrm.Page.context;

     

    //Getting Parent Object type code

    var parentEnityTypeCode = window.top.opener.parent.Xrm.Page.context.getQueryStringParameters().etc ;


    Guru Prasad
    Thursday, September 15, 2011 12:55 PM
  • Please provide the code for CRM4
    Thursday, September 15, 2011 1:02 PM
  • try the following java script code for CRM 4.0 

    var Parenttypecode = window.opener.parent.document.crmForm.ObjectTypeCode ;

    var ParenttypeName = window.opener.parent.document.crmForm.ObjectTypeName ;

     


    Guru Prasad
    Thursday, September 15, 2011 1:09 PM