Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Parent/Child relationship field not being set on Create Related Record or Sub-Grid Create button

Posted on by Microsoft Employee

Hi All,

I have  two custom entities: proposal and claim. The proposal entity form has a sub grid for the related claims, with Entity Metadata configured for the sub grid. When the users click on create new record button specified in the sub grid Entity metadata, or on the "Create Related Record" button if configured. The field on the claim entity for the parent proposal is never set.

If we remove the proposal field off the form then the field is automatically set by the Portal on save. We require this field to be on the form so we can apply some filters to other lookups on the claim Entity form.

Since this is out of the box functionality in std CRM when creating a new record in a sub grid, how do we configure this for create new on a sub grid when enteracting with data via the portal?

*This post is locked for comments

  • Suggested answer
    Dmytro Rutkovskyi Profile Picture
    Dmytro Rutkovskyi 1,835 on at
    RE: Parent/Child relationship field not being set on Create Related Record or Sub-Grid Create button

    The field will be automatically set on Save as when you create it from subgrid, it loads create entity form with some query string params like refid="{{parentrecordid}}" which used to prefill parent record on the save.

    If you want to see this field at the form for your related lookup filtering, you can add custom Javascript to prefill its value and make it disabled like this:

    $(document).ready(function() {
    
    $.urlParam = function (name) {
        var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                          .exec(window.location.search);
        return (results !== null) ? results[1] || 0 : false;
    }   
    // proposal_parentid - let it be name of your parent field
    $("#proposal_parentid_name").val("access parent window to find proposal name");
    $("#proposal_parentid_entityname").val("proposal_crm_entity_name"); // put correct system entity name here 
    $("#proposal_parentid").val($.urlParam("refid")); // set correct id
    $("#proposal_parentid").parent().find(".input-group-btn").hide();
    
    });
    


  • Gopinath Gurusamy Profile Picture
    Gopinath Gurusamy 125 on at
    RE: Parent/Child relationship field not being set on Create Related Record or Sub-Grid Create button

    Hi,

    Please have a look at the below link, it might solve your issue.

    https://community.dynamics.com/crm/f/117/t/269771

    Thanks.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parent/Child relationship field not being set on Create Related Record or Sub-Grid Create button

    Hi Akhil,

    yes the field is mandatory on the Create Claim form.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Parent/Child relationship field not being set on Create Related Record or Sub-Grid Create button

    Hi,

    Did you try making the Proposal lookup on the Claim form mandatory? In that case the lookup should be pre-filled.

    Thanks,

    Akhil

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans