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/
Advertisements
 
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

 
Leave a 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: ,

 
All About Dynamics 365

Dynamics 365, D365, Implementor

Syed Rafay Ali

This blog contains information about Functional techniques and guidelines in Microsoft Dynamics AX, including tips, tricks, tutorials, tools and upcoming news enhancement in Microsoft Dynamics Ax

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great WordPress.com site

Finite Minds

Adventures in IoT

Dynamics Ax

Technical Knowledge

timsaxblog

A blog about implementing Microsoft Dynamics AX and Dynamics 365 for Operations

Microsoft Dynamics 365 Blog

"Learn it all, not Know it all" in Dynamics 365 - Enterprise Edition, A Blog by Sandeep Chaudhury

DEVSerra - Dynamics AX development blog

Your official Microsoft Dynamics AX blog.

OrganicAX

Discovering Dynamics

AX

A blog by Hai Nguyen

Learn Dynamics Ax with Johnkrish

Live as if you were to die tomorrow. Learn as if you were to live forever - Mahatma Gandhi ****** The more I learn, the less I know - Albert Einstein

Twisted Untwirled

Just another WordPress.com site

ramdynamicsax

Just another WordPress.com site

guyterry's Dynamics AX blog

Just another Dynamics AX blog