Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 1 PlanDynamics 365 release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.
2022 release wave 1 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
so i have one scenario, where I need to reflect all the fields of a table to another form which doesn't have any datasource and fields. It totally depend on the user. If he add x data values then x fields should be reflected to new form .
You can add the ds of the first form to the second form and play with the visible properties of the fields.
You can use TempTable and fill it based on the values in the First form.
Finally, you can add unbounded fields to the second form and fill it out according to the selections in the first form.
Hi thnks for your answer, but the fields are dynamic and also, the type of fields will vary according to the user preference-it can be text,number,checkbox or anything, so how can i play with the visibility of the fields
You can do it in two different ways;
Set the AoutoDecleration property of the relevant field in the form design to Yes.
If it is clear which fields will be visible or not when the form is opened, it is most logical to write these codes in the form's init method
If the status of the fields will change while using the form, you can write it to active.
I got it little bit, but I want to tell the fields can be of any type. It can be text, number, dropdown,checkbox. eg. user has mentioned -
FieldName type length
A text 10
B check box NA
Now these fields should be reflected to the dynamic form with the type text and checkbox. User can change their name ,length ,type at any point of time.
I tried to implement the code - daxingdax.blogspot.com/.../create-fields-dynamically-on-form-ax.html in validatewrite of the ds of first form where we define the fields but wasn't successful.
Of course, you can create a form with code and run it in runtime, but I'm not sure if you really need such a thing. In the first form there is a table where you get the values from the user. Why not use the same table.
Also validateWrite is not a place where we would want to add this kind of code. If there is no very special situation, write it under a button as in the example.
Lastly, I can't see any serious errors in the example, but I have to try it to be sure (I may not have time during the day).
If you share with us the error you encounter while using it, we will try to help.
That table is still dynamic. I want to add the field according to the users preference. suppose the user want 3 text type fields then first i need to create 3 string data type fields. Still cant get it , how should i do it.
It's not exactly dynamic in the example you showed. There is a table and form in the background. Only the form has no design. It creates a new design with the fields of the table.
With a similar structure, you can add table-independent unbounded (without datasource and datafield value) controllers. You can assign an initial value. But in this case, it is not possible to have a grid-like structure. Each control can hold only one value.
Now this is an example- these fields can be infinite number. As soon as user saves the field, these fields should be reflected to other form according to their type. Hope you get it.
Below I have shared a code showing how to add unbounded fields to form design. I just added Int64 and string fields but other types can be added with similar logic. The field adding part can be converted into a method as in the other example, and you can send the type and orher values from the outside.
static void Dmr_ES_RunTimeFormDesign(Args _args)
// Create the form header.
form = new Form();
// Create the form design.
formBuildDesign = form.addDesign("Design");
// Add tabbed page controls, a grid control, and string controls.
formBuildTabControl = formBuildDesign.addControl(FormControlType::Tab, "Overview");
formBuildTabPageControl = formBuildTabControl.addControl(FormControlType::TabPage,"Details");
formBuildInt64Control = formBuildTabPageControl.addControl(FormControlType::Int64, "MyInt64UnboundedField");
formBuildStringControl = formBuildTabPageControl.addControl(FormControlType::String, "MyStringUnboundedField");
formBuildStringControl.text("My string Value");
args = new Args();
// Create the run-time form.
formRun = classfactory.formRunClass(args);
thanks for the code, but by this are we not creating the new form via code?/
I would like to ask in which method should I add this code? Should i add it in init method of the form where I will be showing fields?
Can you please tell where should this be written?
The sample code is just a static method which you can run from anywhere. And you can also put it anywhere.
The code will create a form dynamically. You should put the code in the place where you want to trigger the creation of the form. You can point an action menu item to the class that has this method, and then place this menu item in places where you want to trigger the creation/launching of this dynamic form.
Thanks for your reply. Will do so.
Business Applications communities