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 AX (Archived)

HCMWorkerLookup how to save RecId

(0) ShareShare
ReportReport
Posted on by

Hi there,

In my Microsoft Dynamics AX 2012 R3,  I've created a Reference group with EDT HcmWorkerRecID.  This gives me the lookup I need.

6014.AOT.JPGProperties.JPG

When I selected the worker and click a Select button the name shows properly. My issue is that I don't know how to save the selected worker name RecId.

For testing purposes, I used info:

public void lookup()
{
super();
info(strFmt("1%- 2% - 3%", ReferenceGroup.value(),
ReferenceGroup.valueStr(), ReferenceGroup.toString() ));
}

Unfortunately, the info didn't show me any value.

Could you show/advice me how to show the worker RecId in my info after I selected the worker from the drop-down list? 

Thank you,

Petr

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    You may have to approach this a different way.

    Perhaps you make a new field for the recID on the table you want and in relations, relate it to HCMWorker.  This should by default make the drop down you want, and save the recID on your new table.

    You can confirm that drop down / lookup works for you by opening the table in 'table browser' and seeing the drop down there.

    If it doesn't work for the form you want the new field on, then you can override that lookup method and have it execute some logic to recreate it.  If you need some lookup code, let us know.

    Good luck

  • Community Member Profile Picture
    on at

    Thank you, Beau, for your quick reply. Unfortunately, I don't want to do any changes in tables. My drop/lookup works in my form. The form shows the selected name(picture below).

    SelectStage2.JPGSelectStage2.JPGSelectStage3.JPG

    Could you provide some example of code in lookup method, so I can show the worker's name and their RecId by using info()?

    In Microsoft Dynamics AX 2012 R1 version I used some complicated code that doesn't work in R3 version.

     

     
    Beau S responded on 11 Apr 2017 9:14 AM

    You may have to approach this a different way.

    Perhaps you make a new field for the recID on the table you want and in relations, relate it to HCMWorker.  This should by default make the drop down you want, and save the recID on your new table.

    You can confirm that drop down / lookup works for you by opening the table in 'table browser' and seeing the drop down there.

    If it doesn't work for the form you want the new field on, then you can override that lookup method, and have it execute some logic to recreate it.  If you need some lookup code, let us know.

    Good luck

  • Suggested answer
    Community Member Profile Picture
    on at

    looking back at your original question I think you're looking at the wrong object in your info()

    // referenceGroup should be the object below that called "referenceGroup_DirPerson_FK_Name" (remember to set autodeclaration to yes)

    info(strFmt("1%- 2% - 3%", ReferenceGroup.value()  

    ReferenceGroup.valueStr(), ReferenceGroup.toString() ));

  • Suggested answer
    Community Member Profile Picture
    on at

    you EDT has formHelp in the properties?

    1884.worker.png

    That way you will return the recid and not the worker id.

  • Community Member Profile Picture
    on at

    Thanks Beau. I already tried to set an auto declaration to yes on my object referenceGroup_DirPerson_FK_Name, but for some reason, the property of the object is disabled, and I don't find a way how to change the auto declaration to yes. The object doesn't even have methods available. 

    Properties2.JPG

  • Community Member Profile Picture
    on at

    Hi Tatiana. Thank you for your reply. Yes my EDT has formHelp.  I am a new in AX. Could you provide/advice me with the code that I need to get the recId and the name of the worker?

    EDTProperties.JPG

    Thank you.

  • Community Member Profile Picture
    on at

    First let me understand your requirement, you want to show in somewhere the worker id and recid from the HcmWorkerLookup form?

    the field related to that lookup what field is returning? the worker ID?

    like this:

    employee.png

    Im returning the recid here.

  • Community Member Profile Picture
    on at

    Hi Tatiana. My second post includes exactly the same image like yours. Right now, I can select the person from my drop-down list and when I finished the name of the person is there(an example is in my second post). I don't know how to save/print out (using info() ) the person's name and their RecId.  Most likely I am using the the wrong method to get the name and RecId.

  • Community Member Profile Picture
    on at

    but to get the recid you need to call the field, and that's it:

    I calling the field in the table:

    if(PurchTable.WorkerPurchPlacer != HcmWorker::findByPerson(DirPersonUser::find(curUserId()).PersonParty).RecId)

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans