Shipment Email in Automation Notifications - acumatica

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)

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.

Adding Custom Entity Type in CRM Activity for selecting in Relative Entity

I have implemented CRM activity on the Custom page where the Key Field is SOOrder Type, SOOrder Nbr & Job Code which are stored in custom DAC. I have tried to add the Entity Type listed on Related Entity and I am not able to figure out how to do it. Pls let me know where to add or override the method to Implement the functionality
The following cod used to implement the CRM Activity
public sealed class SOOrderJobActivities : CRActivityList<PSSOOrderJob>
{
public SOOrderJobActivities(PXGraph graph)
: base(graph) { }
protected override RecipientList GetRecipientsFromContext(NotificationUtility utility, string type, object row, NotificationSource source)
{
var recipients = new RecipientList();
var order = _Graph.Caches[typeof(PSSOOrderJob)].Current as PSSOOrderJob;
if (order == null || source == null)
return null;
SOOrder ord = SOOrder.PK.Find(_Graph, order.OrderType, order.OrderNbr);
var contact = SOOrder.FK.Contact.FindParent(_Graph, ord);
if (contact == null || contact.EMail == null)
return null;
recipients.Add(new NotificationRecipient()
{
Active = true,
AddTo = RecipientAddToAttribute.To,
Email = contact.EMail
});
source.RecipientsBehavior = RecipientsBehaviorAttribute.Override;
return recipients;
}
}
Update
After going through the Acumatica code, I have done the following changes
#region Noteid
[PXNote(ShowInReferenceSelector =true,Selector =typeof(Search2<PSSOOrderJob.jobCode,
InnerJoin<SOOrder,On<PSSOOrderJob.orderType,Equal<SOOrder.orderType>,And<PSSOOrderJob.orderNbr, Equal<SOOrder.orderNbr>>>>,
Where<SOOrder.orderType,Equal<Current<PSSOOrderJob.orderType>>,And<SOOrder.orderNbr, Equal<Current<PSSOOrderJob.orderNbr>>>>>))]
public virtual Guid? Noteid { get; set; }
public abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
#endregion
The entity comes into selection, But I am not able to select the relative entity document and the value is not getting updated in the related entity field.
The above screenshot the select is missing and not able to select the document
The following steps I have done to add relative Entity for any Activity using custom DAC
1. Added ShowInReferenceSelector = true in PXNoteID field.
2. Added Selector in PXNoteID field
3. Decorated [PX.Data.EP.PXFieldDescription] attribute for Key fields
#region NoteID
[PXNote(ShowInReferenceSelector = true, Selector = typeof(Search2<PSSOOrderJob.jobCode,
InnerJoin<SOOrder, On<PSSOOrderJob.orderType, Equal<SOOrder.orderType>, And<PSSOOrderJob.orderNbr, Equal<SOOrder.orderNbr>>>>,
Where<SOOrder.orderType, Equal<Current<PSSOOrderJob.orderType>>, And<SOOrder.orderNbr, Equal<Current<PSSOOrderJob.orderNbr>>,And<PSSOOrderJob.jobType,Equal<Current<PSSOOrderJob.jobType>>>>>>), DescriptionField = typeof(PSSOOrderJob.jobCode))]
//[PXNote(ShowInReferenceSelector = true)]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
#endregion
#region JobCode
[PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
[PXUIField(DisplayName = "Job Code")]
[PXDefault()]
[PXSelector(typeof(Search<PSSOOrderJob.jobCode, Where<PSSOOrderJob.orderType, Equal<Current<PSSOOrderJob.orderType>>, And<PSSOOrderJob.orderNbr, Equal<Current<PSSOOrderJob.orderNbr>>,And<PSSOOrderJob.jobType, Equal<Current<PSSOOrderJob.jobType>>>>>>), typeof(PSSOOrderJob.jobCode), ValidateValue = false)]
[PSSOOrderJobNbr.Numbering()]
[PX.Data.EP.PXFieldDescription]
public virtual string JobCode { get; set; }
public abstract class jobCode : PX.Data.BQL.BqlString.Field<jobCode> { }
#endregion
This automatically fills the related entity field with Jobcode.
There still one issue I am facing is not able to access the selector due to Entity field width is more than the popup window and I do not know how to fix it.
This answer is to address the popup size only.
First, give browser zoom a try 'control' + 'minus' key. It might work as a quick workaround.
Otherwise, use the browser debugger feature. Open it with F12 key. Then use the browser debugger inspect element feature (1). Click on the smart panel (2). Go up a bit in html control hierarchy until you reach and select the smart panel root which is a table element (3). Change the width of the smart panel popup using the debugger CSS properties editor (4).
If selector control size increases automatically with window size; change the selector control width instead of popup width using browser debugger CSS property editor.

Add Column in "Add Stock Item" dialog box in Sales Order screen of Acumatica

How can I add the "ItemType" column from "Stock Items" screen to "Add Stock Item" dialog box of Sales Order screen.
Stock Item Image
Sales Order Dialog Image
Is there any direct method using the Acumatica Customization Editor we can do this work or I need to use programming or coding to accomplish the task
Thanks.
You should be creating cache extension for the BQL table SOSiteStatusSelected and add a new field UsrItemType like following:
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public sealed class SOSiteStatusSelectedExt : PXCacheExtension<SOSiteStatusSelected>
{
[PXDBString(1, IsFixed = true, BqlField = typeof(InventoryItem.itemType))]
[PXUIField(DisplayName = "Item Type", Visibility = PXUIVisibility.SelectorVisible)]
[INItemTypes.ListAttribute]
public string UsrItemType { get; set; }
public abstract class usrItemType : BqlType<IBqlString, string>.Field<usrItemType> { }
}
}
After this add the UsrItemType field on the Inventory Lookup screen in the Sales Orders form from the Customization Project Editor menu.

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
}

Modify items in Opportunity page - Status field

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

Resources