AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • In-Person Gatherings
    • Power BI Workshop
    • Podcast
    • Rolodex
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Everything Else
Calculating Default...
 
Notifications
Clear all

Questions Calculating Default Value in custom fields

 
Everything Else
Last Post by Shawn Hawkins 7 years ago
3 Posts
3 Users
1 Reactions
4,633 Views
RSS
kevin.ruppert
Posts: 47
 kevin.ruppert
Topic starter
December 20, 2018 3:20 pm
(@kevin-ruppert)
Trusted Member
Joined: 6 years ago

I have several custom fields on my sales order form that I would like to populate default values. All three of the fields are date fields and would be default valued as follows:

Field 1-Default to Sales Order Request on Date (example 12/20/2018)

Field 2-Field 1 plus 7 days (Example 12/27/2018)

Field 3-Field 2 plus 14 days (Example 1/10/2019)

 

My initial thought was to try and get away with automation steps but this will only allow me to populate, not calculate a default. Whats the best method to achieve this?


2 Replies
Tim Rodman
Posts: 3204
 Tim Rodman
Admin
December 28, 2018 6:34 pm
(@timrodman)
Famed Member
Joined: 11 years ago

I think you'd need a customization project for this, probably some C# code. Try posting this on StackOverflow. There are a lot of C# savvy people there.

https://stackoverflow.com/questions/tagged/acumatica


Reply
Shawn Hawkins
Posts: 8
 Shawn Hawkins
January 9, 2019 7:11 pm
(@shawn328)
Active Member
Joined: 6 years ago

Kevin - not sure if you were able to get this working or not.  We did a very similar thing on the Purchase Order Promise Date field where is the PO was a drop ship we added 7 days to the date. I have attached a copy of the code as a reference for you.

//protected void POLine_PromistedDate_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
protected void POLine_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
POLine row = (POLine)e.Row;
if (row == null || row.PromisedDate == null)
return;

SOLineSplit lineSplit = PXSelect<SOLineSplit, Where<SOLineSplit.pONbr, Equal<Current<POOrder.orderNbr>>, And<SOLineSplit.pOLineNbr, Equal<Required<POLine.lineNbr>>>>>
.Select(Base, row.LineNbr);

if (lineSplit != null)
{
SOLine soLine = PXSelect<SOLine, Where<SOLine.orderNbr, Equal<Required<SOLineSplit.orderNbr>>, And<SOLine.lineNbr, Equal<Required<SOLineSplit.lineNbr>>>>>
.Select(Base, lineSplit.OrderNbr, lineSplit.LineNbr);

if (Base.CurrentDocument.Current.OrderType == "DP")
{
soLine.ShipDate = row.PromisedDate;
}
else
{
soLine.ShipDate = Convert.ToDateTime(row.PromisedDate).AddDays(7);
}

SOLines.Update(soLine);
}
}

Hope this helps.


Reply
Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,532 Topics
  • 11 K Posts
  • 48 Online
  • 2,420 Members
Our newest member: Katerina Pawlowski
Latest Post: Can't export GI's to excel that contain the FATrans DAC after upgrade to 2025 R1 in less than 25 min
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

  • Nathan Deardorff
Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2026 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×