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));
this.validateInboundItemIdString(_itemId,dictField);
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);
}
else
{
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!

12 comments:

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.

vmichnik@yahoo.com

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:

http://www.microsoft.com/Businesssolutions/Community/Newsgroups/dgbrowser/en-us/default.mspx?query=pack+map&dg=microsoft.public.axapta&cat=&lang=en&cr=US&pt=&catlist=8d3f188d-a0E9-40e4-86e2-46508a35c759&dglist=&ptlist=&exp=&sloc=en-us


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!

Eli. egoby@yahoo.com

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: http://www.jaco-bay.com/

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

Research Writer said...

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

url 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.

url 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
http://daynamicsaxaptatutorials.blogspot.com/

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
281-364-1799

prologic-corp