Getting error in the stock item browser in acumatica - acumatica

I am converting my custom package from Acumatica 20R2 to 21R1 and I am trying to solve an issue for quite some time.
I have added an Extension Table to the Inventory item to store all my custom fields. When I try to load the Stock Item browser and I am getting the following error
Error: The entry form (ID: IN202500, title: Style Master (Item)) cannot be automated. Object reference not set to an instance of an object.
I have redesigned the screen again and still facing the same issue.
I have totally removed the stock item page from the customization package and rebuild the project with my custom dll and still, I am facing the same issue.
This works perfectly in 20R2
The Extension table having 180 fields.
How to debug and fix the issue?
Update
I have tested it on 21R2. It is working fine. Looks like issue is in 21R1.
[PXTable(typeof(InventoryItem.inventoryID),
IsOptional = true)]
[System.SerializableAttribute()]
[PXCacheName("InfoInventoryItemAttributeExtNV")]
public class InfoInventoryItemAttributeExtNV : PXCacheExtension<InventoryItem>
{
#region SearchType
[PXDBString(1, IsUnicode = true, InputMask = "")]
[PXDefault("J", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Search Group")]
[PXStringList(new[] { "J", "D", "G", "N" },
new[] { "Jewelry", "Diamond", "Gemstone", "None" })]
public virtual string SearchType { get; set; }
public abstract class searchType : PX.Data.BQL.BqlString.Field<searchType> { }
#endregion
----
}

Look for Automation screen="IN202500" on your project XML. Make a copy of your customisation project and then remove the element and republish. Had the same issue once where I don't use the automation, but the section was auto-added onto the project XML

Related

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.

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
}

How do I edit a BLC extension that is part of out-of-the-box Acumatica, specifically SM_CRCaseMaint.cs?

I need to add some logic to the CreateServiceOrder action that is shown on the CRCaseMaint screen. I've discovered that the logic actually exists in the file called SM_CRCaseMaint.cs in a class that is an extension of CRCaseMaint. This file is part of base Acumatica, so it is already an extension but cannot be edited directly without risk of losing the changes when the instance is updated. When I attempt to create a graph extension:
I get an error:
Is there any way I can edit this page?
According to Brendan's answer here, as of Acumatica version 2018R1 Update 4 (18.104.0023) you can override or redefine the content of the graph extension shipped with the product.
I did a test with CreateServiceOrder action in version 2018R2 and it worked. The debugger did break into the redefined action when I invoked Create Service Order action from a case:
using PX.Data;
using PX.Objects.FS;
namespace PX.Objects.CR
{
public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
{
[PXCopyPasteHiddenView]
public PXFilter<FSCreateServiceOrderOnCaseFilter> CreateServiceOrderFilter;
public PXAction<CRCase> CreateServiceOrder;
[PXButton]
[PXUIField(DisplayName = "Create Service Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual void createServiceOrder()
{
CRCase crCaseRow = Base.Case.Current;
FSxCRCase fsxCRCaseRow = Base.Case.Cache.GetExtension<FSxCRCase>(crCaseRow);
if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
{
Base.Case.SetValueExt<FSxCRCase.sDEnabled>(crCaseRow, true);
Base.Case.SetValueExt<FSxCRCase.branchLocationID>(crCaseRow, CreateServiceOrderFilter.Current.BranchLocationID);
Base.Case.SetValueExt<FSxCRCase.srvOrdType>(crCaseRow, CreateServiceOrderFilter.Current.SrvOrdType);
Base.Case.SetValueExt<FSxCRCase.assignedEmpID>(crCaseRow, CreateServiceOrderFilter.Current.AssignedEmpID);
Base.Case.SetValueExt<FSxCRCase.problemID>(crCaseRow, CreateServiceOrderFilter.Current.ProblemID);
Base.Case.Cache.SetStatus(crCaseRow, PXEntryStatus.Updated);
Base.Save.Press();
}
}
}
}

Issue of creating new item using PXAction in Acumatica

I encounter an issue when using PXAction to create new item in Acumatica and appreciate you can give me a help.
I added the custom auto-increment attribute for the "DocumentNbr" field in my "Document" DAC following the Acumatica official document's example "Example 8.2: Creating the Custom AutoNumber Attribute" in the T200 Document as below.
Here is the snippet of code of the attribute setting for the "DocumentNbr" field:
#region DocumentNbr
protected string _DocumentNbr;
[PXDBString(15, IsUnicode = true, IsKey = true, InputMask = ">CCCCCCCC")]
[PXSelector(typeof(Search<MABUIPDocument.documentNbr>),
typeof(MABUIPDocument.documentNbr),
typeof(MABUIPDocument.documentDate),
typeof(MABUIPDocument.status),
typeof(MABUIPDocument.vendorID)
)]
[AutoNumber(typeof(MABUIPSetup.autoDocumentNbr), typeof(MABUIPSetup.lastDocumentNbr))]
[PXDefault()]
[PXUIField(DisplayName = "ID")]
public string DocumentNbr
{
get
{
return this._DocumentNbr;
}
set { this._DocumentNbr = value; }
}
public class documentNbr : IBqlField { }
#endregion
It is working fine that I can add, edit and delete documents normally as below:
I have a requirement that creates a new item when clicking button, so I created the "Test Creating new item" button including creating new item logic as below, in my understanding, it would show the created item after clicked the "Test Creating new item" button.
public PXAction<MABUIPDocument> BtnCreatingNew;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Test Creating new item", Visible = true)]
protected virtual void btnCreatingNew()
{
MABUIPDocument row = Documents.Current;
row.DocumentDesc = "Test" + DateTime.Now.ToString();
row = Documents.Update(row);
Actions.PressSave();
}
The actually circumstance is although the new row has been inserted into the database and will occur if I click the "Next" arrow but the form content of the current view is cleared after clicking the button, I tried many methods like setting "Document.Current = row" and "sender.SetValue(row, fieldName, fieldNewValue)" but the content has been keeping blank after clicking the button whatever I tried. Can you please give me a hint what possible reason caused the issue? Thank you very much!
Because your ID value is only generated while new document is saved in the database, you must accordingly update PXAdapter's Searches collection with the actual ID value saved in the database:
public PXAction<MABUIPDocument> BtnCreatingNew;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Test Creating new item", Visible = true)]
protected virtual IEnumerable btnCreatingNew(PXAdapter adapter)
{
MABUIPDocument row = Documents.Current;
row.DocumentDesc = "Test" + DateTime.Now.ToString();
row = Documents.Update(row);
Actions.PressSave();
adapter.Searches[adapter.Searches.Length - 1] = row.DocumentNbr;
return adapter.Get();
}

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