1

On Dynamics AX 2012 R3 CU8 when you use the wizard to create a document service, the system generates the schema for the different operations in the service. Is there a way to control what gets generated?

For example, if I create a query with HcmWorker as the parent and DirPerson as the child with just a few fields that I'm interested in, the system generates the schema with a few things I don't like, out of which I'll mention a couple below:

  1. It adds fields like AxdEntity_DirPerson_DirParty.Name even though I explicitly didn't include this field in the query

  2. The minOccurs on this field is 1, which doesn't work because it is a computed field. I prefer that this field is not included. If that is not possible, at least I would like to have minOccurs = 0

To make matters even more intriguing, the standard service (HcmWorkerImportService) for importing workers has the minOccurs = 0 for the Name field.

I'm trying to figure out how to control these values.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
RT.
  • 435
  • 2
  • 9
  • 25
  • After a little bit of research, I found that fields such as Name and NameSequence are added to teh schema because they are tagged as mandatory in the tables. I still don't know how Microsoft changes these values in their standard services. – RT. Oct 24 '15 at 12:13

1 Answers1

0

Have a look into the initMandatoryFieldsMap method from the AxdBase class and overwrite it if needed in your HcmWorkerImportService.

The initMandatoryFieldsMap method specifies which fields are mandatory in the XML that the document class sends or receives. This method is used to specify mandatory fields for the document without specifying them at the table level.

See: MSDN: Walkthrough: Creating a Service Using the AIF Document Service Wizard ("To override the initMandatoryFieldsMap method")

Example:

protected void initMandatoryFieldsMap() 
{ 
    super();   
    this.setParmMethodAsMandatory(classnum(AxdSalesOrder), 
                                  methodstr(AxdBase,parmDocPurpose)); 
}

See: AxdBase.initMandatoryFieldsMap Method

ztirom
  • 4,382
  • 3
  • 28
  • 39