Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How can I simulate by ...
Finance forum
Unanswered

How can I simulate by x++ the closing the form with cliking ok?

Posted on by 690
Hello,
 

I have following business case: The client has configurator module with some configuration models. While importing sales order some of the customers give attribute values and not exact configuration id. If the configuration connected with given attributes doesn't exists it has to be created during import. The creation of new configid is done using f. PCRuntimeConfigurator. The form is populated by attributes in form of /configuration/ (in xml), it does some logic inside the form and the result is /solution/ (in xml).  I have done steps to create /configuration/ based on attributes, run  the form, then the user has to click /OK/ button and I can take solution. The question is - how can I simulate by x++ the closing the form with cliking ok.  

The case 1 works, but with user cliking OK button, the case 2 doesn't work, form is opened and closed but solution is empty

1. Works with necessary user interaction
       .....
         runtimeConfiguratorForm.init();
    runtimeConfiguratorForm.run();
    runtimeConfiguratorForm.wait();

   PCConfigurationState = formRunObject.getConfigurationState();
   solution = PCConfigurationstate.parmboundvalues();
   ....

2. Doesn't work - /solution/ is empty
          .....
          runtimeConfiguratorForm.init();
     runtimeConfiguratorForm.run();
    runtimeConfiguratorForm.detach(); // I try with it and without it, 
    runtimeConfiguratorForm.closeok();  

   PCConfigurationState = formRunObject.getConfigurationState();
   solution = PCConfigurationstate.parmboundvalues();
  ....

 

Thank you.

  • Shooowtek Profile Picture
    Shooowtek 690 on at
    How can I simulate by x++ the closing the form with cliking ok?
    Hello Martin,

    I have debug closeok() method and when there is formrun.wait() in following code variable "solution" contains value and when there is formrun.closeok() without wait, "solution" is empty. 

    The standard closeok() code is as follows:

    public void closeok()
    {
         PCAdaptor adaptor;
         PCXmlParseConfigurationInstance xmlParseConfigurationInstance;

         using (var a = this.logger().runtime().closeOK())
         {
              str solution = PCRuntimeControl.xmlSolution();

              if(!solution)
              {
                   /.../
              }
         }
    }

     

  • Shooowtek Profile Picture
    Shooowtek 690 on at
    How can I simulate by x++ the closing the form with cliking ok?
    I've already tried runtimeConfiguratorForm.close() and that doesn't work either...
     
    Do you have any other ideas?
  • Martin Dráb Profile Picture
    Martin Dráb 228,552 Most Valuable Professional on at
    How can I simulate by x++ the closing the form with cliking ok?
    I would debug code in closeOK() to learn more about where things go wrong.
  • MuthukumaranAX Profile Picture
    MuthukumaranAX 2,899 on at
    How can I simulate by x++ the closing the form with cliking ok?
    i assume "runtimeConfiguratorForm" is formrun object. in that case can you try calling close method?
    runtimeConfiguratorForm.close();

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans