Thursday, November 02, 2006

Custom Validation Modifications to AIF

Yesterday I was able to fully setup a custom validation within AIF. The validation was regarding ItemIds (Part Numbers) in AX. Out of the box, when the 'createListSalesOrder' action is executed on an inbound XML Sales Order, the entire process halts upon validation of an invalid ItemId (one that is not in the Item List (InventTable). I developed a workaround to check for the current ItemId's existence in the InventTable and if it's not present, replace the invalid ItemId with a valid catch-all ItemId, which will allow AIF to continue processing the Sales Order. So far this modification has been successful.

In general terms, you can make customizations to any of AIF's transactions simply by modifying the appropriate parm[field_name] method within the appropriate Ax[Table] class for the field that you want to add addition customizations on. In my example, I modified the parmItemId method within the AxSalesLine class. Here is the new parmItemId() method with my modification:

public str parmItemId(str _itemId = '')
DictField dictField;
ItemId tempItemId;
InventTable tempInventTable;

//My custom code to validate ItemId's existence in the Item Master and replace w/ 'InvalidItem' if not
tempItemId = _itemId;
SELECT FIRSTONLY ItemId FROM tempInventTable WHERE tempInventTable.ItemId == tempItemId;
if (tempInventTable.ItemId != _itemId)
_itemId = "**INVALIDITEM**";
salesLine.ItemId = _itemId;
salesLine.Name = tempItemId;

if (!prmisdefault(_itemId))
dictField = new DictField(tablenum(SalesLine),fieldnum(SalesLine,ItemId));
if (this.valueMappingInbound())
item = _itemId;

this.setField(fieldnum(SalesLine, ItemId), _itemId);

if (this.valueMappingOutbound())
return conpeek(this.axSalesItemId(salesLine.CustAccount,salesLine.ItemId,salesLine.inventDim()),1);
return salesLine.ItemId;

Although this is my first shot at AIF modification, I would recommend placing your modification above the existing code. The out of the box code does other validations and checks like seeing whether or not AIF should place default data into a field.

Hope this helps!


Anonymous said...

For Sale By Owner makes selling a home on your own easy. We sell the most houses for sale by owner, proving our house selling strategies sell more homes than any site in home selling.

Real Estate

Luxury Homes and luxury real estate for sale in California, Florida, Arizona, Nevada, New York, Texas, France, Beverly Hills, Hollywood, Hollywood Hills, Malibu.

Real Estate
Real Estate

Anonymous said...

Hello David, did you ever try using the freeTextInvoice inbound? I seem to be getting an XML schema error whenever i try, where my createSalesOrder is working like a charm.

Anonymous said...

Dave did you try using the createFreeTextInvoice inbound? I cant get it to work, keep on getting the schema validation errors while createSalesOrder works like a charm

Anonymous said...

Hi Dave,

I have come across your note regarding ReadList action type here:

Your blog has no reference to this particular action. Would you mind sharing the steps/code that are needed to create such action type?

Thank you in advance!


Omar Cruz said...

I like this blog is fantastic, is really good written. Congratulation. Do you want to see something more? Read it...: Great investment opportunity in Costa Rica: houses for sale, homes for sale, investment property. Visit us for more info at:

wow power leveling said...

welcome to the wow power leveling cheap wow power leveling service site, buy cheap wow gold,wotlk gold,world of warcraft power leveling buy wow gold

Anonymous said...

Many institutions limit access to their online information. Making this information available will be an asset to all.
Custom Paper Writing

Anonymous said...

Thanks were a beverly hills real estate blog that caters to blog readers in cheviot hills and beverly hills. So thanks and well pass on out our senior club too, to read your blog,Beverly Hills Real Estate.

Anonymous said...

Post, thanks were a beverly hills real estate blog that caters to blog readers in cheviot hills and beverly hills. So thanks and well pass on out our senior club too, to read your blog
Beverly Hills Real Estate Agents

santosh singh said...

Your all posts are nice. This is another blog which i get very useful for dynamics learner

charlesalvarez23 said...

I like your blog. It was incredible and well written. I was impressed with your thoughts. Big thanks and keep sharing.

philippine homes

Prologic Corporation said...

This is a good article & good site.Thank you for sharing this article. It is help us following categorize:
healthcare, e commerce, programming, multi platform,inventory management, cloud-based solutions, it consulting, retail, manufacturing, CRM, technology means, digital supply chain management, Delivering high-quality service for your business applications,
Solutions for all Industries,
Getting your applications talking is the key to better business processes,
Rapid web services solutions for real business problems,
Web-based Corporate Document Management System,
Outsourcing Solution,
Financial and Operations Business Intelligence Solution,

Our address:
2002 Timberloch Place, Suite 200
The Woodlands, TX 77380