Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : 6bPnBhdC2+l/Z77Tn5n2Sg
Finance | Project Operations, Human Resources, ...
Unanswered

Product configurator UI not refreshed after updating the xml D365 x++

Like (0) ShareShare
ReportReport
Posted on 18 Jun 2021 12:34:55 by 85

Please help me to update the Product configuration attribute value from custom field. I am able to update xml but form is not refreshing with updated xml.

pastedimage1624019555849v1.png

Tried below code:-

str configuredProductXML;

FormDataSource fds = sender.formRun().dataSource();// as PCRuntimeConfiguratorInfo;
PCRuntimeConfiguratorInfo RuntimeConfiguratorInfo = fds.cursor();
PCProductConfigurationModel productConfigurationModel ;//= PCProductConfigurationModel::findByName("LOGO");
//PCRuntimeControl runTimeControl = sender.formRun().design().controlName(formControlStr(PCRuntimeConfigurator,PCRuntimeControl));
FormControl itemSearch = sender.formRun().design().controlName(formControlStr(PCRuntimeConfigurator,WfsItemSearch));
FormTabPageControl tabPageCtrl = sender.formRun().design().controlName(formControlStr(PCRuntimeConfigurator,tabBody));
str item = itemSearch.valueStr();
FormRun fr = sender.formRun();
PCRuntimeControl runTimeControl = fr.parmPCRuntimeControl();
productConfigurationModel = fr.parmPCProductConfigurationModel();
//Info(strFmt("%1",runTimeControl.xmlModel()));
XmlDocument xmlDocument = XmlDocument::newXml(productConfigurationModel.getXML());
str modelXML = productConfigurationModel.getXML();
//Microsoft.Dynamics.AX.fr.Application.FormControlProxy runtimecontrolProxy = new Dynamics.AX.Application.FormControlProxy(runTimeControl);
//str XMLModel = new Microsoft.Dynamics.AX.Application.FormControlProxy(runTimeControl).CustomControlProperties[6];
System.String values;
values = '<Assignments>' ;//+
if(item != "")
{
values += '<Assignment xPath="ITEMNUMBER" value="'+item+'" />';// +
values += '<Assignment xPath="PROOFPLATE" value="'+item+'" />';// +
}
values +='</Assignments>';

PCRuntimeSynchronousConfigurator configurator = PCRuntimeSynchronousConfigurator::construct();
configurator.parmSolverStrategy(productConfigurationModel.getSolverStrategy());

Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.IsConfigurationComplete isConfigurationComplete;

isConfigurationComplete = configurator.configure(modelXML, values);
if (isConfigurationComplete ==
Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.IsConfigurationComplete::Complete)
{
configuredProductXML = configurator.getAllAssignedValues();
}


Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.IConfigurator configuratornew = Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.Configurator::Create(modelXML,true);
configuratornew.LoadAttributeValues();
configuratornew.AssignAttributeValueByXPath("ITEMNUMBER",item);
CLRObject configuratorCLR;
configuratorCLR = configuratornew;
runTimeControl.xmlModel(configuredProductXML);
runTimeControl.solverStrategy(productConfigurationModel.getSolverStrategy());
runTimeControl.columns(productConfigurationModel.Columns);

runTimeControl.attributeChanged("ITEMNUMBER",item);
configuratornew.StartSession();
configuratornew.WaitForIdleStateSync();

runTimeControl.editAutoPostback(true);
runTimeControl.resetUserSetting();
fds.reread();
fds.refresh();

  • Amitbansal Profile Picture
    5 on 28 Jun 2021 at 13:31:03
    RE: Product configurator UI not refreshed after updating the xml D365 x++

    It is Not working for me

  • Pupadhyay Profile Picture
    85 on 28 Jun 2021 at 07:50:29
    RE: Product configurator UI not refreshed after updating the xml D365 x++

    Hi Hossein,

    It didn't worked for me. Actually this form loads from xml

  • Hossein.K Profile Picture
    6,646 on 21 Jun 2021 at 08:54:34
    RE: Product configurator UI not refreshed after updating the xml D365 x++

    Hi Pupadhyay,

    To do this , use fds.Research(); instead of fds.reread(); or fds.refresh();

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,327 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,243 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans