Modify items in Opportunity page - Status field - acumatica

I have been able to modify the dropdown values for other fields in the Opportunity page like Stage and Source, and even the Status field in other pages like Leads
The CROpportunity.Status column is defined as
public abstract class status : PX.Data.IBqlField { }
[PXDBString(1, IsFixed = true)]
[PXUIField(DisplayName = "Status", Visibility = PXUIVisibility.SelectorVisible)]
[PXStringList(new string[0], new string[0])]
[PXMassUpdatableField]
[PXDefault()]
public virtual string Status { get; set; }enter code here
There is no LeadStatuses attribute to be replaced.
In the Contact DAC, the column is defined in the following way
#region Status
public abstract class status : IBqlField { }
[PXDBString(1, IsFixed = true)]
[PXUIField(DisplayName = "Status")]
[LeadStatuses]
public virtual String Status { get; set; }
#endregionenter code here
It is, therefore possible to substitute the LeadStatuses attribute with a CacheExtension for the Contact DAC, or a GraphExtension over LeadMaint. But it's not the case for the CROpportunity DAC or the OpportunityMaint graph.
Any ideas?
Thanks
UPDATE
Following #Philippe suggestion, I was able to rename an existing status. "New" to "Newest"
However, when I try to create a new Automation Step. Reviewing the Combo Box values smartpanel, doesn't show the option to add new values:
Combo box values
I reviewed the AU tables but couldn't find any where these statuses values are stored - it would seem to be handled in the BLC layer
UPDATE 2
The option to add new values can be obtained by right-clicking on the grid
Combo box values

The statuses in Opportunities and Leads are defined in the Automation Steps. I covered a part of how automation steps can define business logic in this StackOverflow answer that could be helpful to you.
The basics here are as follow: Documents can have "workflows/steps" where some actions and fields are only available if they are in a specified step. Those steps are configurable without customization and thus can have status that are manage without customization as well. For more information about Automation Steps, I would refer you to the Help under Help > User Guide > Automation > Overview > Workflow Customization by Means of Automation Steps

Related

How to Enable PO Link on Sales Order screen

I'm trying to change the logic that enables the "PO Link" action/button on the Sales Order lines. I'm not finding where the code that controls the enable/disable lives. Is it controlled by a workflow? If so, where?
I've tried the below but the SetEnable() is being overridden, apparently.
public class MySOOrderEntryExt :
PXGraphExtension<PX.Objects.SO.GraphExtensions.SOOrderEntryExt.POLinkDialog,
PX.Objects.SO.GraphExtensions.SOOrderEntryExt.PurchaseSupplyBaseExt, SOOrderEntry>
{
public void _(Events.RowSelected<SOOrder> e)
{
//Base.Actions["pOSupplyOK"].SetEnabled(false); //Doesn't work.
Base.Actions["pOSupplyOK"].SetVisible(false);
}
}
Any ideas would be great.
TIA!
The control consists of 2 components. In the ASPX in the ActionBar of the grid, teh button is defined as:
<px:PXToolBarButton Text="PO Link" DependOnGrid="grid" StateColumn="IsPOLinkAllowed">
<AutoCallBack Command="POSupplyOK" Target="ds" ></AutoCallBack>
</px:PXToolBarButton>
The StateColumn refers to the field that determines if the action/button is enabled or not. This is defined in SOLine in the field IsPOLinkAllowed as:
#region IsPOLinkAllowed
public abstract class isPOLinkAllowed : PX.Data.BQL.BqlBool.Field<isPOLinkAllowed> { }
[PXFormula(typeof(Switch<Case<Where<SOLine.pOCreate, Equal<True>, And<SOLine.operation, Equal<SOOperation.issue>>>, True>, False>))]
[PXUIField(DisplayName = "", Visibility = PXUIVisibility.Invisible, Visible = false, Enabled = false)]
[PXBool]
public virtual bool? IsPOLinkAllowed
{
get;
set;
}
#endregion
The PXFormula indicates that the POCreate field must be true and the operation of the Sales Order be an Issue.
The simplest way to modify this behavior likely is to change the attributes on the field via a DAC extension or CacheAttached in the graph to result in true when you want it enabled.

Add an Address to the Branch

I am trying to add another address to a Branch in 21.203, similar to the how the DefAddress works. I have extended the Branch DAC and added the field to the extension. I also tried extending the BAccount DAC and table to get this to work but, nothing is working so far. The Address record is being created in the Address table but, the PXDBChildIdentity attribute doesn't seem to be sending back the ID to the Address record. On the screen, when I enter the values for the address, and click Save, all of the values are wiped out and the custom field (UsrCustomAddress) is never populated.
#region UsrCustomAddress
[PXDBInt()]
[PXUIField(DisplayName="Custom Address")]
[PXDBChildIdentity(typeof(Address.addressID))]
public virtual Int32? UsrCustomAddress { get; set; }
public abstract class usrCustomAddress : PX.Data.BQL.BqlInt.Field<usrCustomAddress> { }
#endregion
And, then, I added the View to the BranchMaint extension.
<code>
namespace PX.Objects.CS
{
public class BranchMaint_Extension : PXGraphExtension<BranchMaint>
{
public PXSelect<Address, Where<Address.bAccountID, Equal<Current<BAccount.bAccountID>>,
And<Address.addressID, Equal<Current<BAccountExt.usrCustomAddress>>>>> CustomAddress;
}
}
</code>
Not sure what I'm missing?
TIA!
I handled this by manually calling .Insert() on the specific Data View in the row inserting event and writing it to the field. PXDBChildIdentity then can update the field with the real identity value (on row persist) after the link is established.
protected void _(Events.RowInserting<Branch> e)
{
if (e.Row is null) return;
Address newAddress = CustomAddress.Insert();
BranchExt ext = e.Cache.GetExtension<BranchExt >(e.Row);
ext.UsrCustomAddress = newAddress.AddressID;
}
If anyone knows how to do this in an attribute id love to know. Note, this will only work for newly created records. Any existing records would not have a row inserting event fire and fill your custom field. You need to backfill the data with SQL or just a temporary custom action that you can invoke this code manually.

Acumatica Customize Process Shipments Add branch field from PO Receipts

I'm trying to figure out if it's possible to add fields to the grid on the Process Shipments screen for PO Receipts when the "Prepare Drop-Ship Invoice" action is selected. Specifically, I want to add the POReceipts.BranchID field.
I've studied the source code, and I see where different select commands are run based on the selected action, but I don't understand what drives the grid to show the different set of columns.
I looked in the screen designer in the customization editor, and I don't see a different view or anything, hopefully I'm just missing something simple.
Thanks
Scott
This is how I solved your mystery. First create a user field for SOShipment.
#region UsrReceiptBranchID
[PXInt]
[PXUIField(DisplayName="Receipt Branch ID")]
[GL.Branch()]
public virtual int? UsrReceiptBranchID { get; set; }
public abstract class usrReceiptBranchID : PX.Data.BQL.BqlInt.Field<usrReceiptBranchID> { }
#endregion
Next is the key part. I extended the data view delegate, and added an extra query to pull the POReceipt branch, when the Filter is Drop-Ship.
public virtual IEnumerable orders()
{
List<SOShipment> records = Base.orders().RowCast<SOShipment>().ToList();
if (Base.Filter.Current.Action.Contains("Drop"))
{
foreach (SOShipment sOShipment in records)
{
POReceipt receipt = PXSelect<POReceipt,
Where<POReceipt.receiptNbr,
Equal<Required<POReceipt.receiptNbr>>>>.Select(Base, sOShipment.ShipmentNbr);
if (receipt != null)
{
SOShipmentExt shipExt = PXCache<SOShipment>.GetExtension<SOShipmentExt>(sOShipment);
shipExt.UsrReceiptBranchID = receipt.BranchID;
}
}
return records;
}
else
{
return records;
}
}

BusinessAccountMaint field required for Customer

I am trying to make the PriceClassID required for Business Accounts when they are created. I initially did this by editing the DAC. This caused an issue where whenever an Employee was created, an error was displayed making creating an employee impossible.
Error: 'CPriceClassID' cannot be empty
I went back to the drawing board and decided to edit the attributes on the Graph which allowed me to create Employee records. However now when editing existing Vendors via the Business Accounts screen I get the same error. I can create and edit Vendors from the Vendors screen because it uses a different graph but I would still like to implement a more elegant solution
[PXDBString(10, IsUnicode = true)]
[PXSelector(typeof(AR.ARPriceClass.priceClassID))]
[PXUIField(DisplayName = "Price Class", Visibility = PXUIVisibility.Visible)]
[PXDefault()]
protected virtual void Location_CPriceClassID_CacheAttached(PXCache sender)
{
}
What is the best method to make the CPriceClassID field required on the Business Accounts screen that will still allow me to create Employees and Vendors without any errors?
You can use PXUIRequiredAttribute for achieving what you need.
Below is an example of how you can use it for making the field required only on the specific screen:
public class LocationExt : PXCacheExtension<PX.Objects.CR.Location>
{
public class BusinessAccountMaintScreen :Constant<string>
{
//"CR.30.30.00" is the page id of the Business Accounts screen
public BusinessAccountMaintScreen():base("CR.30.30.00")
{
}
}
#region UsrCustomField
[PXDBString(10, IsUnicode = true)]
[PXSelector(typeof(AR.ARPriceClass.priceClassID))]
[PXUIField(DisplayName = "Price Class", Visibility = PXUIVisibility.Visible)]
[PXDefault]
// Here we add checking for the current page so that this field will be required only on the Business Accounts screen
[PXUIRequired(typeof(Where<Current<AccessInfo.screenID>, Equal<BusinessAccountMaintScreen>>))]
public virtual String CPriceClassID {get;set;}
#endregion
}

Shipment Email in Automation Notifications

Does anyone has any idea how can I have email from Shipment Settings tab on Shipment Screen (SO302000) on Automation Notifications screen (SM205040) under Emails dropdown/lookup on Addresses tab. Please refer to the below screenshot.
I did not find any code which I customize or if there is any DB table I need to populate. Please suggest.
Here's what you need, create DAC Extension for main DAC of primary view (here Shipment) and declare an unbound user-field depending on out-of-box SOShipment.ShipContactID and decorated with PXSelector.
public class SOShipmentPXExt : PXCacheExtension<SOShipment>
{
public abstract class usrShipContactID : IBqlField { };
[PXInt()]
[PXSelector(typeof(Search<SOShipmentContact.contactID>))]
[PXUIField(DisplayName = "Ship Contact", Enabled = false, Visible = false, IsReadOnly = true)]
[PXDependsOnFields(typeof(SOShipment.shipContactID))]
public int? UsrShipContactID
{
get
{
return Base.ShipContactID;
}
}
}
And add this field on Shipment Entry Page
After publishing above change, you should be able to use this field in Automation Notifications (SM205040)

Resources