blocking validation when creating SO using AIF in ax 2012

Hi All,

When I create SO using batch job using AIF how to block a validation method of a field in sales table. The validation should run normally when posting SO manually but when creating using AIF that method should be blocked. the method to be blocked. please suggest how to block validation how the difference can be given for manual processing and process by AIF. please suggest a solution.

Thanks in advance,

Gopinath

Hi All,

How can we differentiate a process whether running manually or running through AIF service batch job. please suggest an answer please.

Thanks,

Gopinath

What do you mean by posting SO?

Do you mean skipping the validation while creation of sales order or posting the sales order?

If the validation shouldn’t happen in all cases, is it implemented at the right place?

Hi Kranthi,

here SO is created both sometimes manually and sometimes using AiF , a particular field validation should not happen when SO is created using AIF and the validation of the same field should happen when creating SO manually. SO i need to know how to differentiate a process is running manually and it is running through AIF. Please suggest an answer.

Thanks in advance

Hi Martin,

The validation should not happen only while creating creating Sales order using AIF. The validation for that field is inserted as a method in salestable → method → tecCheckCustomerRef .i want to block this method only Please suggest an answer.

Thanks in advance,

Gopinath.M

Where do you have your code to validate that field? The AIF will call the validateField and validateWrite on table before saving the record. (look at \Classes\AxInternalBase\doSave)

So think about placing your validation in a place that AIF will have no effect.

Hi Kranthi,

I wanted to block a method which is present in salesTable which is called after the method validatefield in salestabletype class. I wanted to know whether the validatefield method in salestabletype will be called when running a process through AIF. Please suggest an answer.

Thanks in advance,

Gopinath

You can see the series of events that are triggered.

Yes.

Hi Kranthi,

Thanks for your response, but I have a small doubt, is there any field value or any flag value is there which will differentiate the manual process and proces through AIF like boolean value to apply condition as if(aifIsrunning) { — do the action— } else return like that? If we can differentiate using code please help me how to do so please suggest an answer.

Thanks in advance,

Gopinath M

You can override the validateField method on AxSalesTable class and skip the validation for that field.

or

Create another field and set it only when the order is created through AIF and based on that field value decide whether to do the validation.

Hi Kranthi,

There is no validatefield method in the class AxSalesTable class, Can you please explain how to achieve blocking a field validation for AIF.

Thanks,

Gopinath M

You need to override.

Hi Kranthi,

What I did was, in AXInternalBase class validatefields method I skipped validation for that particular table field alone like below

//if(tableId != tableNum(SalesTable) && fieldId != fieldNum(SalesTable,CustomerRef))
//{

this.validateField(dictField.id());

// }

but this is not working , skipping validation will it work ? Please suggest an answer.

Thanks,

Gopinath M

I haven’t told you to modify the AXInternalBase. You need to modify the related class -AxSalesTable

For reference see, \Classes\AxEcoResProductMaster\validateField

Hi Kranthi,

I have a small clarification kranthi, want to when the Classes\AxSalesTable\ validatefield will hit, whether it is called next to AXInternalBase class validateField. Please suggest me the flow of the method.

Thanks in advance,

Gopinath M

If you override the validatefield on AxSalesTable, then validate field on AxSalesTable will be called. The super() AxSalesTable.validate() will call the AXInternalBase.validateField().

If you are trying to modify the AxSalesTable.validate(), then skip calling super() for the field that your are trying to skip the validation.

Example -

If (_fieldid != yourFieldId)

{

super(_fieldid );

}