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 :
Finance | Project Operations, Human Resources, ...
Answered

How to populate one field data to other form field - During a create action

(0) ShareShare
ReportReport
Posted on by 204

Hi,

There is one  form1 with field item id. 

Once you click on "Create" button in action pane, another dialog form2 opens, where there is a field names item id. 

Now once create action is initialized, the form 1 item id must be auto populated in the item field in form 2 dialog form. 
 
Both the form uses same table. 

I used init method on form 2, but it is not working.  Any help?

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,210 Super User 2025 Season 2 on at

    Hi RSX,

    Are you able to share the code you used in the init() method? Can you also describe what you mean with "is not working"? Do you get an error or a wrong or empty record?

  • RSX Profile Picture
    204 on at

    Hi Andre,

    Is not working means, there is no error, But it is showing empty record only.

    Code ::

    Comx_AdditionalDetails     gAdditionalDetails;   //globally declared

    public void init()

       {

           super();

           if(element.args().record().tableId == tableNum(Comx_AdditionalDetails))

           {

               gAdditionalDetails = element.args().record();

               Comx_AdditionalDetails.itemNumber = gAdditionalDetails.itemNumber;

           }

       }

  • Verified answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    Is the Comx_AdditionalDetails record already saved in DB?

    If so, you should set a filter on the form instead of trying to populate the field only.

    It it's not, I think that the contents of Comx_AdditionalDetails gets overwritten when a new record gets created automatically (or maybe there is no record at all). initValue() of the data source may be a good place for this logic.

    Also, please always use Insert > Code (in the rich formatting view) to paste source code. It'll be easier to read and copy:

    Comx_AdditionalDetails gAdditionalDetails; //globally declared
    
    public void init()
    {
       super();
       
       if (element.args().record().tableId == tableNum(Comx_AdditionalDetails))
       {
    	   gAdditionalDetails = element.args().record();
    	   Comx_AdditionalDetails.itemNumber = gAdditionalDetails.itemNumber;
       }
    }

  • RSX Profile Picture
    204 on at

    Hi Martin,

    Thank you.

    I used initvalue and now the value is getting updated.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans