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)

Update on latest date

(0) ShareShare
ReportReport
Posted on by 40

Hi There,

I have created an entity where there is an attributes for expected date of closure. In this entity, there is a sub-grid where there are 3 attributes for "expected date of closure". What i want is that main page "expected date of closure" gets updated with latest date available in sub-grid 3 attributes of "expected date of closure". Please help if it is possible.

Thanks in advance

Hanshu

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Piyush Paliwal Profile Picture
    817 on at

    This is very much possible. Follow these simple steps to get it done. The trigger point of this logic would play an important role in deciding the overall performance of the solution.

    • Write a plug-in on post creation or post update of the record in sub-grid
    • In your plug-in code, retrieve all the child entity records which are associated with that particular parent entity.
    • Once you have this data just identify the latest date from all of the records. There are multiple ways of doing it but am sure you are a .net developer and would be able to figure out how this identification has to be done.
    • After identifying the date, just update the parent record with this date and you are done.

    Let me know if this helps.

  • Community Member Profile Picture
    on at

    To be honest, even if I have long deadlines I always write my essays at the last moment, I can't put myself to write them peacefully with some days prior. This is why I am always using editing services as due to lack of time I can't concentrate on writing them without mistakes. However, I pay attention to the college essay editing cost because as a student I can't afford every service, but there are many who offer qualitative services at a reasonable price.

  • Miasm1 Profile Picture
    2 on at
    Hi Hanshu,
    it is possible to achieve what you're looking for. You can use JavaScript to fetch the values of the "expected date of closure" from the sub-grid attributes and then update the main page attribute with the latest date. You'll need to add a script on the form that contains this entity.
    Here's a high-level example using JavaScript and assuming you're working with a CRM-like system:
     
    // Assuming 'Xrm' is the CRM client object model
    var subgridControl = Xrm.Page.getControl("your_subgrid_name");
    
    if (subgridControl != null) {
        var rows = subgridControl.getGrid().getRows();
    
        // Initialize with a date in the past
        var latestDate = new Date(1900, 0, 1);
    
        // Iterate through subgrid rows to find the latest date
        rows.forEach(function (row, index) {
            var dateValue1 = row.getData().getEntity().getAttributes().get("new_date_attribute_1").getValue();
            var dateValue2 = row.getData().getEntity().getAttributes().get("new_date_attribute_2").getValue();
            var dateValue3 = row.getData().getEntity().getAttributes().get("new_date_attribute_3").getValue();
    
            // Update latestDate if a newer date is found
            if (dateValue1 != null && dateValue1 > latestDate) {
                latestDate = dateValue1;
            }
            if (dateValue2 != null && dateValue2 > latestDate) {
                latestDate = dateValue2;
            }
            if (dateValue3 != null && dateValue3 > latestDate) {
                latestDate = dateValue3;
            }
        });
    
        // Update the main page attribute with the latest date
        Xrm.Page.getAttribute("new_expected_date_of_closure").setValue(latestDate);
    }
    
    "new_date_attribute_2," "new_date_attribute_3," and "new_expected_date_of_closure" with your actual sub-grid name and attribute names.
    This script assumes you are using the CRM client object model. Adjustments may be needed based on the specific platform or framework you are working with.
     
     
    I hope this will help 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…

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