Hi,
I need to add a custom field in the sales confirmation report.
I found many reference but those are not working for my case,
If you have any idea or reference let me know.
thanks and regards,
Aathil Ameen P
Hi, Instead of writing code in processReport method of DP class, you can add your code in insert method of SalesConfirmHeaderTmp. You can use OnInserting EventHandler or CoC on insert method. This way you don't have to update all records.
Both processRecords and Table insert method will work.
SalesConfirmHeaderTmp.CustAccount = SalesTable::find(SalesConfirmHeaderTmp.SalesId).CustAccount;
If your salesTable has Customer account value you can get it by adding select statement based on salesId relation between SalesTable and SalesConfirmHeaderTmp.
[PostHandlerFor(classStr(SalesConfirmDP), methodStr(SalesConfirmDP, processReport))] public static void SalesConfirmDP_Post_processReport(XppPrePostArgs args) { SalesConfirmDP dpInstance = args.getThis() as SalesConfirmDP; SalesConfirmHeaderTmp salesConfirmHeaderTmp = dpInstance.getSalesConfirmHeaderTmp(); SalesTable salesTable; ttsbegin; while select forUpdate salesConfirmHeaderTmp { select firstonly * from salesTable where salesTable.SalesId == salesConfirmHeaderTmp.SalesId; salesConfirmHeaderTmp.CustomerAccount = salesTable.CustomerAccount; salesConfirmHeaderTmp.update(); } ttscommit; } }
Thanks,
Girish S,
Your code is wrong then for that customer account. Because you are giving condition like tmp.custid == sales.id means you have already the value right? If not, then your select statement is wrong. You have to check from where to pick the customer account.
Also the select statement itself is wrong because you are selecting tmp table not sales table.
customer account is mu custom field
those values are come from SalesOder form , in that sales order form I used this customer Account where its data source is salesTable thats why i mapped like this "salesConfirmHeaderTmp.CustomerAccount = salesTable.CustomerAccount"
but i dont know how i get that field value
if you have any idea let me know
Thanks in advance Girish S
You decalred SalesTable buffer but where will you get cust account?
Thanks,
Girish S.
Thanks bro it worked and report generated.
but I didn't get my values " salesConfirmHeaderTmp.CustomerAccount = salesTable.CustomerAccount; "
this is what i saw from an reference but i dont know why it doesnt came for me
Why do you need one more select statement inside the while statement.
While select statement is enough for your scenario. No need of select statement inside while select.
Thanks,
Girish S.
class AatSalesConfirmController_Form_Handler
{
/// <summary>
/// post handler for the process report
/// method in Sales confirm dp class
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(classStr(SalesConfirmDP), methodStr(SalesConfirmDP, processReport))]
public static void SalesConfirmDP_Post_processReport(XppPrePostArgs args)
{
SalesConfirmDP dpInstance = args.getThis() as SalesConfirmDP;
SalesConfirmHeaderTmp salesConfirmHeaderTmp = dpInstance.getSalesConfirmHeaderTmp();
SalesTable salesTable;
ttsbegin;
while select forUpdate salesConfirmHeaderTmp
{
select * from salesConfirmHeaderTmp
where salesConfirmHeaderTmp.CustomerAccount == salesTable.CustomerAccount;
salesConfirmHeaderTmp.CustomerAccount = salesTable.CustomerAccount;
salesConfirmHeaderTmp.update();
}
ttscommit;
}
}
code for your reference
Maybe you missed to add forUpdate keyword in the select statement.
Thanks,
Girish S.
" Cannot edit a record in Show confirmation (SalesConfirmHeaderTmp). The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause. "
getting this error while generating report
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156