RSS

Tag Archives: Enterprise Portal

Enterprise Portal Development Videos


Enterprise Portal Development Series: 

http://msdn.microsoft.com/en-us/dynamics/ax/cc507280.aspx

Videos at CustomerSource

Reference : http://dotnetxperience.blogspot.fi/
 
Leave a comment

Posted by on December 4, 2015 in AX 2012, Enterprise Portal, Uncategorized

 

Tags:

Passing parameters from Modal dialog to calling page.


 Caller page:

    protected void Page_Load(object sender, EventArgs e)
{

AxBaseWebPart.GetWebpart(this).ModalDialogClosed += new EventHandler(Base_ModalDialogClosed);
}

///
/// This method will  be used to Returning the value ModalDialogClosed.
///
///
///
void Base_ModalDialogClosed(object sender, AXModalDialogClosedEventArgs e)
{
// Code to handle the returned value.
string returnValue;
returnValue = e.DialogArgs.Data;
QtyEdit.Text = returnValue;
try
{
if (returnValue != String.Empty && localRecId != String.Empty)
{
this.OrderListDS.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call(“PurchLine”, returnValue, localRecId);
}
}
catch (Exception ex)
{
Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);
objInfoLog.add(Proxy.Exception.Info, “Ordering list not selected”);
}
}

Modal Page :

On button click:
protected void SaveButton_Click(object sender, EventArgs e)
{
AXDialogArgs args = DialogHelper.DialogArgs;
args.Data = QtyEdit.Text;
DialogHelper.Close(CloseDialogBehavior.Auto);
//can use the below to refresh calling page.
//DialogHelper.Close(CloseDialogBehavior.RefreshPage);

}

 
Leave a comment

Posted by on October 9, 2015 in Enterprise Portal

 

Tags:

Get AX Data Set Current Row on EP


private DataSetViewRow CurrentRow
{
get
{
try
{
DataSetView dsv = this.dsImportRadioEquip.GetDataSet().DataSetViews[this.gvModel.DataMember];
return (dsv == null) ? null : dsv.GetCurrent();
}
// CurrentRow on the dataset throws exception in empty data scenarios
catch (System.Exception)
{
return null;
}
}
}

 
Leave a comment

Posted by on September 21, 2015 in AX 2012, Enterprise Portal

 

Tags: ,

Custom lookup on EP


To provide an ASP.Net text box to work as AX lookup field, need to follow following steps
1-Creae a new text box in page (Out of AXForm)
2-Add new ax lookup control from tool box
3-Set target control as added text box by using Lookup control’s target properly
4-If you want to show filtered data on the lookup then chose lookup types as CustomDataSet
5-To define lookup dataset use lookupControl’s Lookup event and set lookupDataSet by using following pattern code

protected void LookupFieldName_Lookup(object sender, AxLookupEventArgs e)
{
//Getcurrent user to filter record based on current user
String usr = WindowsIdentity.GetCurrent().Name;
int pos = usr.IndexOf(‘\\’);
usr = pos != -1 ? usr.Substring(pos + 1) : usr;
AxLookup lookup = (AxLookup)sender;

// Create the lookup data set. The respective table will be used.
Proxy.SysDataSetBuilder sysDataSetBuilder;
sysDataSetBuilder = Proxy.SysDataSetBuilder.constructLookupDataSet(AxSession.AxaptaAdapter,TableMetadata.TableNum(AxSession, “TableName”));

// Set the generated data set as the lookup data set.
lookup.LookupDataSet = new DataSet(AxSession, sysDataSetBuilder.toDataSet());
using (Proxy.Query query = lookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())
{
query.dataSourceNo(1).addRange(TableArrayFieldMetadata.FieldNum(this.AxSession, “TableName”, “FieldName”)).value = “ValueInStringFormat”
//Example String.Format(“{0:dd/MM/yyyy}..{1}”, System.DateTime.Today, DateTime.MaxValue.ToShortDateString());

}

// Specify the fields for the lookup.
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields[“Field1”]));
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields[“Field2”]));
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields[“Field3”]));
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields[“Field4”]));
// Specify the select field for the lookup.
lookup.SelectField = “Index/LookupFieldName”;

 
Leave a comment

Posted by on September 21, 2015 in Enterprise Portal

 

Tags:

Upload document through EP in AX


To provide document attachement feature on EP form to upload documents, need to follow below setps 

1-Add new datasource by using EPDocuInfoAdd data set from AX
2-Add new ASP:FileUpload control on page
3-On Ok/Submit button call below method after Inserting/Updating recordprivate void DocumentUpload()
{
DataSetView datasetViewAppl = DataSourceName.GetDataSourceView(AXFormControlName.DataMember).DataSetView;

DataSetViewRow docuRefAdd = this.dsDocuRef.GetDataSourceView(“DocuRef”).DataSetView.AddNew();
DataSetViewRow docuRefCurrent = this.dsDocuRef.GetDataSourceView(“DocuRef”).DataSetView.GetCurrent();

IAxaptaRecordAdapter docuRefRecord = docuRefCurrent.GetRecord();
docuRefRecord.SetField(“RefTableId”, (object)datasetViewAppl.GetCurrent().GetFieldValue(“TableId”));
docuRefRecord.SetField(“RefRecId”, (object)datasetViewAppl.GetCurrent().GetFieldValue(“RecId”));
docuRefRecord.SetField(“TypeId”, “File”);

string[] myFiles = Request.Files.AllKeys;
bool dataSaved = false;
if (FileUpload1.HasFile)
{
using (IAxaptaRecordAdapter irecDocuValue = ApplicationProxy.EPDocumentHandling.saveWebDocumentClient(
AxSession.AxaptaAdapter,
docuRefRecord,
Request.Files.AllKeys[0]))
{
{
if (irecDocuValue != null)
{
// Get the RecId of the insert DocuValue record.
Int64 valueRecId = (Int64)irecDocuValue.GetField(“RecId”);

if (valueRecId != 0)
{
//Update the ValueRecId field of the DocuRef record with the RecId of the DocuValue record
docuRefRecord.SetField(“ValueRecId”, (object)valueRecId);

// Saves the DocuRef record in the DB.
ApplicationProxy.EP.createDocuRef(AxSession.AxaptaAdapter, docuRefRecord);

// Set this parameter to enable redirection.
dataSaved = true;
}
else
throw new System.Exception(“File upload error”);
}
}
}

 
Leave a comment

Posted by on September 21, 2015 in AX 2012, Enterprise Portal

 

Tags: ,

Enterprise Portal Installation: Error during retrieval of List of Sites


Enterprise Portal Installation: Error during retrieval of List of Sites
The log file contains…

Entering function Microsoft.Dynamics.Framework.Deployment.Portal.IEPDeployment.GetVirtualServerList
Entering method GetNamesOfAllWebSites
Leaving method GetNamesOfAllWebSites
The return value from this method is ‘1,2,3,4,5,288200494,1434903486’.
Entering method GetWebSite
The input parameters to this method are: ‘1’
Leaving method GetWebSite
The return value from this method is ‘1’.
Entering method GetFriendlyNameOfWebSite
The input parameters to this method are: ‘1’
Entering method GetWebSite
The input parameters to this method are: ‘1’
Leaving method GetWebSite
The return value from this method is ‘1’.
Leaving method GetFriendlyNameOfWebSite
The return value from this method is ‘Default Web Site’.
Entering method GetPortNumberOfWebSite
The input parameters to this method are: ‘1’
Entering method GetWebSite
The input parameters to this method are: ‘1’
Leaving method GetWebSite
The return value from this method is ‘1’.
Exception: System.InvalidOperationException

Message: Operation is not valid due to the current state of the object.

FullText: System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.Dynamics.Framework.Deployment.Web.WebSiteConfigurator.GetServerBindingsInformation(String webSiteName, ServerBindings serverBinding)
at Microsoft.Dynamics.Framework.Deployment.Web.WebSiteConfigurator.GetPortNumberOfWebSite(String webSiteName)
at Microsoft.Dynamics.Framework.Deployment.Portal.EPDeployment.get_IISVirtualServers()
at Microsoft.Dynamics.Framework.Deployment.Portal.EPDeployment.GetVirtualServerList()
at Microsoft.Dynamics.Framework.Deployment.Portal.EPDeployment.Microsoft.Dynamics.Framework.Deployment.Portal.IEPDeployment.GetVirtualServerList()
at Microsoft.Dynamics.Setup.DeploymentPortalWrapper.GetVirtualServerList()
at Microsoft.Dynamics.Setup.MainForm.s300_ShowTab(Object sender, EventArgs e)
at Microsoft.Dynamics.Setup.AxTabPage.ShowPage()
at Microsoft.Dynamics.Setup.MainForm.ShowPage(PageIDs pageID)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

==== Setup encountered an unhandled exception and could not be completed. For details see the previous messages in the log. ===

Solution: Check the .NET Bussiness Connector Permissions. Resolved…
 
Leave a comment

Posted by on July 1, 2015 in Enterprise Portal

 

Tags:

Enterprise Portal: Lookup not works in Enterprise portal


If user clicks on lookups then lookup form will display but the selected value will not reflect in to the text box.

Solution: Disable IE ESC for the users
1. Open the Server Manager Tool. Configure IE ESC is located on the right hand side of the interface in the section heading Security Information.
2. Select the link Configure IE Esc and the configuration window will open. At this point you can choose whether to turn off IE ESC for Administrators or for Users or for both.

 
Leave a comment

Posted by on July 1, 2015 in Enterprise Portal

 

Tags:

Excel download and open error from portal


Once we download excel file from portal and try to open file the below error will be shown.

The code used for the download is as follows.
HttpContext.Current.Response.TransmitFile(filepath);
System.IO.File.Delete(filepath);
HttpContext.Current.Response.End();

Here the issue comes because the file will be deleted immediately once the file transmitted. During this time the original file will be locked by other process.

So changing the code as below will resolves the issue.

HttpContext.Current.Response.TransmitFile(filepath);
HttpContext.Current.Response.Flush();
System.IO.File.Delete(filepath);
HttpContext.Current.Response.End();

 
Leave a comment

Posted by on July 1, 2015 in Enterprise Portal

 

Tags:

“The given key was not present in the dictionary” Error while loading EP page


While loading the EP page the below error will be shown.

An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.The given key was not present in the dictionary.

mscorlib

at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.ObjectModel.KeyedCollection`2.get_Item(TKey key)
at Microsoft.Dynamics.Framework.Collections.NameIdReferenceCollection`1.GetByName(String name)
at Microsoft.Dynamics.AX.Framework.Portal.Data.DataSetView.AddFieldToSelectionList(DataSourceDataFieldMetadata displayedField, String referenceFieldGroupName, Boolean skipResolvingTheField)
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.ControlsCommonFunctionality.GetAndEnsureDataKeys(DataSetView dataSetView)
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxForm.EnsureAllBoundFields()
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxForm.OnPagePreLoad(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreLoad(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The root cause for this issue is missing Super() method in DataSet.init() method.

 
Leave a comment

Posted by on June 30, 2015 in Enterprise Portal

 

Tags:

Using the infolog in the Enterprise Portal ax 2012


 In the portal you can access the infolog by using the Proxy of the Enterprise Portal

using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);

Now, when you want to write something to the infolog you need to give a Enum with it,
so the portal knows if the message you want to show is a info, warning or error.
So pass through Proxy.Exception.Info, Proxy.Exception.Warning or Proxy.Exception.Error.

1.objInfoLog.add(Proxy.Exception.Warning, “My warning”);

So in short thing you should keep in mind while using the Infolog-class:
Use short & informative messages
Choose the righty message level (info, warning, error)
Use actions, this simple trick is verry usefull for end-users
Limit the number of messages you send to the Infolog-dialog

 
Leave a comment

Posted by on May 25, 2015 in Enterprise Portal

 

Tags:

 
Dynamics Cognizance

Site presents solution to common and non-common Microsoft Dynamics Ax problems faced by Consultants and Administrators

365 by Thijs

Blogging about Microsoft 365, Azure and Automation!

axhowto

Blog about ax with sample codes, tips and tricks.

GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations

DynaD365Power

Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching

ErpCoder

Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX

“ANYONE WHO STOPS LEARNING IS OLD, WHETHER AT TWENTY OR EIGHTY.” —HENRY FORD

Sumit Potbhare

Dynamics 365 for Commerce

iotsolution.se

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens