AX 2012 R3: Convert Images (JPEG) to Base64

How to convert images to base 64

public str (RefRecId _refRecId, RefTableId _refTableId)

{
System.Drawing.Image image;
System.IO.MemoryStream memoryStream;
str filePath = ”;
Filename fileName = ”;
DocuRef docuRef;
;

select docuRef
where docuRef.RefRecId == _refRecId
&& docuRef.RefTableId == _refTableId;

if (docuRef)
{

// Get Images complete File Name
fileName = docuRef.completeFilename();

image = System.Drawing.Image::FromFile(@Filename);
memoryStream = new System.IO.MemoryStream();
image.Save(memoryStream, System.Drawing.Imaging.ImageFormat::get_Jpeg());
filePath = System.Convert::ToBase64String(memoryStream.ToArray());
}

return filePath;
}

Screen Shot:

Capture

 

Note:

Assuming parameters _refRecId and _refTableId came from InventTable where the Product Images is set in Released Product under Product Image function. See image below:

Untitled

 

Removed Failed Report Name in Report Queue Status of Management Reporter 2012

Removed Failed Report Name in Report Queue Status of Management Reporter.

MR Report Queue Status Failed

Solution

  • Go to SQL Server and Find Management Reporter Database. Usually default name is ManagementReporter.
  • Run a new query on it, and type the following:

DELETE REPOSITORY  WHERE StatusType <> 0

  • Go to Management Reporter Designer and check again Report Queue Status.

AX 2012: Client found response content type of “, but expected ‘text/xml’. The request failed with an empty response.

Error while calling SSRS  Reports in AX 2012

Error Details:

Client found response content type of “, but expected ‘text\xml’. The request failed with an empty response.

The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.

Error Screen Shots:

Client found response content type of

 

Solution (Based on my experiences):

  1. Check your Reporting Server, check local drive where your Reporting Server Files are stored. Check if there still available spaces.
  2. In my case, Client found response content type of (sol)
  3. After I cleaned my Local Disk (C:), error is resolved.

AX 2012: Get Exchange Rates

 

Get Exchange Rates in AX 2012

Parameters are CurrencyCode and TransDate.

 

public ExchRate getExchRateFind(CurrencyCode _currencyCode = ”, TransDate _transDate = systemDateGet())
{
ExchangeRateType ExchangeRateType;
ExchangeRateCurrencyPair ExchangeRateCurrencyPair;
ExchangeRateHelper exchangeRateHelper;
CurrencyExchangeRate exchangeRate1;
CurrencyExchangeRate exchangeRate;
;

exchangeRateHelper = ExchangeRateHelper::newExchangeDate(Ledger::current(), _currencyCode, _transDate);
exchangeRate1 = exchangeRateHelper.getExchangeRate1();
exchangeRate = exchangeRateHelper.displayStoredExchangeRate(exchangeRate1);

return exchangeRate;
}

AX 2012 R3: Logon Error, A user session on the server could not be created.

Logon error

A user session on the server could not be created. Try to start the client again. If the problem continues, contact the Microsoft Dynamics AX Administrator.

Warning Details:

This usually caused by Hard-disk failure due to Not Accessible, Out of Memory Spaces or even corrupted drives.

Microsoft Dynamics AX cannot create  a session record in the Databases and you will not be able to open or access Microsoft Dynamics AX Client.

A user session on the server could not be created

 

Solution Details:

  • Check your SQL Server where your Microsoft Dynamics AX Databases was stored.
  • Check if local drives where AX Databases stored are accessible and still enough memory spaces. If full try to clean some temporary log files or try to increase your local drive spaces.

 

Show’s Data(D:) is already full and no enough spaces to create any records.

Before

A user session on the server could not be created (sol)

 

After

A user session on the server could not be created (sol 2)

 

Try again to open Microsoft Dynamics AX Client.

 

Regards,
Ariston Javier

AX 2012: DIXF Error while importing product entity from staging to target

Data Migration Framework hit error while importing product entity from staging to target.

Error Details:

dmf error

Stack trace

(C)\Classes\DMFEntityWriter\write – line 244
(S)\Classes\DMFEntityWriter\runOnServerWriter – line 14
(C)\Classes\DMFEntityWriter\run – line 98
(C)\Classes\DMFEntityWriter\main – line 24
(C)\Classes\xMenuFunction\run
(C)\Classes\MenuFunction\run – line 85
(C)\Forms\DMFWriteData\Designs\DesignList\DMFEntityWriterBatch\Methods\Clicked – line 23

 

Resolutions:

Open Microsoft Dynamics Ax development workspace and navigate to the following:

AOT > Queries > DMFProductTargeEntity > DataSources > InventTable > DataSources

in InventTable > DataSources, delete RetailInventTable then save and compile DMFProductTargetEntity and go back to Target Entities Form.

Look for “Product” entity then click Modify target mapping and switch to Mapping details then click Generate mapping, click Yes to generate mappings from defaults.

Try again to import the files.

 

 

 

AX 2012: Update Default Site

InventTable inventTable;
InventItemInventSetup inventItemInventSetup;
InventItemPurchSetup inventItemPurchSetup;
InventItemSalesSetup inventItemSalesSetup;
InventDim inventDim;

ttsBegin;
while select forUpdate inventTable
{
inventDim.initValue();
inventDim.InventSiteId = ‘T1’;
inventDim.inventLocationId = inventTable.inventLocationId();
inventDim = InventDim::findOrCreate(inventDim);

//Default order settings
inventItemInventSetup= inventItemInventSetup::findDefault(inventTable.ItemId, true);
inventItemInventSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemInventSetup.update();
inventItemPurchSetup= inventItemPurchSetup::findDefault(inventTable.ItemId, true);
inventItemPurchSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemPurchSetup.update();

inventItemSalesSetup= inventItemSalesSetup::findDefault(inventTable.ItemId, true);
inventItemSalesSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemSalesSetup.update();

}
ttsCommit;

AX 2012 R3: The “GenerateRdlTask” task failed unexpectedly

Error 1: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) C:\Program Files (x86)\MSBuild\Microsoft\DynamicsTools\Microsoft.Dynamics.Framework.Design.Reporting.Modeling.targets 103

Error 2 The “GenerateRdlTask” task failed unexpectedly.
System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at Microsoft.Dynamics.Framework.Deployment.Reports.DomainBound.PrepareTask(AppDomain tempAppDomain)
at Microsoft.Dynamics.Framework.Deployment.Reports.GenerateRdlTask.GetBusinessLogicAssemblyReferences(String assemblyPath)
at Microsoft.Dynamics.Framework.Deployment.Reports.GenerateRdlTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() C:\Program Files (x86)\MSBuild\Microsoft\DynamicsTools\Microsoft.Dynamics.Framework.Design.Reporting.Modeling.targets 103 6 PurchRFQSend

 

Solution:

This issue is related to Dynamics AX 2012 R3 CU8 and Visual Studio 2013.

This has been addressed and solved by applying the below settings.
Set COMPLUS_LoaderOptimization Environment Variable to 1 in O/S
1. Open the Start Menu and right click on Computer. Select Properties.

2. Select Advanced system settings.

3. In the Advanced tab, select Environment Variables.

4. Select New.

5. Set Variable Name: COMPLUS_LoaderOptimization

6. Set Variable Value: 1

For more information visit the link below:

https://fix.lcs.dynamics.com/Issue/Solution/1103883?bugId=3383717&qc=0da3617dd976ac65f16064d0450e7a6d203fa0bd82a8ffafb97711d7cb479ac9

 

 

Export Model in AX 2012 using Microsoft Dynamics AX Management Shell

A Model can be export and import into a model store.

Microsoft Dynamics AX Model is a set of elements in a given layer and each layer can be one or more models.

Model can be export to files using Microsoft Dynamics AX Management Shell and it will have .axmodel extensions.

Model exported called Model File or AX Model File.

Prerequisites:

  1. Administrative permissions on the local computer.
  2. System Administrator rights in Microsoft Dynamics AX.
  3. In Microsoft SQL Server:
    • Membership in the Securityadmin server role on the SQL Server instance.
    • Membership in the db_owner role in the Microsoft Dynamics AX database.

Procedures:

  1. Open Microsoft Dynamics AX Management Shell, Go to Start Menu > All Programs > Administrative Tools > Microsoft Dynamics AX Management Shell.
  1. At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
    AX Management Shell:
    Export-AXModel –Model <name> -File <Filename.axmodel> 
    Example:
    Export -AXModel -Model "USR Model" -File C:\USR.axmodel
    
    Export Model AX2012
    
    Wait until it finished...
    
    Export Model AX2012 - Exported
    
    AX model files should be save and placed in C:\USR.axmodel
    
    Export Model AX2012 - Exported Location
    
    

     

    You can use the –Server, –Config, or –Database parameters to specify the environment to export from.

    You can also use the -Key parameter to specify the strong-name key pair file to use to sign a model.

    For more information, see Export-AXModel

Management Reporter Configuration Console Stopped working – Unexpected end of file.

Event Viewer Error (Image 1)

Error:

Unexpected end of file.

Machine: XXXXXXXXXX

1

**************************

Event Viewer Error (Image 2)

Error

Faulting Application name: MRConfigureConsole.exe, version: 2.12.140001.45 time stamp: 0x564f9134

Exception code: 0xe0434352

3

 

*******************************************

Event Viewer Error (Image 3)

Error:

Application: MRConfigurationConsole.exe

Description: The process was terminated due to an unhandled exception.

Exception Info: System.Xml.XmlException

 

2

 

****************************SOLUTION********************************

Solution:

Go to this path:

C:\ProgramData\IsolatedStorage\<XXX.XXX>\<YYY.YYYY>\

Check all the folder “Publisher.<XXXXXXXXX>” one by one. Go inside the folder and you can find “AssemFiles” Folder open it and you can find “DeploymentContext.txt” inside.

Right Click  and Open “DeploymentContext.txt”, If you see it’s empty delete it and if have something text inside just leave it as it is.

Note: Delete “DeploymentContext.txt” only when it’s empty to the whole Folder.

After you validated all the “Publisher.<XXXX>” Folder, Try to run the Configuration Console again and it should be working as normal.

 

If this help you, please like or put some comments below.

Thank you,