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

Announcements

News and Announcements icon
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
    306,859 Super User 2026 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
    240,534 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 341 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 312

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 262 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans