Product configurator – Front-end call stack

Instantiate and load front-end

1. Starting Point

  • Called by PCExecuteVariantConfiguration
  • Form PCRuntimeConfigurator
  • Class PCRuntimeConfiguratorFormFactory.create

 2. First the model is loaded into an XML

  • PCRuntimeLibrary::getModelXMLIL –> Only Model, no values (Values come only in Step 4.)
  • Calls PCXmlSessionWriterModel.writeModel
  • Calls PCXmlSessionWriterComponent.write
  • Calls PCXmlSessionWriterComponentAttribute.write

3. Using the .Net Class is used to process the xml

  • Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.Iconfigurator
  • Instantiated in PCRuntimeConfigurator.loadModel

4. Assign Values to front-end

  • Triggered by PCRuntimeConfigurator.loadAttributeValues()
  • PCConfigurationLoader.runIL
  • PCConfigurationLoader.loadValues

5. Frontend-Handlers

  • The Font-End calls PCRuntimeUIConfigurator.userSelectedValue to assign user selected values to front end.

Save front-end results

1. Front-end returns XML

  • Processed by PCXMLParse… classes
  • e.g. PcXmlParseComponentAttribute.parseIL (modified for config description – hidden attributes)

2. XML Parser returns PCAdaptor… classes that do the further processing

  • PCAdaptorVisitorConfigurationReuse: handle reusability of configurations
    • PCAdaptorComponent.createReuseConfiguration
    • PCAdaptorComponent.reuseConfigurationExists()
  • PCAdaptorVisitorBOMGeneration: create BOM

3. Finally update the Sales Line

  • PCExecuteVariantConfiguration.updateDemandSourceDocumentLine

Add document to record

Simple code snippet to add a document attachment to a record:

static void addDoc( Common common,
                    DocuTypeId docuTypeId,
                    FileName fileName)
{
    DocuRef docuRef;
    DocuValue docuValue;

    if(common && docuTypeId)
    {
        ttsBegin;
        docuRef.clear();
        docuRef.initValue();
        docuRef.TypeId = docuTypeId;
        docuRef.Name = filename;
        docuRef.RefRecId = common.RecId;
        docuRef.RefTableId = common.TableId;
        docuRef.RefCompanyId = curext();
        docuValue.initFromDocuRef(docuRef);
        docuValue.insert();
        docuRef.ValueRecId = docuValue.RecId;
        docuRef.insert();
        ttsCommit;
        if(filename)
        {
            DocuValue::writeDocuValue(docuRef,filename); //after ttsCommit to enable catching of file system errors
        }
    }
}

How to get radio buttons on a dialog

There is no dialog.addRadioButtonContol(…) function so how do you do it?

static void Job1(Args _args)
{
    Dialog                dialog;
    FormRadioControl      formRadioControl;
    FormBuildRadioControl formBuildRadioControl;
    FormBuildGroupControl formBuildGroupControl;
    int                   formBuildRadioControlId;
    ;
    //Build dialog with radio buttons
    dialog = new Dialog("Test Dialog");
    formBuildGroupControl = dialog.mainFormGroup();
    formBuildRadioControl = formBuildGroupControl.addControl(FormControlType::RadioButton,'radiobuttons');
    formBuildRadioControlId = formBuildRadioControl.id();
    //set number of buttons
    formBuildRadioControl.items(3);
    //add descriptions
    formBuildRadioControl.item(1);
    formBuildRadioControl.text("Radiobutton 1");
    formBuildRadioControl.item(2);
    formBuildRadioControl.text("Radiobutton 2");
    formBuildRadioControl.item(3);
    formBuildRadioControl.text("Radiobutton 3");
 
    if(dialog.run())
    {
        if(formBuildRadioControl)
        {
            //get control
            formRadioControl = dialog.formRun().control(formBuildRadioControlId);
            //get index
            info(strfmt("Radiobutton %1 selected",formRadioControl.selection()+1));
        }
    }
}

Un-mark transactions marked for settlement

Scenario:

  • If you go to Vendors>>Functions>>Open transactions editing you can identify transactions that have been marked for settlement by the red hand in he "Is marked" column. Un-marking these transactions works only by finding the offset transaction and deleting the link from there.

Issue:

  • I came across transactions that have been identified as marked, however I did not know where the transactions are marked. The marking was created in one case because an update conflict occurred in the payment journal which cause the processing of the payment, casing the marked offset transaction to be lost but the transaction to be settled remained marked; in another case I think someone started to create a credit adjustment note, but deleted the credit adjustment before completing however the marking remained.

Investigation:

  • In the open transactions editing form (Vendors>>Functions>>Open transactions editing or Customers>>Functions>>Open transactions editing) and find the problematic transaction.
  • Go to Inquiries>>Specification and research the offset transactions. Try to un-mark the transaction with traditional means (i.e. Function>>Open transactions editing on the sales order etc.)
  • If you find a problem an want to continue with removing the marking then right click on the record in "Open transactions editing", select "Record info">>"Show all fields" and make a note of the Record-Id.
  • The next step must be done in the AOT using the table browser to directly access the data of certain tables. This is dangerous and definitely not good practice. However I do not know better and would appreciate if someone could show me how to do it better.
  • The table SpecTrans contains all transactions marked for settlement. Find th record-id you previously made a note of in the column RefRecId.
  • Delete the found SpecTrans record to remove the marking.

Better solutions?

If you have a cleaner and better solution, please tell me how you do it?

Thank you

Thomas

Restore Sharepoint WSS 2 Database

I was trying to upgrade to WSS 3 and something failed so I wanted to return to WSS 2 so I reinstalled WSS 2 and tried to attached my backuped databases. I received the "Database ‘Database_Name’ already exists. (Error code:1801)" error message which I could resolve by following KB828815. But then I received the a further error message which seemed to reflect a version confilct that I could not solve. So I decided to copy the database manually with the following steps:
  1. Create a New Site (including new content database e.g. STS_new_234)
  2. Use the SQL Server management studio to attach/restore the old content database e.g. STS_old_123)
  3. Get the new SiteId from the [STS_new_234].[dbo].[Sites] e.g. {61806ab3-c940-4867-8f5a-629c0036e6bd}
  4. Copy the data of all tables (exept Sites) from the STS_old_123 to STS_new_234 and rename the field SiteId to the new SiteId in the process e.g.
    INSERT INTO [STS_new_234].[dbo].[NavNodes]
    SELECT ‘61806ab3-c940-4867-8f5a-629c0036e6bd’
          ,[WebId]
          ,[Eid]
          ,[EidParent]
          ,[NumChildren]
          ,[RankChild]
          ,[ElementType]
          ,[Url]
          ,[DocId]
          ,[Name]
          ,[DateLastModified]
          ,[NodeMetainfo]
          ,[NonNavPage]
          ,[NavSequence]
          ,[ChildOfSequence]
      FROM [STS_old_123].[dbo].[NavNodes]

    Note: The most important tables: Docs, Links, NavNodes, UserData, UserInfo, WebCat
  5. Modify the [STS_new_234].[dbo].[Webs]:
    • First make the old root a sub-site by editing FullUrl and setting ParentWebId to the new root.
    • If all is now well try and exchange the new root with the old root (again by editing FullUrl and ParentWebId accordingly).

NOTE: The whole issue probably could have been avoided by running PRESCAN on all the existing databases BEFORE starting to upgrade.