RSS

Category 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:

Filter Invent On -Hand based on WMSLocation


Today I have faced a issue how to show or filter data on InventSum Grid in EP from WMSLocation i.e. for each location there should be Invent On-hand data.

Same as AX 2012 R3 rich client in EP.

For these following are the steps:

  1. Create a Dataset EPInventGridOnHand.
  2. Add InventSum and InventDim table in datasource of EPInventGridOnHand dataset.
  3. Now on init() method of EPInventGridOnHand dataset we will get WMSLocation buffer with InventLocationId and WmsLocationId field value and write below code before dataset Init method super()

switch(element.args().dataset())

{
case(tableNum(WMSLocation)):
wmsLocation = element.args().record(); // Here wmsLocation is a global table buffer
break;
}

For filtering based on WMSLocation write below code after dataset init method super()

               //Filter Invent On-hand based on WMSlocation

inventDim_ds.query().dataSourceTable(tableNum(InventDim)).addRange(fieldnum(InventDim,wmsLocationId)) .                                   value(queryValue(wmsLocation.wMSLocationId));

inventDim_ds.query().dataSourceTable(tableNum(InventDim)).addRange(fieldnum(InventDim,InventLocationId)) .                                 value(queryValue(wmsLocation.inventLocationId));

              //This will group by Onhand based on Item

inventSum_ds.query().dataSourceTable(tableNum(Inventsum)).addGroupByField(fieldNum(Inventsum, ItemId));

             //This will add fields in InventSum run time with clubbing the values.
InventSum::queryAddSumFields(inventSum_DS.query().dataSourceTable(tableNum(InventSum)));

Thanks

Arun Garg

 
1 Comment

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

 

Tags: ,

Find axbound field on EP


static AxBoundField GetField(DataControlFieldCollection fields, string name)
{
foreach (DataControlField field in fields)
{
AxBoundField boundField = field as AxBoundField;
if (boundField != null && String.Compare(boundField.DataField, name, true) == 0)
{
return boundField;
}
}

return null;
}

 
Leave a comment

Posted by on September 21, 2015 in AX 2012, 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:

 
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