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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

pass date value between forms

(0) ShareShare
ReportReport
Posted on by 2,050

Greeting everyone

i've created a new form

in my new form if i selected worker i need to populate date on my form automatically from other form 

let me explain more

when chose worker

pastedimage1614680354893v3.png

i need to populate expiration date

from this form 

pastedimage1614680241318v2.png

so i crated modify method on worker grid

pastedimage1614680568382v4.png

and here my code

public boolean modified()
{
    boolean ret;

    HcmWorker   hcmWorker;
    HcmIdentificationType   hcmIdentificationType;
    HcmPersonIdentificationNumber   hcmPersonIdentificationNumber;
    int64 TypeId;
    int64 personId;
    date idend;


    select firstOnly RecId from hcmIdentificationType where hcmIdentificationType.Description =="Passport";
    TypeId=hcmIdentificationType.RecId;

    select Person from hcmWorker where hcmWorker.recid == this.value();
    personId=hcmWorker.Person;


    select ExpirationDate from hcmPersonIdentificationNumber where hcmPersonIdentificationNumber.Person==personId &&
    hcmPersonIdentificationNumber.IdentificationType==TypeId;
    idend=hcmPersonIdentificationNumber.ExpirationDate;


    Grid_ExpireDate.dateValue(idend);
    Grid_ExpireDate.modified();


    ret = super();


    return ret;
}

but still not change date on my custom grid

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi mohammed,

    as usual, please debug your code to understand what happens in it. Perhaps you already find the issue when you debug and take a look.

    If not, please let us know what you learned when you debugged. At least by then you should know what exact part of your code is not working.

    Next time, may I suggest that you debug even before posting a question - being able to share more details with us from the beginning - and getting your issue solved much quicker.

    Thanks!

  • Suggested answer
    Hussien Ahmed Profile Picture
    110 on at

    Hi Mohamed

    Why you didn't add the table which have the field to your form DataSource and create the relation between the two tables and use the field directly without any code.

  • mohammed.mqi Profile Picture
    2,050 on at

    here i the debug 

    pastedimage1614685095385v2.png

    pastedimage1614685120368v3.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Unfortunately we don't see much relevant info in your screenshots.

    Would you say that we should focus on these points:

    - Line 13 (evaluate whether the select statement returns something)

    - Line 16 (evaluate whether the select statement returns something)

    - Line 20 (evaluate whether the select statement returns something)

    - Line 22 (evaluate whether any value is passed to "idend" variable

    How do you see it? Personally I think that these lines are the ones that you might want to focus on when you debug.

    Please let me know your thoughts. Thanks!

  • mohammed.mqi Profile Picture
    2,050 on at

    thanks for replay 

    the issue about line 25 and line 26 not applay 

    so that not change or add date value to the field (ExpireDate) on gridview 

    how can i populate that field?

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    If I understood correctly, you were unable to find that the issue is in lines 25-26. So the issue is in setting value in the date control. Correct? So we can forget about "pass date value between forms" and focus on "how to set value in date control". And you are also saying that you have a date in "idend" variable. Correct?

  • mohammed.mqi Profile Picture
    2,050 on at

    yes your correct

    I thought in the beginning i can pass date value between forms but actually i need to set value in date control and the date from "idend"

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Ok, so let's try to remove everything that is irrelevant for troubleshooting this problem, and try to put this in the modified method (just to try it out):

    public boolean modified()
    {
        Grid_ExpireDate.dateValue(today());
    
        return super();
    
    }

    If you now modify your field (so that modified method is triggered), does the value in the date field update to today's date?

  • mohammed.mqi Profile Picture
    2,050 on at

    thanks for reply 

    i did as you said but still that field empty 

    as you see here

    pastedimage1614689035451v1.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Was the code executed? Did you debug it and verify that it's working?

    Anyway, since you're using a grid, this approach won't even work.

    First of all, a grid should always be linked to a data source table. Is your grid linked to a data source table?

    Second, you should use a display method to display calculated values on the grid.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 688

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 524 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 301

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans