Below code will help to get the value of the field from enterprise portal
we can retrive the value from Grid / group / form using below code
DataSetViewRow row = CurrentRow;
string accountnum= string.Empty;
if (row != null)
{
accountnum= (string)row.GetFieldValue("custTrans!AcountNum");
}
____________________________________________________________________________
Solution:
1. Open the web control in Visual studio
2. Open the Design file of the web control (.ascx)
3. Click source button to view Ascx coding (HTML code)
4. Find(ctrl + F ) Metadata in the ascx code
5. Simply delete the word whereever it is appear in ascx file
6. Save and deploy the webcontrol.
7. Open the webpage again, the error is resolved.
1. Open the web control in Visual studio
2. Open the Design file of the web control (.ascx)
3. Click source button to view Ascx coding (HTML code)
4. Find(ctrl + F ) Metadata in the ascx code
5. Simply delete the word whereever it is appear in ascx file
6. Save and deploy the webcontrol.
7. Open the webpage again, the error is resolved.
private DataSetViewRow CurrentExpenseHeaderRow
{
get
{
DataSetView dsv = this.DS_TrvExpTable.GetDataSet().DataSetViews["TrvExpTable"];
return (dsv == null) ? null : dsv.GetCurrent();
}
}
private IAxaptaRecordAdapter CurrentRecord
{
get
{
return (this.CurrentRow == null) ? null : this.CurrentRow.GetRecord();
}
}
private IAxaptaRecordAdapter CurrentExpenseHeaderRecord
{
get
{
return (this.CurrentExpenseHeaderRow == null) ? null : this.CurrentExpenseHeaderRow.GetRecord();
}
}
{
get
{
DataSetView dsv = this.DS_TrvExpTable.GetDataSet().DataSetViews["TrvExpTable"];
return (dsv == null) ? null : dsv.GetCurrent();
}
}
private IAxaptaRecordAdapter CurrentRecord
{
get
{
return (this.CurrentRow == null) ? null : this.CurrentRow.GetRecord();
}
}
private IAxaptaRecordAdapter CurrentExpenseHeaderRecord
{
get
{
return (this.CurrentExpenseHeaderRow == null) ? null : this.CurrentExpenseHeaderRow.GetRecord();
}
}
_________________________________________
Call dynamics AX dataset method in Enterprise portal
boolean isValid = ((bool)this.DS_TSTimesheetEntry.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("validateTSTimesheetLineWrite"))
________________________________________________________________________________
How to use infolog in Enterprise portal
Proxy.Info obj = new
Proxy.Info(this.AxSession.AxaptaAdapter);
obj.add(Proxy.Exception.Info,
"Testing");
________________________________________________________________________________
How to call method other Webcontrol method in Enterprise portal
TrvUtility.GetAdminCustomFieldsDictionary(this.AxSession,
this.Page.Session, TrvUtility.AdminCustomFields.Transaction);
________________________________________________________________________________
How to refer / add exisitng webcontrol in your web control
Needs to write the below code in design form
<%@ Register
Src="TrvUtility.ascx" TagName="AxUtility"
TagPrefix="AxUtil" %>
________________________________________________________________________________
How to access enum values in Enterprise portal
ApplicationProxy.TrvAppStatus approvalStatus;
approvalStatus = ((ApplicationProxy.TrvAppStatus)this.CurrentExpenseHeaderRow["ApprovalStatus"]);
approvalStatus = ApplicationProxy.TrvAppStatus.None;
approvalStatus = ((ApplicationProxy.TrvAppStatus)this.CurrentExpenseHeaderRow["ApprovalStatus"]);
approvalStatus = ApplicationProxy.TrvAppStatus.None;
return (ApplicationProxy.TrvAppStatus)approvalStatus;
________________________________________________________________________________
compare Enum values
if
((ApplicationProxy.TrvExpType)this.CurrentRow["ExpType"] == ApplicationProxy.TrvExpType.Hotel)
{
long recId = this.CurrentRow == null ? 0 : System.Convert.ToInt64(this.CurrentRow["RecId"], CultureInfo.InvariantCulture);
guestsLabel = ApplicationProxy.EPTrv.getGuestLabel(recId);
}
{
long recId = this.CurrentRow == null ? 0 : System.Convert.ToInt64(this.CurrentRow["RecId"], CultureInfo.InvariantCulture);
guestsLabel = ApplicationProxy.EPTrv.getGuestLabel(recId);
}
____________________________________________________________________________
How to enable\ disable fields in Grid
foreach (DataControlField dcf in this.AxGroup_ExpenseHeaderOverviewLeft.DataControlFieldCollection)
{
axbf = dcf as AxBoundField;
if (axbf != null)
{
switch (axbf.DataField)
{
case "ExpNumber":
case "employeeName**":
case "Txt1":
axbf.Visible = true;
break;
}
}
}
How to enable\ disable fields in Group
foreach (DataControlField dcf in this.AxGroup_ExpenseHeaderOverviewRight.DataControlFieldCollection)
{
axbf = dcf as AxBoundField;
if (axbf != null)
{
switch (axbf.DataField)
{
case "TrvRequisition!RequisitionNumber":
case "totalAmountAuthorized**":
case "totalApprovalAmountWithCurrencyCode**":
axbf.Visible = true;
break;
// Description is shown on right group during create, and on left group for Approver, for UX reasons
case "Txt1":
axbf.Visible = false;
break;
}
}
}
foreach (DataControlField dcf in this.AxGroup_ExpenseHeaderOverviewLeft.DataControlFieldCollection)
{
axbf = dcf as AxBoundField;
if (axbf != null)
{
switch (axbf.DataField)
{
case "ExpNumber":
case "employeeName**":
case "Txt1":
axbf.Visible = true;
break;
}
}
}
How to enable\ disable fields in Group
foreach (DataControlField dcf in this.AxGroup_ExpenseHeaderOverviewRight.DataControlFieldCollection)
{
axbf = dcf as AxBoundField;
if (axbf != null)
{
switch (axbf.DataField)
{
case "TrvRequisition!RequisitionNumber":
case "totalAmountAuthorized**":
case "totalApprovalAmountWithCurrencyCode**":
axbf.Visible = true;
break;
// Description is shown on right group during create, and on left group for Approver, for UX reasons
case "Txt1":
axbf.Visible = false;
break;
}
}
}
__________________________________________________________________________________
bool custVendGroupHideForApprover = true;
if (this.AxGroup_ExpenseHeaderCustomerVendorForApprover.Visible)
{
foreach (DataControlField dcf in this.AxGroup_ExpenseHeaderCustomerVendorForApprover.DataControlFieldCollection)
{
if (dcf is AxBoundField)
{
// If any field is visible, do not hide the group
if (((AxBoundField)dcf).Metadata.Visible)
{
custVendGroupHideForApprover = false;
break;
}
}
}
this.AxGroup_ExpenseHeaderCustomerVendorForApprover.Visible = !custVendGroupHideForApprover;
}
________________________________________________________________________________
get particular table field value in visual studio
<dynamics:AxGroup ID="AxFieldGroupDefaultsProject" runat="server"
Caption="<%$ AxLabel:@SYS4534 %>">
<Fields>
<dynamics:AxBoundField DataSet="TrvExpTableNew"DataSetView="TrvExpTable"
DataField="ProjId" SortExpression="ProjId" AutoPostBack="true" OnDataChanged="ProjId_OnDataChanged"/>
</Fields>
</dynamics:AxGroup>
While adding the bound fields to the AxForm,
we won’t get this attributeAutoPostBack="true" to the AxBoundField.
To raise the OnDataChanged event, explicitly
need to add the above attribute toAxBoundField.
Then I had added the following code to the event …
protected void ProjId_OnDataChanged(object sender,AxBoundFieldDataChangedEventArgs e)
{
string expProjId =
((System.Web.UI.WebControls.TextBox)(e.BoundControl)).Text.ToString();
if (expProjId != "")
{
ButtonOK.Enabled
= true;
}
else
{
ButtonOK.Enabled
= false;
}
}
________________________________________________________________________________
string var = (string)this.EpDataSourceName.GetDataSet().DataSetViews["DataSourceName"].GetCurrent().GetFieldValue("Fieldname");
Example:
I have get vendor account value from PurchReqCreateDataset
string vendorID = (string)this.PurchReqCreateDs.GetDataSet.DataSetViews["PurchReqTable"].GetCurrent().GetFieldValue("VendAccount");
Upload document through EP
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 record
private 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");
}
}
}
}
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 record
private 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");
}
}
}
}
No comments:
Post a Comment