martedì 19 aprile 2016
TIP: Error executing code: The field with ID '0' does not exist in table 'SysExtensionSerializerExtensionMap'.
If you ever get "Error executing code: The field with ID '0' does not exist in table 'SysExtensionSerializerExtensionMap'." error in CIL, it may happen it is the table extension framework + the standard buf2buf function to blame.
Somehow, if you pass a Map instead of a table to buf2buf function, the following line fails:
_to.(fieldId) = _from.(fieldId);
However, if you replace this line with:
fieldName = fieldId2name(_from.TableId, fieldId);
_to.setFieldValue(fieldName, _from.getFieldValue(fieldName));
everything is fine both in X++ and in CIL.
P.S. I didn't dare to change the standard buf2buf method. Istead, I created another method and used it in the table extension framework logic, which failed because of the issue (\Data Dictionary\Maps\SysExtensionSerializerMap\Methods\copyExtensionTableData)
Reposted: https://community.dynamics.com/ax/b/dynamicsaxnotesonthecuffs/archive/2016/04/04/error-executing-code-the-field-with-id-39-0-39-does-not-exist-in-table-39-sysextensionserializerextensionmap-39
martedì 12 aprile 2016
AX7: How to Connect a Microsoft Dynamics AX 7 TFS Project
Very interesting article about source control and how to add and configure mapping a project on source control: https://stoneridgesoftware.com/how-to-connect-a-microsoft-dynamics-ax-7-tfs-project/
venerdì 8 aprile 2016
HOWTO: Delete Label Files from AX 2012
Here are the steps to delete Label Files from AX 2012:
- Create a new model. You could call it "LabelsBeGone".
- Open the AOT and move the Label File(s) you want to get rid of to the new model.
- Close AX and stop the AOS.
- Use AXUtil to delete the new model.
- Delete the label files from the server folder; C:\Program Files\Microsoft Dynamics AX\60\Server\...\bin\Application\Appl\Standard
- Start the AOS.
- Skip the upgrade wizard.
venerdì 11 marzo 2016
DIXF: Field 'Entity' must be filled in on DIXF (AX2012)
On AX2012 CU9 or later, if found it on CU10 for example, if you got this error, you can RUN this scripts. Is an update script of CU9, the entity name is a new field inserted on this version.
ReleaseUpdateDB63_DMF releaseUpdateDB63_DMF = new ReleaseUpdateDB63_DMF();
releaseUpdateDB63_DMF.updateEntityType();
Or, more simple, you can delete all entities, when you reopen the entities form all entities will be created. I know, you don't belive me, but it works.
ReleaseUpdateDB63_DMF releaseUpdateDB63_DMF = new ReleaseUpdateDB63_DMF();
releaseUpdateDB63_DMF.updateEntityType();
Or, more simple, you can delete all entities, when you reopen the entities form all entities will be created. I know, you don't belive me, but it works.
lunedì 7 marzo 2016
CODE: Check Security Key via X++ in AX2009
this script you can check if a user has permission for a particular security key by code.
SecurityKeySet securityKeys;
Boolean fullAccess;
;
securityKeys = new SecurityKeySet();
securityKeys.loadUserRights(curuserid());
fullAccess = securityKeys.access(securitykeynum("xxxxxxxxxxxxxxx")) == AccessType::Delete;
info(fullAccess ? "1" : "0");
SecurityKeySet securityKeys;
Boolean fullAccess;
;
securityKeys = new SecurityKeySet();
securityKeys.loadUserRights(curuserid());
fullAccess = securityKeys.access(securitykeynum("xxxxxxxxxxxxxxx")) == AccessType::Delete;
info(fullAccess ? "1" : "0");
lunedì 22 febbraio 2016
HOWTO: Set translation of label on fly by code
Use this script to set the value and comment of an existing label only if this label not exist in a particolar language. You can use it on fly by code whitout use of developer tool.
In my case i can set more than 200+ labels traduction in a couple of minutes.
void modifyLabel(LabelId _labelId, str _srcLanguage, str _trgLanguace, str _trgString, str _trgComment = '')
{
SysLabel srcLang = new SysLabel(_srcLanguage);
SysLabel trgLang = new SysLabel(_trgLanguace);
;
_labelId = "@" + _labelId;
if (!srcLang.exists(_labelId) || !srcLang.extractString(_labelId))
{
warning(strfmt("L'etichetta %1 non esiste nella lingua %2", _labelId, srcLang.languageId()));
return;
}
if (trgLang.exists(_labelId) && trgLang.extractString(_labelId))
{
warning(strfmt("L'etichetta %1 esiste già nella lingua %2 con il valore %3", _labelId, trgLang.languageId(), trgLang.extractString(_labelId)));
return;
}
cnt += trgLang.modify(_labelId, _trgString, _trgComment ? _trgComment : srcLang.extractComment(_labelId));
info(strFmt("Modificata etichetta %1 e impostato il testo %2 in lingua %2", _labelId, _trgString));
}
This script can semplify the same action but in more than one language, example in my case the traduction of en-us and en-gb is the same.
void modifyLabelMultipleLanguagese(LabelId _labelId, str _srcLanguage, container _trgLanguaces, str _trgString, str _trgComment = '')
{
int i;
str trgLanguace;
;
for(i=1;i<=conlen(_trgLanguaces);i++)
{
trgLanguace = conpeek(_trgLanguaces, i);
modifyLabel(_labelId, _srcLanguage, trgLanguace, _trgString, _trgComment);
}
}
In my case i can set more than 200+ labels traduction in a couple of minutes.
void modifyLabel(LabelId _labelId, str _srcLanguage, str _trgLanguace, str _trgString, str _trgComment = '')
{
SysLabel srcLang = new SysLabel(_srcLanguage);
SysLabel trgLang = new SysLabel(_trgLanguace);
;
_labelId = "@" + _labelId;
if (!srcLang.exists(_labelId) || !srcLang.extractString(_labelId))
{
warning(strfmt("L'etichetta %1 non esiste nella lingua %2", _labelId, srcLang.languageId()));
return;
}
if (trgLang.exists(_labelId) && trgLang.extractString(_labelId))
{
warning(strfmt("L'etichetta %1 esiste già nella lingua %2 con il valore %3", _labelId, trgLang.languageId(), trgLang.extractString(_labelId)));
return;
}
cnt += trgLang.modify(_labelId, _trgString, _trgComment ? _trgComment : srcLang.extractComment(_labelId));
info(strFmt("Modificata etichetta %1 e impostato il testo %2 in lingua %2", _labelId, _trgString));
}
This script can semplify the same action but in more than one language, example in my case the traduction of en-us and en-gb is the same.
void modifyLabelMultipleLanguagese(LabelId _labelId, str _srcLanguage, container _trgLanguaces, str _trgString, str _trgComment = '')
{
int i;
str trgLanguace;
;
for(i=1;i<=conlen(_trgLanguaces);i++)
{
trgLanguace = conpeek(_trgLanguaces, i);
modifyLabel(_labelId, _srcLanguage, trgLanguace, _trgString, _trgComment);
}
}
venerdì 12 febbraio 2016
HOWTO: Get error details from INFOLOG by code
You can use this code for getting che last error from INFO LOG.
I tested this code in all situations, using prefix and other conditions, and it works fine.
In the past i found some other scripts to do that, but i some situations does not work.
int i;
container infoLogCon;
container infoLogItem;
Exception infoLogItemExceptionType;
str infoLogItemMessage;
str strInfoLogMessage;
;
try
{
infologCon = infolog.copy(1, infolog.line());
for(i = infolog.line() + 1; i > 1; i--)
{
infoLogItem = conpeek(infologCon, i);
infoLogItemExceptionType = conpeek(infoLogItem, 1);
infoLogItemMessage = conpeek(infoLogItem, 2);
if (infoLogItemExceptionType == Exception::Error)
{
strInfoLogMessage = infoLogItemMessage;
strInfoLogMessage = strreplace(strInfoLogMessage, '\t', ' - ');
break;
}
}
if (!strInfoLogMessage)
strInfoLogMessage = "Errore non definito";
}
catch
{
strInfoLogMessage = "Errore sconosciuto";
}
strInfoLogMessage = strltrim(strrtrim(strInfoLogMessage));
I tested this code in all situations, using prefix and other conditions, and it works fine.
In the past i found some other scripts to do that, but i some situations does not work.
int i;
container infoLogCon;
container infoLogItem;
Exception infoLogItemExceptionType;
str infoLogItemMessage;
str strInfoLogMessage;
;
try
{
infologCon = infolog.copy(1, infolog.line());
for(i = infolog.line() + 1; i > 1; i--)
{
infoLogItem = conpeek(infologCon, i);
infoLogItemExceptionType = conpeek(infoLogItem, 1);
infoLogItemMessage = conpeek(infoLogItem, 2);
if (infoLogItemExceptionType == Exception::Error)
{
strInfoLogMessage = infoLogItemMessage;
strInfoLogMessage = strreplace(strInfoLogMessage, '\t', ' - ');
break;
}
}
if (!strInfoLogMessage)
strInfoLogMessage = "Errore non definito";
}
catch
{
strInfoLogMessage = "Errore sconosciuto";
}
strInfoLogMessage = strltrim(strrtrim(strInfoLogMessage));
Iscriviti a:
Post (Atom)
AX 2012: The request was aborted: Could not create SSL/TLS secure channel
The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...
-
When your code run on CIL remember to set to null any enumerator of Sets or Maps before made a change on it. If the enumerator is not restor...
-
The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...
-
NumberSeq numberSeq; InventTransferTable inventTransferTable; InventTransferLine inventTransferLine; InventDim inventDim; ; ttsbegin; ...