Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
It has to be so easy.... but I cannot get it
I want to set the value of a field in a page from OnInit() event, but I can get it.
I have added the field "Gross Weight" in Sales Shipment Header (110), and I want it to be calculated (only if is 0) on page Posted Sales Shipment (130) event OnInit(). I know how calculate it, but I don't know how to assign the value to the field or control from the page.
Of course it will be better to set this value on the creation of the shipment, but for the moment I want to do it on the page.
can you show us the code what you have written.
please use onaftergetcurrentrec trigger
OnAfterGetCurrRecord trigger is the right place based on your requirement. OnInit will trigger only when you open the page.
If you navigate through multiple records using the navigation buttons (Next, Previous), OnInit will not trigger.
Finally I have modified the codeunit Sales Post (80) and established the field Gross Weight in the process of converting a Sales Header into a Sales Shipment Header.
Anyway, I will know how to set the value of a field/control in a page from C/AL. Any clue?
I believe the way you did is the best standard way of doing.
Dear Tomas, You should add your code in OnAftergetrecord as you may need to apply some filters before you can calculate the value. So once record is fetched you can apply your desired filters depending on current record and calculate your value. Depending upon your condition test you may simply assign your value. If you share your code we may suggest you in more better way.
Business Applications communities