tag:blogger.com,1999:blog-34787934188504977072024-03-06T01:29:26.832-08:00Dynamics AxDynamics Ax 2009/ 2012Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-3478793418850497707.post-49412111729944402502017-05-31T00:37:00.000-07:002017-05-31T00:37:00.264-07:00Copying data from one legal entity to another for a group or setup<div dir="ltr" style="text-align: left;" trbidi="on">
In many multi company implementation, the data setup becomes a time consuming activity especially when the setup needs to be copied from a master legal entity. A typical example may be customer group or delivery terms that are common across all legal entities. If you have a lot of legal entities, DIXF will be an ideal method but it is time consuming. For consultants, who need to speed up things and who understands the basic table structure, they can use the below code (in form of a runnable job) to copy data between legal entities for a table. You would need to select the table and use the parameter for providing from and to legal entities, Select the "Insert and Update" checkbox if you need to update the records in the target legal entity. <div>
<br /></div>
<div>
This script will only work for tables having a clustered index (unique non recid index). It will find the fields comprising unique index and select the target table using those fields. If the record is not found then it will create. If the record is found and the parameter "Insert and Update" is set then it will just update the record.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfi81-GDZ0iC_jsF5t-j18DkzvCyWU-AmZ1i-LglrdJPPU5F0bFy4zmiWv5gGdqCjuMffli87GmSXgVD3KNVt587Ahs8uARMpC1FLFhKHPL5KpIJkIiQiIkFc9kOOLOAsGxwm8yLnsBxw/s1600/dialog+legal+entities.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="269" data-original-width="342" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfi81-GDZ0iC_jsF5t-j18DkzvCyWU-AmZ1i-LglrdJPPU5F0bFy4zmiWv5gGdqCjuMffli87GmSXgVD3KNVt587Ahs8uARMpC1FLFhKHPL5KpIJkIiQiIkFc9kOOLOAsGxwm8yLnsBxw/s320/dialog+legal+entities.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
static void CopyDataBetweenLegalEntities(Args _args)</div>
<div>
{</div>
<div>
DictTable dt; </div>
<div>
DictIndex di; </div>
<div>
DictField field; </div>
<div>
int i; </div>
<div>
Query queryFrom, queryTo;</div>
<div>
QueryRun queryRunFrom, queryRunTo;</div>
<div>
QueryBuildDataSource qbr1, qbr2;</div>
<div>
QueryBuildRange queryRange;</div>
<div>
Common fromCommon, toCommon;</div>
<div>
Dialog dialog;</div>
<div>
DialogField dfFromCompany, dfToCompany, dfTableName, dfInsertUpdate;</div>
<div>
str tableName;</div>
<div>
CompanyId fromCompany, toCompany;</div>
<div>
boolean insertUpdate;</div>
<div>
</div>
<div>
dialog = new Dialog("Enter company and table information");</div>
<div>
dfTableName = dialog.addfield(extendedTypeStr(TableName));</div>
<div>
dfFromCompany = dialog.addField(extendedTypeStr(CompanyId), "From Company");</div>
<div>
dfToCompany = dialog.addField(extendedTypeStr(CompanyId),"To Company");</div>
<div>
dfInsertUpdate = dialog.addField(extendedTypeStr(NoYesId), "Insert and update");</div>
<div>
</div>
<div>
if(dialog.run())</div>
<div>
{</div>
<div>
tableName = dfTableName.value();</div>
<div>
fromCompany = dfFromCompany.value();</div>
<div>
toCompany = dfToCompany.value();</div>
<div>
insertUpdate = dfInsertUpdate.value();</div>
<div>
}</div>
<div>
dt = new DictTable( tableName2id(tableName));</div>
<div>
</div>
<div>
if (dt) </div>
<div>
{ </div>
<div>
di = dt.indexObject(dt.indexUnique()); </div>
<div>
if (di) </div>
<div>
{ </div>
<div>
info( di.name()); //verify for not RecId index</div>
<div>
} </div>
<div>
else</div>
<div>
{</div>
<div>
throw error("No unique index found on the table");</div>
<div>
}</div>
<div>
</div>
<div>
queryFrom = new Query();</div>
<div>
qbr1 = queryFrom.addDataSource(dt.id());</div>
<div>
</div>
<div>
changeCompany(fromCompany)</div>
<div>
{</div>
<div>
queryRunFrom = new QueryRun(queryFrom);</div>
<div>
while( queryRunFrom.next())</div>
<div>
{</div>
<div>
fromCommon = queryRunFrom.getNo(1);</div>
<div>
</div>
<div>
queryTo = new Query();</div>
<div>
qbr2 = queryTo.addDataSource(dt.id());</div>
<div>
</div>
<div>
for (i=1; i <= di.numberOfFields(); i++) </div>
<div>
{</div>
<div>
field = new DictField(dt.id(), di.field(i)); </div>
<div>
queryRange = qbr2.addRange(field.id()); </div>
<div>
queryRange.value(queryValue(fromCommon.(field.id())));</div>
<div>
</div>
<div>
}</div>
<div>
changeCompany(toCompany)</div>
<div>
{</div>
<div>
queryRunTo = new QueryRun(queryTo);</div>
<div>
if(!queryRunTo.next())</div>
<div>
{ </div>
<div>
toCommon = dt.makeRecord();</div>
<div>
toCommon.clear();</div>
<div>
toCommon.data(fromCommon); </div>
<div>
toCommon.company(toCompany);</div>
<div>
toCommon.insert(); </div>
<div>
</div>
<div>
}</div>
<div>
else if(insertUpdate)</div>
<div>
{</div>
<div>
ttsBegin;</div>
<div>
toCommon = queryRunTo.getNo(1);</div>
<div>
toCommon.selectForUpdate(true);</div>
<div>
buf2Buf(fromCommon, toCommon); </div>
<div>
toCommon.update();</div>
<div>
ttsCommit;</div>
<div>
</div>
<div>
}</div>
<div>
}</div>
<div>
</div>
<div>
}</div>
<div>
</div>
<div>
}</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
}</div>
<div>
<br /></div>
<div>
}</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-4867412325063667672016-08-17T07:53:00.004-07:002016-08-17T07:53:56.735-07:00Correcting DB Sync errors in AX <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
<span lang="EN-US">Correcting DB sync errors:<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<b><span lang="EN-US">Problem 1: Table Id
conflict. <o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<b><span lang="EN-US">Lot of times we face the
below error due to id conflicts during code migration. If this is the only error
related to this table and you can’t help using sync option in AOT, follow the
resolution step.<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<span lang="EN-US">The SQL database has issued an error.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<i><span lang="EN-US">SQL error description:
[Microsoft][SQL Server Native Client 11.0][SQL Server]There is already an
object named 'DMFSTAGE' in the database.<o:p></o:p></span></i></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<i><span lang="EN-US">SQL statement: CREATE TABLE
"DBO".'DMFSTAGE'<o:p></o:p></span></i></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0cm; mso-add-space: auto;">
<b><span lang="EN-US">Resolution</span></b><span lang="EN-US">: change the Table Id on SQLDictionary table <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">Select</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> TABLEID<span style="color: grey;">,*</span> <span style="color: blue;">from</span> sqldictionary
<span style="color: blue;">where</span> name <span style="color: grey;">=</span> </span><span lang="EN-US">'DMFSTAGE'</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: magenta; font-family: Consolas; font-size: 9.5pt;">Update</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> SQLDICTIONARY<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">set</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> tableid <span style="color: grey;">=</span> 105523 -- <span style="background: yellow; mso-highlight: yellow;">this is table id from AOT</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">from</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> SQLdictionary <span style="color: blue;">where</span> tableid <span style="color: grey;">=</span>
105519 –- <span style="background: yellow; mso-highlight: yellow;">this is table id
from SQLDictionary</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">Problem
2: Field Id problem<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">Due to
field addition/deletion and movement of code in different layers, you may face
below errors. In that case, the original table could be made a copy on SQL and
the original table then dropped. Later sync from the AOT that will create the
table and then copy the data from staging table to the target table. If the
columns are changed then you need to export the data in excel and work on
filter as explained below.<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">Text <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">Illegal data conversion from
original field </span><span lang="EN-US">'DMFSTAGE'</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">.PACKAGECODE to </span><span lang="EN-US">'DMFSTAGE'</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">.nextMigrate: Unable to convert data types to anything but character
field type (0 to 4). <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">Illegal data conversion from original
field </span><span lang="EN-US">'DMFSTAGE'</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">.SALESMANMOBILEPHONE to </span><span lang="EN-US">'DMFSTAGE'</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;">.PurchasingDate: Unable to convert data types to anything but
character field type (0 to 3). <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US">Solution: In this case, you can perform
steps 1 to 3 as mentioned below. Alternatively, correcting Fieldid on the
SQLDictionary table can be performed. As a rule of thumb, the field id on AX
should be copied/exist on the SQL dictionary table. I would prefer the backup
and restore option always. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-US">1.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span lang="EN-US">Take backup of the error table<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle">
<strong><span lang="EN-US" style="background: white; color: #333399; font-family: "Helvetica","sans-serif";">SELECT *</span></strong><span lang="EN-US" style="color: #141412; font-family: "Helvetica","sans-serif";"><br />
</span><strong><span lang="EN-US" style="background: white; color: #333399; font-family: "Helvetica","sans-serif";">INTO tableCopy</span></strong><span lang="EN-US" style="color: #141412; font-family: "Helvetica","sans-serif";"><br />
</span><strong><span lang="EN-US" style="background: white; color: #333399; font-family: "Helvetica","sans-serif";">FROM originalTable<o:p></o:p></span></strong></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><strong><span lang="EN-US" style="color: #333399; font-family: "Helvetica","sans-serif"; mso-fareast-font-family: Helvetica;">2.<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; font-weight: normal;"> </span></span></strong><!--[endif]--><strong><span lang="EN-US" style="background: white; color: #333399; font-family: "Helvetica","sans-serif";"><o:p> </o:p></span></strong></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">drop</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> </span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">table</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> OriginalTable<o:p></o:p></span></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoListParagraph" style="background: rgb(238, 238, 238); margin: 0cm 0cm 0.0001pt 18pt; text-indent: -18pt;">
<!--[if !supportLists]--><span lang="EN-US" style="border: none windowtext 1.0pt; color: darkblue; font-family: Consolas; font-size: 10.0pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: Consolas; padding: 0cm;">3.<span style="font-family: "Times New Roman"; font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;"> </span></span><!--[endif]--><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">Perform DB sync from AX
from the original Table<o:p></o:p></span></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">insert</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> </span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">into</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> OriginalTable </span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">select</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> * </span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; color: darkblue; font-family: Consolas; font-size: 10pt; padding: 0cm;">from</span><span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;"> tableCopy<o:p></o:p></span></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<span lang="EN-US" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt none windowtext; font-family: Consolas; font-size: 10pt; padding: 0cm;">**Sometimes
step 3 will not work because of the change of the fields sequence in different
layers. For this use a column list in the above query. You can find all the
columns of a table using below query. Migrate it to excel file and then do
transpose and save it as CSV file. You will get list of columns with comma
separated values and use it in the column list of above query.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">select</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> Column_name <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">from</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">Information_schema</span><span style="color: grey;">.</span><span style="color: green;">columns</span> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-US" style="color: blue; font-family: Consolas; font-size: 9.5pt;">where</span><span lang="EN-US" style="font-family: Consolas; font-size: 9.5pt;"> Table_name <span style="color: grey;">like</span> <span style="color: red;">'DMFTAXBRANCHENTITY'<o:p></o:p></span></span></div>
<div class="MsoNormal" style="background: rgb(238, 238, 238); margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<br />
<div class="MsoListParagraphCxSpLast">
<span lang="EN-US"> <o:p></o:p></span></div>
</div>
Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-89639932226229628422015-05-31T08:54:00.004-07:002015-05-31T08:55:36.233-07:00Record level security policy in AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
XDS security in AX 2012 for HRM<br />
<br />
Let us explore the standard AX HCM polices that are shipped OOB but there is no document available. This blog will also help to understand functional and technical overview of the record level security and legal entity level access to users.<br />
<br />
<b>Description</b>:<br />
A Security Policy is required to restrict access to Worker and Position Records based on the Legal Entity granted to the Human Resources Local Admin Role.<br />
The Microsoft Dynamics AX 2012 Human Resources Module framework has been enhanced to provide greater flexibility and sustainability across the organization. The data model has also been completely revised to permit many of the core Human Resources (HR) tables to be shared and to enable new functionalities. In prior versions, users had to log in and out of companies to manage applicants, employees, positions, and employee information. These processes have been streamlined as the data is now shared across all legal entities.<br />
Since HR Data is shared across legal entities, there is a concern that HR Local Administrator must only see the workers and positions for the Legal Entities that it’s responsible for (and not for all legal entities). To address this security concern, Security Policies must be customized and applied to the Human Resources Local Admin Role.<br />
Target Role: Let’s consider the securable role for this policy would be ‘Human resource assistant’ (AOT: HcmHumanResourceAssistant). It is out of the box role that allows to access global workers and positions.<br />
<br />
Solution:<br />
1. <b>Create a policy to restrict workers for the legal entities that the ‘Human resource assistant’ has access to.</b><br />
This policy is already exposed in the AOT by Microsoft. Let us see how this policy works.<br />
AOT-> Security-> Policies -> <b>HcmWorkerLegalEntity</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9eRa8AiYlYzl0q5NphV0owWFN578CXxkVxCmsGlpR0CUJLstqsMXPC1VOlpzCOB8r8QdE0XveH8qGJB8NsCCoxQwm65i6y1DTHinsZnizkLbJg3eRRdU0n-UDXZUBFTtrIacRN5CzjLk/s1600/Blog+1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9eRa8AiYlYzl0q5NphV0owWFN578CXxkVxCmsGlpR0CUJLstqsMXPC1VOlpzCOB8r8QdE0XveH8qGJB8NsCCoxQwm65i6y1DTHinsZnizkLbJg3eRRdU0n-UDXZUBFTtrIacRN5CzjLk/s320/Blog+1.jpg" width="320" /></a></div>
<b><br /></b>
<br />
This policy restricts the user to view workers for the legal entity that is associated with the user’s permission.<br />
<br />
<b>Properties</b>: Change the context type to Role Name and the role name should be selected as <b>HcmHumanResourceAssistant</b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiXPc83fGHXJ00uLGXJtsEGCwjeE68C5ptS_Wf-CD8pq-C8gAVSZCnZ-cyY6AR1weNd-rMVIg4wGFpuFho4SBjG7O9nLEpMkX9UOjdXI-o7v26dPkB55rjB_bb4sEFSJ9lkLB_66aL_7I/s1600/Blog+2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiXPc83fGHXJ00uLGXJtsEGCwjeE68C5ptS_Wf-CD8pq-C8gAVSZCnZ-cyY6AR1weNd-rMVIg4wGFpuFho4SBjG7O9nLEpMkX9UOjdXI-o7v26dPkB55rjB_bb4sEFSJ9lkLB_66aL_7I/s320/Blog+2.jpg" width="320" /></a></div>
<br />
<br />
<b>Setup</b>: Note that the help text says that the user should be granted access to legal entities. In order to do this, navigate to the user master (system admin – Users – User role fast tab ) and assign the user with the Human resource assistant role. The ‘Assign organization’ button will be enabled to associate legal entities or legal entities hierarchy for the user and role combination. Select the ‘Grant access to Specific organizational hierarchy’ and select the desired legal entity. In our case we are in the standard AX R3 demo data and I am restricting it for USMF.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhal-JnFyKFSYDyosm2ydqaEqd8OAhL9kEx-Jz7iT87W_UnLnusX6Xo4Ez4YM5RYhguw-CYYWa5W8ZCiS41or9uo-cWs3ZUq-doG2-WpqXtWlPjC8BDG4q26tJtO-BoI46hNYRR1Mjnhlo/s1600/Blog+3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhal-JnFyKFSYDyosm2ydqaEqd8OAhL9kEx-Jz7iT87W_UnLnusX6Xo4Ez4YM5RYhguw-CYYWa5W8ZCiS41or9uo-cWs3ZUq-doG2-WpqXtWlPjC8BDG4q26tJtO-BoI46hNYRR1Mjnhlo/s320/Blog+3.jpg" width="320" /></a></div>
<br />
<b>Caution</b>: If you are adding more than one role for the user, by default the role will have access to all legal entities. Even if you are using ‘system user’ you need to perform the assignment of organization in order to make the policy work. When we added system user to this user and all legal entities were granted access, the security policy would not work. It is because the XDS table formed during invocation considers union of allowed legal entities. We also have a work around described in the later part.<br />
<br />
Now, let’s log in to test the security policy for the role. Aaren is employed to USRT, which should not be visible for the HR assistant.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjATWnV2LbYddkYwV7t_4vlOatiDktzYRLLMc7b_JMMHHTeaQI1hxLsVwquxv-Wo0zwD_iWCKlw7KDGKRcXtUveeDqzqUXQnIaNZF2P-2po5IcLTfL57gNP04cLBAys-Ab0YMIb-9Mh_q0/s1600/Blog+4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="139" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjATWnV2LbYddkYwV7t_4vlOatiDktzYRLLMc7b_JMMHHTeaQI1hxLsVwquxv-Wo0zwD_iWCKlw7KDGKRcXtUveeDqzqUXQnIaNZF2P-2po5IcLTfL57gNP04cLBAys-Ab0YMIb-9Mh_q0/s320/Blog+4.jpg" width="320" /></a></div>
<br />
Visibility for HR assistant:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgVBizd0b-btX4c5x5rJU6iMWa4F4-tbKQeghOmcaAwksx0FmdESM0gudH00-kIaZCdrPiGmpAEzwCR6IEKuVZKsltw6eVkmuCGRqaVTo86znbNyE8jS_ZDN_cgVVnKy3USILZMFh4j4s/s1600/blog+5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgVBizd0b-btX4c5x5rJU6iMWa4F4-tbKQeghOmcaAwksx0FmdESM0gudH00-kIaZCdrPiGmpAEzwCR6IEKuVZKsltw6eVkmuCGRqaVTo86znbNyE8jS_ZDN_cgVVnKy3USILZMFh4j4s/s320/blog+5.jpg" width="320" /></a></div>
<br />
Also the HR assistant is restricted to create worker for USMF legal entity.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlYUh0y1wmNE4uZLOvO8DHwzqlXDHFspEVVidWhQ_U-xDiTnPvl6tGP1HNOgmBoYpd8BIJALPzkpCk5OwEUHr7GoejQ1paic1EOdisCSIDNzDOoltAkSGy4GMKtwi8oL-L4VPoXvp6XOU/s1600/Blog+6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="260" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlYUh0y1wmNE4uZLOvO8DHwzqlXDHFspEVVidWhQ_U-xDiTnPvl6tGP1HNOgmBoYpd8BIJALPzkpCk5OwEUHr7GoejQ1paic1EOdisCSIDNzDOoltAkSGy4GMKtwi8oL-L4VPoXvp6XOU/s320/Blog+6.jpg" width="320" /></a></div>
<br />
<b>Technical details:</b><br />
The query contains the data source with filters to manage data that will be allowed for the user. The Security Policy will take care of applying the constraints with the use of the query. In most cases, we would be required to pass dynamic filtering of the primary table. In our case during runtime, we need the information of the legal entities tied to the current worker. In this particular case, the query contains a temp Db table that populates the data based on the invocation of XDS method. Depending on a call (RefreshFrequency) you can cache this table per user session. Also check the best practice stated my MS while creating query as it impacts performance. Have a look at the XDS method of the ‘MyLegalEntity’ table. It dynamically fills the temp table per session with the Legal entity info for the logged user.<br />
Also note this part of the code, which selects the legal entities for all the roles associated with the user. Hence as a caution it was advised to restrict legal entities for all the roles associated with the user.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZnFfUJUnobD4TX4NwMJ6I_2oPZPLLiqOpVe3qi-szdCtkTTdLAp3V1NvMrW8_c9lcy3XduKCh2pVHL57WE0nuAgy8gq46a6Sc4gGLfuXeGNh4vBEXhG1O00lWpPgN7UADu68upb4aHPc/s1600/Blog+7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="131" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZnFfUJUnobD4TX4NwMJ6I_2oPZPLLiqOpVe3qi-szdCtkTTdLAp3V1NvMrW8_c9lcy3XduKCh2pVHL57WE0nuAgy8gq46a6Sc4gGLfuXeGNh4vBEXhG1O00lWpPgN7UADu68upb4aHPc/s320/Blog+7.jpg" width="320" /></a></div>
<br />
<b>2. Create a policy to restrict the view of the departments of the legal entities the user is associated to.</b><br />
The relation between department and organization structure is tied to legal entity.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFEI6jZhyI3ljNrf1a775mjNLvAHoKmau9Dn0GgyWT6fK40dfPTjx-WT9yWl9LBkTFWCQwU9x2N7XIJOtTco9HnlMf5ZY0d9gX0CgiseuMDXo2RO9pc8xmX7TqVS6-2u8i944c2VHOe9w/s1600/Blog+8.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="37" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFEI6jZhyI3ljNrf1a775mjNLvAHoKmau9Dn0GgyWT6fK40dfPTjx-WT9yWl9LBkTFWCQwU9x2N7XIJOtTco9HnlMf5ZY0d9gX0CgiseuMDXo2RO9pc8xmX7TqVS6-2u8i944c2VHOe9w/s320/Blog+8.jpg" width="320" /></a></div>
<br />
This standard AX policy can be used for this purpose. It only allows the use of departments that are associated to the hierarchy in the organizational structure for the legal entities allowed for the user to access. While designing organizational structure, the organizational purpose, and linkage with the legal entities should be well thought.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirbg2Q2RdeyVm7HADiIH8oazz1lGi0hA_g1mp9OT8TDbg2ImyqfLk328slWUwQSmygOA6mVGcClNM2d4XJZjr_kIbhDIDEKSbYU393-QiibVUvcQdh-Lg4ivh9py8caosShtcELiFoD0I/s1600/Blog+9.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="105" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirbg2Q2RdeyVm7HADiIH8oazz1lGi0hA_g1mp9OT8TDbg2ImyqfLk328slWUwQSmygOA6mVGcClNM2d4XJZjr_kIbhDIDEKSbYU393-QiibVUvcQdh-Lg4ivh9py8caosShtcELiFoD0I/s320/Blog+9.jpg" width="320" /></a></div>
<br />
In the demo data, USMF is not associated with the IT department and client services department. For more details on the organizational hierarchy check the best practice to design the hierarchy. In the subsequent screen the budgeting hierarchy for the departments is shown from the system user and the HR assistant perspective after enabling the security policy ‘HcmDepartmentLegalEntity’. This policy will also show the departments that are not linked with any legal entity in the hierarchy.<br />
<br />
Legal entity<br />
Department<br />
Positions<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGONPBdEKDU6vVZSR5uZggsBWNU_veQNAb7bHDqq2J_N0Zs67aD6VQAJ-dBCqAW-v9AD3uvLnKVc3HcVcYksiNo04Us9mhkwVcsLLJDZikvF4PAQ1uAcKoIQs2V4vRy9yGbdTVc3WitUw/s1600/Blog+10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGONPBdEKDU6vVZSR5uZggsBWNU_veQNAb7bHDqq2J_N0Zs67aD6VQAJ-dBCqAW-v9AD3uvLnKVc3HcVcYksiNo04Us9mhkwVcsLLJDZikvF4PAQ1uAcKoIQs2V4vRy9yGbdTVc3WitUw/s320/Blog+10.jpg" width="320" /></a></div>
<br />
Fig A: For system admin<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9t3eiwe0XdVWC0dSaqMY8mNsMjsDNVfHViISCb-k3pwP0gBZpuLE-QzLRLsTWKPZ-J5O-qyHYnUETiZ0NNH-u4HvdRaYz-rpaRGnBWWFcga3XdLk8onfeD6JBV4rDNEv2fAj0y1_i0EM/s1600/Blog+11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9t3eiwe0XdVWC0dSaqMY8mNsMjsDNVfHViISCb-k3pwP0gBZpuLE-QzLRLsTWKPZ-J5O-qyHYnUETiZ0NNH-u4HvdRaYz-rpaRGnBWWFcga3XdLk8onfeD6JBV4rDNEv2fAj0y1_i0EM/s320/Blog+11.jpg" width="320" /></a></div>
<br />
Fig B: For HR assistant<br />
<br />
Note that for the HR assistant the departments will be shown as blank nodes in the hierarchy form.<br />
Technical details: The query used for this security policy consist a no exist join with a temp table HCMMyDepartmentsNoAccess that stores the department that does not have access to the legal entities data during runtime that has refresh frequency per session. Thus whenever the user is logged in to the system or when a session is created, this temp table is filled with the data thus resulting performance gain. The number of joins is reduced during run time.<br />
<br />
<b>3. Create a security policy for restricting access only to positions associated with legal entities in which the user has been granted access.</b><br />
Since we have already restricted the departments, the positions falling under these departments should also be restricted. Standard AX security policy <b>HCMPositionLegalEntity </b>solves this purpose.<br />
<br />
Let us assign to the HR assistant role in our previous considerations.<br />
The IT manager position is part of IT Department which does not belong to USMF legal entity in the standard demo data. For the HR admin having access to USMF legal entity, should not be allowed to view the IT department’s position.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcTTX_Q5t7NqShr1-hFKFx1tsPqwWwy2h_hRSmiVPlOp4Lo_Dvt0NEX2H2GTlPPWE-pX3pLp7yxHK95jydkiCFlBGMyzf4LJaoGQeVL4Tnzc2Om0Ds7yN1GtfWtwoalMtzxoKyyrbJbtk/s1600/Blog+13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="169" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcTTX_Q5t7NqShr1-hFKFx1tsPqwWwy2h_hRSmiVPlOp4Lo_Dvt0NEX2H2GTlPPWE-pX3pLp7yxHK95jydkiCFlBGMyzf4LJaoGQeVL4Tnzc2Om0Ds7yN1GtfWtwoalMtzxoKyyrbJbtk/s320/Blog+13.jpg" width="320" /></a></div>
<br />
Using HR assistant role: cannot find relevant positions.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaNJ3WllaEknBxieikVJRmZQVXS-tS2q52ep6NEC2xpG0rxuoi-lFC1u0YGV7nqoKWpXVTwBbD0VISTQ47fxDDkEXsaGTvaB9BAGDzO1htaL_ch5TkkXUFQHaWFf-W5nZ1a9MPYfWtG8w/s1600/Blog+14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaNJ3WllaEknBxieikVJRmZQVXS-tS2q52ep6NEC2xpG0rxuoi-lFC1u0YGV7nqoKWpXVTwBbD0VISTQ47fxDDkEXsaGTvaB9BAGDzO1htaL_ch5TkkXUFQHaWFf-W5nZ1a9MPYfWtG8w/s320/Blog+14.jpg" width="320" /></a></div>
<br />
Technical details:<br />
The positions that are linked to the workers that this HR assistant does not have access to will show unknown workers. In order to restrict the positions records based on employee, we can add the position tables to the constraint table of the first policy we enabled for workers. To add constraint table right click New -> add table by relation should be selected. The property ‘constraint table’ should be set to yes.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkrbhXUld8eppQkpv2Vm62i70cvedv7G_UBhlEqWXch6o2RriS2hXdWLiDDjXNwP0iWAhAdYxJAlVCAJTTP7sHMZFFgRIEXI476GP34bGlw9w6ZrkNsPVB8x9bJWs516u2TDJGu5Peh6s/s1600/Blog+15.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkrbhXUld8eppQkpv2Vm62i70cvedv7G_UBhlEqWXch6o2RriS2hXdWLiDDjXNwP0iWAhAdYxJAlVCAJTTP7sHMZFFgRIEXI476GP34bGlw9w6ZrkNsPVB8x9bJWs516u2TDJGu5Peh6s/s320/Blog+15.jpg" width="320" /></a></div>
<br />
The query used for this security policy consist a exist join with a temp table HCMMyDepartments that stores the department data during runtime that has refresh frequency per session. Thus whenever the user is logged in to the system or when a session is created, this temp table is filled with the data thus resulting performance gain.<br />
<br />
<b>4. Restrict the employment record of the worker to the legal entities that the user is associated to.</b><br />
The local HR assistant is responsible for the employment for USMF only. There may be workers having more than one employment role in multiple legal entities. The local HR should be restricted to view the employment of the associated legal entity only i.e. USMF in our example.<br />
The standard AX policy for this is HcmEmploymentLegalEntity. Let’s enable this for the HR assistant role. Currently we have a worker employed in multiple companies as below.<br />
User -> version tab-> Employment history<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiACRTtXKVfrgyr6fB1d2GlrnR-_jo7NbMe28iMMVS1RtOFnMCA3PiqWmktjrajSYmLdiW_SnRwgdRZufbi5ui4jj7n1hvwkbWD75um7M2BH5bJwyHLK4lfOtP7fjrZAw6knCoydsJe6h4/s1600/Blog+16.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="117" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiACRTtXKVfrgyr6fB1d2GlrnR-_jo7NbMe28iMMVS1RtOFnMCA3PiqWmktjrajSYmLdiW_SnRwgdRZufbi5ui4jj7n1hvwkbWD75um7M2BH5bJwyHLK4lfOtP7fjrZAw6knCoydsJe6h4/s320/Blog+16.jpg" width="320" /></a></div>
<br />
Currently the user is contractor in USMF, employee in INMF and GLSI legal entities. Now, let’s look from the HR assistant role. The employment details for other legal entities are not shown as seen in the below form.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5NNJLuFkaHKNQ-W12yiWZ-TGAkOoLeVYVopob3TQc_KSiQBzb3AdmrTw30v8iSWO-xnveICNdX6L1h83v3DWP91uEwG6ZgPOJUCK6uYBF8JEiZhYPHYrkqOrB2SLTbyEqtVCG-kRijHk/s1600/Blog+17.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5NNJLuFkaHKNQ-W12yiWZ-TGAkOoLeVYVopob3TQc_KSiQBzb3AdmrTw30v8iSWO-xnveICNdX6L1h83v3DWP91uEwG6ZgPOJUCK6uYBF8JEiZhYPHYrkqOrB2SLTbyEqtVCG-kRijHk/s320/Blog+17.jpg" width="320" /></a></div>
<br />
<div>
<br /></div>
</div>
Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com1tag:blogger.com,1999:blog-3478793418850497707.post-34991148461676977372013-09-24T23:41:00.003-07:002013-09-24T23:41:48.646-07:00Adding lookup method on Form Reference Group AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal" style="text-align: center;">
<b>Reference Group Control lookups in AX 201</b>2<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
With the addition of
reference groups fields the AX forms including the dialog form gives a rich
control called the <b>FormReferenceGroupControl.
</b>With this post, I will show you how to add a reference field in the batch
dialog form and add a filtered query controlled drop down.<o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
I am going to show with
a EcoResCategoryId field. The requirement is to filter out categories with
Level 3 and present in the batch dialog dropdown. <o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<o:p> </o:p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0yhvQslgq84lDNKqMAiN2p61HAMGflUgT-FHn0gGvkwVfUqWg9YL3UN_FCgULlZiAGjqvE8z0iSi5RH4vWHQI6Z4tDyB1NkAqHsJT4ePeHYxEt08VXQ7WoPuh04fYm-7MEppYZuMOwYQ/s1600/snag1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0yhvQslgq84lDNKqMAiN2p61HAMGflUgT-FHn0gGvkwVfUqWg9YL3UN_FCgULlZiAGjqvE8z0iSi5RH4vWHQI6Z4tDyB1NkAqHsJT4ePeHYxEt08VXQ7WoPuh04fYm-7MEppYZuMOwYQ/s320/snag1.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNoSpacing">
<b>Class Declaration:<o:p></o:p></b></div>
<div class="MsoNoSpacing">
Declare the
warehouse and category fields and dialog fields as below.<o:p></o:p></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">InventLocationId inventLocationId;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">EcoResCategoryId EcoResCategoryId;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">DialogField
DialogInventLocationId,DialogEcoResCategoryId;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Dialog Method:<o:p></o:p></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="color: darkblue; font-family: Consolas; font-size: 8.0pt;">public</span></b><span style="font-family: Consolas; font-size: 8.0pt;"> Object dialog()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
dialog dialog = <b><span style="color: darkblue;">new</span></b> DialogRunbase(<span style="color: darkviolet;">"@ZON2996"</span>,this);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
DialogEcoResCategoryId =
dialog.addField(<b><span style="color: darkblue;">extendedTypeStr</span></b>(EcoResCategoryId),<span style="color: darkred;">"Category"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
DialogInventLocationId =
dialog.addField(<b><span style="color: darkblue;">extendedTypeStr</span></b>(InventLocationId),<span style="color: darkred;">"Warehouse"</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">return</span></b> dialog;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
DialogPostRun method should be overridden to enable the
lookup method of the fields<o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="color: darkblue; font-family: Consolas; font-size: 8.0pt;">public</span></b><span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">void</span></b>
dialogPostRun(DialogRunbase _dialogloc)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">super</span></b>(_dialogloc);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
_dialogloc.dialogForm();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
_dialogloc.dialogForm().formRun().controlMethodOverload(<b><span style="color: darkblue;">true</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
_dialogloc.dialogForm().formRun().controlMethodOverloadObject(this);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
_dialogloc.formRun().controlMethodOverload(<b><span style="color: darkblue;">true</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
_dialogloc.formRun().controlMethodOverloadObject(this);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
Determine the field Id of the control from the dialog form. Personalizing
will show you the below form.<o:p></o:p></div>
<div class="MsoNormal">
From the below form we know that Fld1_1 is the field for the
category. Also note that as it is reference group, a Name field is shown that
should hold the category information in the string box.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBNZ4e2yuZLsMQEWjfjqtSkrob2BbD8xH4QKIm0uiHVaAcFeW57KUJPlMaWYa9jC_XTgEwezDevFZoP2584GGST4zBWChOrEKlE2x_I4QoY41AADAGbFFrSKTqy7wOMjxGAIred_qvspE/s1600/blog+2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBNZ4e2yuZLsMQEWjfjqtSkrob2BbD8xH4QKIm0uiHVaAcFeW57KUJPlMaWYa9jC_XTgEwezDevFZoP2584GGST4zBWChOrEKlE2x_I4QoY41AADAGbFFrSKTqy7wOMjxGAIred_qvspE/s400/blog+2.png" width="400" /></a></div>
<br />
<div class="MsoNormal">
Lookup:<o:p></o:p></div>
<div class="MsoNormal">
We would need to create a lookup method for the above field
as below.<o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="color: darkblue; font-family: Consolas; font-size: 8.0pt;">void</span></b><span style="font-family: Consolas; font-size: 8.0pt;"> Fld1_1_lookup()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
Query DropDownquery = <b><span style="color: darkblue;">new</span></b>
Query();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
FormControl frmSTr =
DialogEcoResCategoryId.dialog().formRun().controlCallingMethod();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">//Use the SysReferenceTableLookup class instead of
SystableLookup class for such reference group control<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b>SysReferenceTableLookup sysTableLookup =
SysReferenceTableLookup::newParameters(<span style="color: darkblue; mso-bidi-font-weight: bold;">tableNum</span>(EcoResCategory), frmSTr,<span style="color: darkblue; mso-bidi-font-weight: bold;">true</span>);<o:p></o:p></b></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="font-family: Consolas; font-size: 8.0pt;"> <o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
QueryBuildDataSource qbds;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
QueryBuildRange qbr,qbr1;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> ;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> qbds =
DropDownquery.addDataSource(<b><span style="color: darkblue;">tableNum</span></b>(EcoResCategory));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> qbr = qbds.addRange(<b><span style="color: darkblue;">fieldNum</span></b>(EcoResCategory,Level));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
qbr.value(queryValue(<b><span style="color: red;">3</span></b>));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.addSelectionField(<b><span style="color: darkblue;">fieldNum</span></b>(EcoResCategory,
Name));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.addLookupField(<b><span style="color: darkblue;">fieldNum</span></b>(EcoResCategory,
ReciD));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.addLookupField(<b><span style="color: darkblue;">fieldNum</span></b>(EcoResCategory,
Name));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.addLookupField(<b><span style="color: darkblue;">fieldNum</span></b>(EcoResCategory,
Code));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.parmQuery(DropDownquery);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">
sysTableLookup.performFormLookup();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 8.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<br /></div>
Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-7577525135587024002011-12-15T23:30:00.000-08:002011-12-15T23:33:20.199-08:00AX 2012: Reference To the VS Projects not updated in AOT<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;">Common error when
using a class that runs on server and references a Visual studio DLL file.<o:p></o:p></b></div>
<div class="MsoNormal">
I am trying to consume web service from external systems in
AX. To do this, I have added the references in VS 2010 solution and that in
turn is added to the AOT. I have set the deploy on client and server to yes.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_UMwg3ZKXNKlQiuaD71_go6bJijTCyfUZVwP9b8c3lrzkYbz8dMj_uMo5R_iQBVRe7yUebXu4UuI5Lhf21sD2fjmGvYntjLSSo1cMiJRL6LIWZMwYlUmfRMH9kZz3PGLltW5u1JTxc_0/s1600/Blog1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_UMwg3ZKXNKlQiuaD71_go6bJijTCyfUZVwP9b8c3lrzkYbz8dMj_uMo5R_iQBVRe7yUebXu4UuI5Lhf21sD2fjmGvYntjLSSo1cMiJRL6LIWZMwYlUmfRMH9kZz3PGLltW5u1JTxc_0/s400/Blog1.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBs6h4LzTlpNGlU4qedpvQpbJjNFN10iqJQPfFQkZXvR52RFGSmZLQWsh5ILP2hMZPHFVUQAVbOGcs3uJ-AIlhLHnRGpKAJkmug_A3CSSVhJUhFMDuBeHv-g4pBM0BJHv6aU2c5XPmVfk/s1600/blog2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBs6h4LzTlpNGlU4qedpvQpbJjNFN10iqJQPfFQkZXvR52RFGSmZLQWsh5ILP2hMZPHFVUQAVbOGcs3uJ-AIlhLHnRGpKAJkmug_A3CSSVhJUhFMDuBeHv-g4pBM0BJHv6aU2c5XPmVfk/s1600/blog2.png" /></a></div>
<div class="MsoNormal">
<br /></div>
<br />
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
When you add the solution to the AOT, the AX server will store
the relevant DLL and its configuration file to the folder under the application
as below. The highlighted part is the instance name.<o:p></o:p></div>
<div class="MsoNormal">
C:\Program Files\Microsoft Dynamics AX\60\Server\<span style="background-attachment: initial; background-clip: initial; background-color: yellow; background-image: initial; background-origin: initial;">Lexjet_DEV_AX</span>\bin\VSAssemblies<o:p></o:p></div>
<div class="MsoNormal">
When you use the reference to the web services in a class,
which is very much simplified in AX 2012 as it gets stored under the VS
references, you may want to execute the class always from server. In my case it
is a batch job so it becomes mandatory for me.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMQlF1DbktlZH8J2NDepMyfGJ51w_-svkiFx6FZtmanjBTtzlfTinlzxiETf-q-kwEJyDC8FJ_Opw5qHWkWB-TLK9zikBYS0Rv51WItPnFPrGtJy0I6z6kGTVQGXSRmkuKSxbiW2a13ho/s1600/blog3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMQlF1DbktlZH8J2NDepMyfGJ51w_-svkiFx6FZtmanjBTtzlfTinlzxiETf-q-kwEJyDC8FJ_Opw5qHWkWB-TLK9zikBYS0Rv51WItPnFPrGtJy0I6z6kGTVQGXSRmkuKSxbiW2a13ho/s1600/blog3.png" /></a><br />
<div class="MsoNormal">
But when my code tries to create a service client, it points
out the configuration path to the client rather than the destination pointed
above.<o:p></o:p></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfUKqAWhqhEkgmDaYPcV2fHikIVy1ALaMSl4CIcqLj7RqDx8K1849W_QV_a_puvDrUjfTB5Cy1jLcbgIA0h-y18YYGTBdek6Oo9-keUjTLWPWRk66TFnviZqztZIzGSDS15aCWuRVuZSI/s1600/blog4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="64" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfUKqAWhqhEkgmDaYPcV2fHikIVy1ALaMSl4CIcqLj7RqDx8K1849W_QV_a_puvDrUjfTB5Cy1jLcbgIA0h-y18YYGTBdek6Oo9-keUjTLWPWRk66TFnviZqztZIzGSDS15aCWuRVuZSI/s640/blog4.png" width="640" /></a><br />
<br />
<div class="MsoNormal">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijKXmkJdzfjbL4IVpZ7sk0cxO-eCsy00y41cP4xa5csjHGyyXRXTiIoIXhfThe-xdX3NNF4oeE77riTnC52ae4xV30lOunOO4qFHuOETspM6EMY3x30Gdg8qYpxone8ovXzz-riZ5r8FM/s1600/blog5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijKXmkJdzfjbL4IVpZ7sk0cxO-eCsy00y41cP4xa5csjHGyyXRXTiIoIXhfThe-xdX3NNF4oeE77riTnC52ae4xV30lOunOO4qFHuOETspM6EMY3x30Gdg8qYpxone8ovXzz-riZ5r8FM/s640/blog5.png" style="cursor: move;" width="640" /></a></div>
<div class="MsoNormal">
Second Problem with this path reference is that when you try
updating a service in VS 2010 and update the project to AOT, only the server
folder gets the latest artifacts of the project. Below is a screen that shows
that the last modified date of the client folder is older than the one in
server.<o:p></o:p></div>
<br />
<div class="MsoNormal">
<o:p> </o:p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl89PDRLFq7p6Q5tR1Z-IAKTY0dG3j3m6pfhhqly7kM8WbRlu-GGCNIiqRjKgpZRI_D8WSo7geNOergbNKVWzKJzIrkF0Kq88W3mUpwAgGYmcIP1JDLKuAxxDHTZc8uQzQnPo3PUvVCZ0/s1600/blog6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl89PDRLFq7p6Q5tR1Z-IAKTY0dG3j3m6pfhhqly7kM8WbRlu-GGCNIiqRjKgpZRI_D8WSo7geNOergbNKVWzKJzIrkF0Kq88W3mUpwAgGYmcIP1JDLKuAxxDHTZc8uQzQnPo3PUvVCZ0/s640/blog6.png" width="640" /></a></div>
<div class="MsoNormal">
The deploy to client did not work and even though you run
the class from server it takes the client’s path reference in the
createServiceClient method. <o:p></o:p></div>
<div class="MsoNormal">
Workaround:<o:p></o:p></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><i style="mso-bidi-font-style: normal;">Every time you add or update the service reference, you need to copy
the configuration and DLL from server to the client folder.<o:p></o:p></i></b></div>
<div class="MsoNormal">
This is a big overhead when you are developing integration
scenarios and you tend to update the service reference again and again. <o:p></o:p></div>
<div class="MsoNormal">
You also do not want to refer to the client’s directory in
case of a batch job. This is a big pain when you are migrate your code to other
environments.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
</div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-76241197008180824612011-09-14T05:54:00.000-07:002011-12-15T23:40:10.339-08:00Importing Vendor Into Ax 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">Having all the relations of GAB structure changed, it became mandatory to write a script to import vendor data into Ax 2012. I will create a DirParty record and then associate it to vendor fields. The addresses can be attached to the vendor's PartyRecId. The use of views to record all the address fields help to initialize the linked tables.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">static void importVendor(Args _args)</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">{</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> CommaIO csvFile;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> container readCon;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> counter icount,inserted;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> Dialog dialog;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DialogField dfFileName;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirPartyRecId partyRecId,contactPartyRecid;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> Name name,contactName;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> VendTable vendtable;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> FileName fileName;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> str contactperson;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirPartyPostalAddressView addressView;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirPartyContactInfoView contactView;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> ContactPerson contactpersonTable;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> LogisticsElectronicAddressMethodType enumType;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirParty dirParty;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> LogisticsPostalAddress address;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> LogisticsElectronicAddress logisticsElectronicAddress;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> BinData binData;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> str stringImage;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> inserted =0;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> #File</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dialog = new Dialog("Pick the file");</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dfFileName = dialog.addField(extendedTypeStr(FileNameOpen));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dialog.filenameLookupFilter(["All files", #AllFiles]);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> if (dialog.run())</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> {</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> filename = dfFileName.value();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> csvFile = new CommaIO(filename, 'r');</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> if (csvFile)</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> {</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> readCon = csvFile.read();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> ttsbegin;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> while (csvFile.status() == IO_Status::OK)</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> {</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> readCon = csvFile.read();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> icount++;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> if (readCon)</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> {</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> name = conPeek(readCon,2);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> partyRecId = DirPartyTable::createNew( DirPartyType::Organization, name).RecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.clear();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.initValue();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.AccountNum = conPeek(readCon,1);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.VendGroup = conPeek(readCon,5);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.Currency = conPeek(readCon,6);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> //vendtable.Blocked =</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.DlvMode = conPeek(readCon,8);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.PaymMode = conPeek(readCon,9);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> ContactPerson = conPeek(readCon,12);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> if(contactperson != '')</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> {</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactname = conPeek(readCon,12);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> ContactPerson::findOrCreateNameParty(partyRecId,contactname);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> vendtable.insert();</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> address.CountryRegionId = strLRTrim(conPeek(readCon,14));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> //addressView.State = strLRTrim(conPeek(readCon,16));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> address.ZipCode = strLRTrim(conPeek(readCon,15));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> address.Street = strLRTrim(conPeek(readCon,19));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> // address.county = strLRTrim(conPeek(readCon,17));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> address.City = strLRTrim(conPeek(readCon,18));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> addressView.LocationName = name;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> addressView.IsPrimary = NoYes::Yes;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> addressView.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> addressview.initFromPostalAddress(address);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirParty = DirParty::constructFromPartyRecId(addressView.Party );</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> DirParty.createOrUpdatePostalAddress(addressView);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.LocationName = "Delivery email";</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Locator = strLRTrim(conPeek(readCon,10));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Type = LogisticsElectronicAddressMethodType::Email;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.IsPrimary = NoYes::Yes;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dirParty.createOrUpdateContactInfo(contactView);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.LocationName = "Delivery Cellular Phone";</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Locator = strLRTrim(conPeek(readCon,11));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Type = LogisticsElectronicAddressMethodType::Phone;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.IsPrimary = NoYes::Yes;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dirParty.createOrUpdateContactInfo(contactView);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.LocationName = "Delivery Phone";</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Locator = strLRTrim(conPeek(readCon,3));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Type = LogisticsElectronicAddressMethodType::Phone;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.IsPrimary = NoYes::Yes;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dirParty.createOrUpdateContactInfo(contactView);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.LocationName = "Delivery Fax";</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Locator = strLRTrim(conPeek(readCon,4));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Type = LogisticsElectronicAddressMethodType::Fax;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.Party = partyRecId;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> contactView.IsPrimary = NoYes::Yes;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> dirParty.createOrUpdateContactInfo(contactView);</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> inserted++;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> ttsCommit;</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> }</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"> info(strfmt("%1 records inserted out of %2",inserted,icount));</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">}</span><br />
<div>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span></div>
<br />
<br /></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com2tag:blogger.com,1999:blog-3478793418850497707.post-9335397588092980152010-10-26T02:00:00.000-07:002010-10-26T02:01:39.973-07:00Ax2009 Reporting services installation Error out on iis<div>On the Box:</div><div>Server: windows 2008 server R2.</div><div>SQL 2008.</div><div><br />
</div>When installing Reporting Extensions for Ax 2009,the pre-requisite page shows that IIS is not installed even thou you may have installed it. In the log file,you will find that the installation fails at IIS.<br />
<div><br />
</div><div>For the workaround, install the following IIS components from Manage Your <b>server-> Server Roles->role services.</b></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwqzv1MZGHrGz-RpA5w0Lz0poV_jD73UWEV5800hJyFDJWHDMvX1_CSbrApXM-jznCNCkSAwQ0i4sCAgZ8UJeda7W_oxjjymX8hyphenhyphenaOZezY9Mbbt2jqOk1x48aVnItpkD8IAwg3B9r3sTE/s1600/Report+server.bmp" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwqzv1MZGHrGz-RpA5w0Lz0poV_jD73UWEV5800hJyFDJWHDMvX1_CSbrApXM-jznCNCkSAwQ0i4sCAgZ8UJeda7W_oxjjymX8hyphenhyphenaOZezY9Mbbt2jqOk1x48aVnItpkD8IAwg3B9r3sTE/s320/Report+server.bmp" width="320" /></a></div><div><b><br />
</b></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div>Install the selected components and You wont be asked to install IIS pre-requisite.<br />
<div><br />
</div><div><br />
</div></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-57266376512370123802010-10-22T04:22:00.001-07:002010-10-22T04:22:06.992-07:00WorkFlow submission Multiple Times Standard Ax error<a href="http://daxsanty.blogspot.com/2010/06/workfow-being-submitted-multiple-times.html">http://daxsanty.blogspot.com/2010/06/workfow-being-submitted-multiple-times.html</a>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-18240030793015063572010-10-21T06:51:00.000-07:002010-10-21T06:51:38.425-07:00SQL Database Error in Ax2009When I try to execute a query which uses complex joins in dynamics ax 2009, the sql buffer size is reached depending upon the buffer size of configuration database size. Here is the error in the infolog.<br />
Error:<br />
<b>The total, internal size of the records in your joined SELECT statement is 25666 bytes, but Microsoft Dynamics is by default performance-tuned not to exceed 24576 bytes.</b><br />
<b>It is strongly recommended that you split your table(s) into smaller units.</b><br />
<b>Alternatively, you have to specify a 'Buffer size' value of 26 Kbytes or higher in the 'SQL' tab page in the Microsoft Dynamics Configuration Utility. The default value is 24 Kbytes.</b><br />
<b><br />
</b><br />
As a solution, you can increase the buffer size in the ax server configuration manager by multiples of 2. By default it has 24kb of buffer.Also note how the page memory use increases from task manager of 'AX32' services.The increase in buffer id proportional to the increase in PF memory.Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-566488463553036722010-10-20T05:34:00.000-07:002010-10-20T05:34:03.082-07:00X++ Code Snippet: handle all values in a conditional statement ~ IT Pro Ramblings<a href="http://patrikluca.blogspot.com/2010/10/x-code-snippet.html">X++ Code Snippet: handle all values in a conditional statement ~ IT Pro Ramblings</a>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-78590845216234062512010-10-14T05:44:00.000-07:002010-10-17T23:02:02.219-07:00Copying Infolog -Sending EMail from ax2009This is a small post to send and configure mail in ax 2009.I have had a requirement to copy the infolog at the end of some function and send it to the user. This is a code snippet (not the actual one though) how I managed.<br />
First you need to set a template for the mail (Basic-> set up->Email Template). I have created a template as shown.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8BoT7CFsmWQYuzrCs_ye-DEXBvw8va_dGF22iqkON_of3d8mDFlLZRsSiB9YvmvpTFeZCyjlHRFvzaG4xezh2crDIHBfVaasXl8b86m7F22selF_XZUG0JB4Ce615hxUYJlG_hlvvu6A/s1600/email+template.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="321" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8BoT7CFsmWQYuzrCs_ye-DEXBvw8va_dGF22iqkON_of3d8mDFlLZRsSiB9YvmvpTFeZCyjlHRFvzaG4xezh2crDIHBfVaasXl8b86m7F22selF_XZUG0JB4Ce615hxUYJlG_hlvvu6A/s400/email+template.bmp" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div>%name% and %matter% are dynamic macro taken from runtime.You can have your code to take up customer name and description from a failed sales order for an instance.<br />
A job is written, which produces three info message logs and sent it to the email.The template is helpful in forming email body parameters. You can send the mail from the email address of customer.<br />
<br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">static void SendEmail(Args _args)</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">{</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> SysInetMail mail;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> Map mappings;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> COM document;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> COM body;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> str ret, subject, matter;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> sysemailid emailid;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> languageId languageId;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> SysEmailMessageTable message;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> Xinfo info;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> int infoLogCounter;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> Log log;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> int i=1;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> container con;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> SysInfologEnumerator enum ;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> #help</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> ;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> info( " hello world");</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> error('this is error');</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> error('this is error 2 ');</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> //info - if you want to copy these info msg to a email in some functionality</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> log = Info::infoCon2Str( infolog.copy(1,infolog.num()));</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> con = infolog.copy(1,infolog.num());</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> enum = SysInfologEnumerator::newData(con );</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> while (enum.moveNext())</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> {</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> matter +=strfmt('</span></span><br />
<span class="Apple-style-span" style="color: blue;"></span><span class="Apple-style-span" style="color: blue;"> %1 -> %2 ',int2str(enum.currentException()), enum.currentMessage());</span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> }</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> emailId = 'Log';</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> languageId = 'en-us';</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mail = new SysInetMail();</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mail.parmForceSendDialog(true); // this will show u a dialog before sending.</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mappings = new Map(Types::String, Types::String);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mappings.insert('name', 'parthav');</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mappings.insert('matter',matter );</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> message = SysEmailMessageTable::find( emailId,languageId);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> ret = SysEmailMessage::stringExpand(message.Mail, mappings);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> ret = WebLet::weblets2Html4Help(ret, '');</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> document = new COM(#HTMLDocumentClassName);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> SysEmailTable::insertHTML2Document(document, ret);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> body = document.body();</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> subject = SysEmailMessageTable::find(emailId, languageId).Subject;</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> mail.sendMail( 'parthav.patel@ignify.com' , 'CSV Import Log', body.OuterText() ,false);</span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> </span></span><br />
<span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">}</span></span><br />
<span class="Apple-style-span" style="font-size: small;">After hitting f5,you will get a dialog and composition of email. You can avoid this by setting </span><b>mail.parmForceSendDialog(false) </b>in the above code.<br />
<div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1a5DNqDAvBVaG_XMxq8TTRZU7mldp8PxvQjGELfBuxulnnU5VJf62TH7XVUnU84fwjLbXogqUDjS0fbsB_2QM13Kf5iEkJ2XG1UwHlIrWopOTqfOzr9mNIm-8vlS7SillqXR5G1E5iO4/s1600/email+error.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1a5DNqDAvBVaG_XMxq8TTRZU7mldp8PxvQjGELfBuxulnnU5VJf62TH7XVUnU84fwjLbXogqUDjS0fbsB_2QM13Kf5iEkJ2XG1UwHlIrWopOTqfOzr9mNIm-8vlS7SillqXR5G1E5iO4/s320/email+error.bmp" width="245" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIfcbNRhtvk4jm6MGqhzOf1rD898u90pt-cxZKf_HSi7uKoIrldqF76hDLswZFJuBmigEVqaH-2A9VQUgUQGz3vmfmQodYYmfv52L-rQKBWKETWQWGk4qZShP90dx5gbqHdcdI7GJU-YE/s1600/email.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIfcbNRhtvk4jm6MGqhzOf1rD898u90pt-cxZKf_HSi7uKoIrldqF76hDLswZFJuBmigEVqaH-2A9VQUgUQGz3vmfmQodYYmfv52L-rQKBWKETWQWGk4qZShP90dx5gbqHdcdI7GJU-YE/s400/email.bmp" width="400" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;">You are now ready to send the mail of your report.</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-82418032889350870602010-10-14T05:17:00.001-07:002010-10-14T05:18:26.087-07:00How to find backend field name in ax2009If you want to use DB field name sometimes to import data like dimensions, you might want to consider getting DB field names. Here is the script which does that.<br />
<div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">static void BackendFieldName(Args _args)</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">{</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> sysdictfield df;</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> ;</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> df = new sysdictfield( tablenum(CustTable),fieldNum(CustTable, Dimension),2);</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;"> info(strfmt("%1",df.name(DbBackend::Native,2)));</span></span></div><div><span class="Apple-style-span" style="color: blue;"><span class="Apple-style-span" style="font-size: small;">}</span></span></div></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-75951549416232886752010-10-14T05:08:00.000-07:002010-10-14T05:11:52.923-07:00Problem with HotFix RollUp 5 (982811)Ax 2009 Hotfix RollUp 5 is one potential problem when applied to a box having multiple AOS or Applications. When It is applied to one AOS/Application and not to others, the client is obviously upgraded. The problem now when the client is on RU 5 and the Application Kernel build is lower than RU5 is that you see only one row of data. Only one record is displayed for any form although when you filter you find the desired data.<br />
<br />
This problem can be avoided when the kernel application build is upgraded to RU5.Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-1944754318238037442010-10-14T04:35:00.000-07:002010-10-14T04:38:48.817-07:00EP Error on installationWhen I tried to install EP on Farm Non-Admin server I got the following error. I tried it from the admin account of ax.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgel0osyRw6rocXbAl7UZYumos6DE3AoekKA7wzWTErHwhKiGM2FaH82o3MTMuq_WQWMebQnpVV20KZ8GYMedXNrgO3zIH_YWpU2LPq4e3w3A4msl5rDVYA6ercoXJQ7DZSAFnmMAAXZL4/s1600/EP+Error.bmp" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="330" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgel0osyRw6rocXbAl7UZYumos6DE3AoekKA7wzWTErHwhKiGM2FaH82o3MTMuq_WQWMebQnpVV20KZ8GYMedXNrgO3zIH_YWpU2LPq4e3w3A4msl5rDVYA6ercoXJQ7DZSAFnmMAAXZL4/s400/EP+Error.bmp" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">EP Installation Error</td></tr>
</tbody></table><b>On Event Viewer:</b><br />
<div><div class="MsoNormal"><span style="color: #1f497d;"><b>The trust relationship between this workstation and the primary domain failed.</b><o:p></o:p></span></div><div class="MsoNormal"><span style="color: #1f497d;"><br />
</span></div>Work around:<br />
<div>1.Check the .net Business connector configuration settings. This might be a naive approach and considering one must have already looked up seeing the log, I am suggesting to do the following work arounds.</div><div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">1)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="color: #1f497d;">Stop firewall, all its services, delete all unused inbound policies on firewall.<o:p></o:p></span></div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">2)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="color: #1f497d;">Install AOS , debugger and .net connector upto RU3 on the work station. I don’t know why it required AOS but failed without it.May be its with the configuration.<o:p></o:p></span></div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">3)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> .</span></span><span style="color: #1f497d;">Delete the workstation from domain and add it again – DNS issue.This is a WSS issue.<o:p></o:p></span></div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">4)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> .</span></span><span style="color: #1f497d;">If database was restored & EP is installed on one server – clear the BC Proxy account from form.<o:p></o:p></span></div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">5)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="color: #1f497d;">Recompile sysDevelopmentProxy class – ensure it compiles without error for .Net connector to work successfully.<o:p></o:p></span></div><div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"><span style="color: #1f497d;">6)<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="color: #1f497d;">Check the site bindings from Share Point servers, also from this server.<o:p></o:p></span></div><div class="MsoNormal"><span style="color: #1f497d;">Install EP & Role center with some luck.<o:p></o:p></span></div><br />
<br />
</div></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com1tag:blogger.com,1999:blog-3478793418850497707.post-19753049292636895182010-10-14T02:21:00.000-07:002010-10-14T02:21:34.385-07:00Workflow in Ax 2009 Troubleshooting<span class="Apple-style-span" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif; font-size: 12px;"></span><br />
<h2 style="border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; clear: both; color: #515151; font-size: 2em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><a href="http://workflowax.wordpress.com/2009/12/11/the-request-failed-with-http-status-405-method-not-allowed/" rel="bookmark" style="border-bottom-color: silver; border-bottom-style: none; border-bottom-width: 1px; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #515151; text-decoration: none;" title="Read The request failed with HTTP status 405: Method Not Allowed.">The request failed with HTTP status 405: Method Not Allowed.</a></h2><div class="entry" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><div style="margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em;"><br />
I had an error when trying to validate his workflow url with the following message being displayed: “The request failed with HTTP status 405: Method Not Allowed.” He was running on the following System configuration:<br />
1. Windows 2008 R2 64 bit.<br />
2. SQL Server 2008<br />
3. IIS 7</div><div style="margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em;">To resolve this error. I believe the simple solution is to set your IIS application Pool’s 32bit property to true</div><div style="margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em;">IIS –>Application pool of WF–> rightclick advanced settings and change 32 bit to TRUE.</div></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com0tag:blogger.com,1999:blog-3478793418850497707.post-32530374774134115762010-10-12T00:43:00.000-07:002010-10-12T00:43:51.272-07:00Find all relations on a Dynamics AX table object ~ IT Pro Ramblings<a href="http://patrikluca.blogspot.com/2009/11/find-all-relations-on-dynamics-ax-table.html">Find all relations on a Dynamics AX table object ~ IT Pro Ramblings</a>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com1tag:blogger.com,1999:blog-3478793418850497707.post-10388598807224337942010-07-21T02:44:00.000-07:002010-10-12T00:36:45.912-07:00Importing data in Ax 2009 with validations<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">I have created a solution in Ax 2009 to migrate bulk data from a csv format. It is better than the standard excel tool as no code for validation needs to be written. You have two options to validate the data of a field from its master table and one from relation. </span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Another striking feature is that the field in the file can be arranged randomly with the </span><b><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">AX field Name.</span></b><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It gives you independence to arrange the fields in any order in the file using the AX field names on the header. Also, there is a facility to extract a template and data, which appends a “$” to all mandatory fields. It can be imported as it is.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">When using a bulk upload, it is sometimes difficult to analyze the info log as its limit is 10k lines. Here you have an error file and log file setting which stores the invalidated data. The error file has those records from the actual file that were not Inserted/Updated/Validated.</span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKQ3fxpyzlX6K1zdBErmmKg5d3-ZxFP2J0rrpCaBEZ41ONe1_pNp0t21nJVG2iQkbwR6g8G9q2GBiPCeVw2PctLQZUyaoLvprGyaj-qvO823n_-_kMYuI-IEqp9bvAcZH05EGNJjIsWbY/s1600/error+1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKQ3fxpyzlX6K1zdBErmmKg5d3-ZxFP2J0rrpCaBEZ41ONe1_pNp0t21nJVG2iQkbwR6g8G9q2GBiPCeVw2PctLQZUyaoLvprGyaj-qvO823n_-_kMYuI-IEqp9bvAcZH05EGNJjIsWbY/s400/error+1.JPG" width="400" /></a></div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"></div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The Options available are:</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Read - Import Mode</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Write - Export Mode (to file)</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>File path options.</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Import Mode - Validate only with out import ( no import takes place) , Insert new only, Insert new and update existing.</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Entity</b> - The csv import tool has many predefined scripts to take care of customer, vendor , address,employees, item master and COA. You just need to put the data in the particular format like in the item master the data has to be right skewed and the last three fields must be Prices.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The address import has a common field setting for customer, vendor and employees.</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSRArPMhdqUuP9ahztNs3jz33gqNk3dh7IuZmdoaTw0_Sry9MX4pVPrllnQMBBu-d0OntGuxm0UoUv7i7juW0az_J4VyN9I7nkOyi09Qyh_H5_J8KRXwhWHbvOGIzzRYbZ3dB2Y-I7__M/s1600/Options.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="393" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSRArPMhdqUuP9ahztNs3jz33gqNk3dh7IuZmdoaTw0_Sry9MX4pVPrllnQMBBu-d0OntGuxm0UoUv7i7juW0az_J4VyN9I7nkOyi09Qyh_H5_J8KRXwhWHbvOGIzzRYbZ3dB2Y-I7__M/s400/Options.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The csv import options form</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><br />
</span></b></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;">Validation Type</span></b></span></span></b></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"> 1) Validate Relation on Table</span></b></span></span></b></span></span></b></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"> </span></b><span style="font-family: Arial, sans-serif; font-size: 12pt;">If you want to validate the data based on the parent table having field</span></span></span></b></span></span></b></span></span></b></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"> </span></b></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, sans-serif; font-size: 12pt;">relation on Enum, then <b><i>Validate relation on EDT</i></b> is used.</span></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, sans-serif; font-size: 12pt;"><b>2) </b></span></span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"> <b>Validate Relation on EDT</b></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"><b><span class="Apple-style-span" style="font-weight: normal;"> If you want to validate the data based on the Table relations then </span></b></span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"> </span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"><b><i>Validate relation on Table</i></b></span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"> </span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;">is used. This mode is not preferred</span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"> </span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, sans-serif; font-size: 12pt;">while updating.</span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;">The ref fields also get validated, so you need to ignore </span></span><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;">that error.</span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 16px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium;">On selecting <b>Generic</b> entity, you get options to select the table.</span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"> </span></b></span></div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span style="font-family: Arial, sans-serif; font-size: 12pt;"><br />
</span></b></span></div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: blue;"><b>Using Validation with an example:</b></span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Let us consider we have 3 records of customer to be migrated in a csv file.The payment Term has not come correct to the file(i.e. the data does not exist on paymterm table).</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABnrx7Vc0hhHdBZokznPH5Y6O23rfGpXujJrLG6w_dhdMKQSQx0HMdjDRY-19Tt3MQQB3dsopOLNO833qlW4H-iLLplegZ8sFp1Tq_MdQhXYexiVl3XRvwSuGrC0D6r_QV-dSPjirfRs/s1600/wrong+data+-+cut.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABnrx7Vc0hhHdBZokznPH5Y6O23rfGpXujJrLG6w_dhdMKQSQx0HMdjDRY-19Tt3MQQB3dsopOLNO833qlW4H-iLLplegZ8sFp1Tq_MdQhXYexiVl3XRvwSuGrC0D6r_QV-dSPjirfRs/s400/wrong+data+-+cut.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Customer 3 records. <span class="Apple-style-span" style="color: red;">Red - error while validation<br />
</span><br />
<span class="Apple-style-span" style="color: red;"></span><br />
<span class="Apple-style-span" style="color: red;"></span><br />
<span class="Apple-style-span" style="color: red;"></span><br />
<span class="Apple-style-span" style="color: red;"></span><br />
<span class="Apple-style-span" style="color: red;"><div style="text-align: left;"><span class="Apple-style-span" style="color: black;"><br />
</span></div></span></td></tr>
</tbody></table>Notice that the field names are the AX field names. They can be arranged in any order in the file. When the Validate Relations on Table option is chosen, the last two records will not be inserted because payment term Id 'wrond data' does not exist on the PaymTerm table.You will get an info log like:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuZDM3Ia6hd3gzRCTsoYa7xWH7lttdXyfSdwjO_Rpr4azxviXVf39i_bODZWeOm0N_iOOVFxf2pZCc1erwedmzCe5m2d1PH1bOoHsq-u6MxWUg6bBBkrQvXpklzcGOvUF2jKtKpo6Ohac/s1600/error+log.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="81" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuZDM3Ia6hd3gzRCTsoYa7xWH7lttdXyfSdwjO_Rpr4azxviXVf39i_bODZWeOm0N_iOOVFxf2pZCc1erwedmzCe5m2d1PH1bOoHsq-u6MxWUg6bBBkrQvXpklzcGOvUF2jKtKpo6Ohac/s400/error+log.JPG" width="400" /></a></div><div>The error log and the error records can also be found at the path mentioned in the error log parameters.You can change the data that is not imported from the error file of records and re import. The error file contains all the records that are not inserted due to some error.This is very useful as the wrong data is filtered effectively. The log file will copy the info log with the reference line number as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: left;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLq7lk3WZnGW9zKrVBQZoMI-IThcIJvrgh3o60uJveX06vwxYcw9b3PxX82_WoRu20DIYizZqiefU1QT-SiWjZObevMsyye9tXzOaZ0NzTI9dSq82eAXpy_W_GDj_-mTrUERswzd0Okno/s1600/log+file.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="51" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLq7lk3WZnGW9zKrVBQZoMI-IThcIJvrgh3o60uJveX06vwxYcw9b3PxX82_WoRu20DIYizZqiefU1QT-SiWjZObevMsyye9tXzOaZ0NzTI9dSq82eAXpy_W_GDj_-mTrUERswzd0Okno/s400/log+file.JPG" width="400" /></a></div><span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;">Code used to build dynamic query for validating EDT -</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> for (relationLine=1; relationLine <= linesCnt; relationLine++)</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> fieldId = dictRelation.lineExternTableValue(relationLine);</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> switch( dictRelation.lineType(relationLine) )</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::Dataset :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::Field :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildRange1 = _queryBuildDataSource.addRange(fieldId);</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildRange1.value( _Value );</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> break;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::ExternFixed :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildRange2 = _queryBuildDataSource.addRange(dictRelation.lineExternTableValue(relationLine));</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> if( _array>0)</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildRange2.value(int2str(_array));</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> else</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildRange2.value(int2str(dictRelation.lineTableValue(relationLine)));</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> break;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> }</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> }</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;">Validate Table Realtion-</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"><br />
</span> </span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> switch( dictRelation.lineType(relationLine) )</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::Field :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> thisFieldId = dictRelation.lineTableValue(relationLine);</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> printFieldId = thisFieldId;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> if( (_commonRecord.(thisFieldId)) && ValidationRequired && thisFixedValidation )</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildDataSource.addRange(ExtfieldId).value( _commonRecord.(thisFieldId) );</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> }</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> else</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> ValidationRequired = False;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> }</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> break;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::ThisFixed :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> thisFieldId = dictRelation.lineTableValue(relationLine);</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> if( _commonRecord.(thisFieldId) && (_commonRecord.(thisFieldId)!= ExtfieldId && ValidationRequired ))</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> {</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> thisFixedValidation = False;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> }</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> break;</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> case TableRelation::ExternFixed :</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> if( ValidationRequired)</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> _queryBuildDataSource.addRange(dictRelation.lineExternTableValue(relationLine)).value(int2str(dictRelation.lineTableValue(relationLine)));</span></span><br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: #741b47;"> break;</span></span><br />
<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<div class="MsoListParagraph" style="margin-left: 1.0in; mso-add-space: auto; text-align: justify;"><span style="font-family: Arial, sans-serif;"><o:p></o:p></span></div></div>Parthavhttp://www.blogger.com/profile/07679753863546892624noreply@blogger.com1