Same custom field on both Location screen and Customer screen - acumatica

I'm trying to add the same custom field in Acumatica 2017 R2 to both the Location screen (AR303020) and the Customers (AR303000) screen. There are other native fields found on the "Customers > Delivery Settings" tab that exhibit the behavior I'm trying to match. (Example: Tax Registration ID, Tax Zone, etc.) These fields can be viewed/edited from either the Customers screen or the Locations screen.
Using the Customization Project browser I'm able to add the field to the Location screen easily enough.
Next, I would like to add a new custom field into the "Customers > Delivery Settings tab > Default Location Settings group" that uses the same DAC as the custom field that was added to the Locations screen.
But I'm not sure how to properly define the same field for the Customers screen. By default, the Customization Browser adds a custom field to the CR.Address DAC. I've tried creating a new CR.Address field with this definition:
There are no errors during publishing, but Acumatica will not load the Customer or Locations screens. The error is "Invalid column name 'UsrCertificateDate". I intentionally did not add a column for UsrCertificateDate to the CRAddress database table because the column was previously added to the Location table. I'd prefer not to maintain two database fields if only one is needed.
How can I make a custom field on these two screens work together? Editing the Default Location from the Customers screen should change the value when viewing the Location from the Locations screen and vice-versa.

First of all, you should consider declarations of DAC Location and Address:
Location:
[Serializable]
public class Location : IBqlTable, IPaymentTypeDetailMaster, ILocation
{
.
.
Address:
[Serializable]
public class Address : IBqlTable, IAddressBase, IValidatedAddress, IPXSelectable
{
.
.
.
as you can see from declarations, both of them implement IBqlTable, so it means that Location and Address live as separated entities in Acumatica.
Following sql in your db will show to you that both tables have their own life:
select top 10 * from Location
select top 10 * from Address
you will see different outputs. It also means that you can't use one DAC extension for the same table, but you'll need to extensions. And also you'll need to add two columns for Location and Address table.
One more point for you to be careful, there is a difference between DAC which is CR.Address and CRAddress.
Take a look at CRAddress declaration:
[Serializable]
public class CRAddress : IBqlTable, IAddress, IAddressBase, IValidatedAddress
{
.
.
.
as you can see from declaration, entity CRAddress is third table.
If to assume all of this you'll either to add the same column twice to Location and Address DAC extensions, or as another option you can create table CertificationDates which will have Certifications dates as one of the columns, and in both extensions to have ID for CertificationDates as foreign key.

Related

Acumatica: How to Update the FS Manufacturer and Model on Stock Items

I'm trying to update the Manufacturer and Manufacturer Model on the "Service Management" tab of the Stock Item (IN202500).
I'm about 99% sure that they must be in a Graph Extension, but the Schema Browser only indicates that they are in a DLL, not the name of the extension. More generically, if a field is in an Extension, is there a way to find out which one? Or enumerate the extensions that exist in a Graph Cache?
InventoryItem row = Base.ItemSettings.Current;
// This doesn't work. InventoryItemFSxEquipmentModel isn't the name of the extension and IDK how I figure out what it is.
InventoryItemFSxEquipmentModel rowExt2 = PXCache<InventoryItem>.GetExtension<InventoryItemFSxEquipmentModel>(row);
// This also doesn't work, as it isn't in the base model.
throw new PXException(row.ManufacturerID.ToString());
To find out which graph extension a field is in, you can use the "Customization Project Editor" in Acumatica.
Open the "Customization Project Editor" (SM204505) screen in Acumatica.
In the "Object Name" field, type "InventoryItem" and click "Search".
Click the "+" icon next to "InventoryItem" to expand the list of customization items for the InventoryItem DAC.
Look for the field you're interested in (in this case, Manufacturer and Manufacturer Model), and you should see the name of the graph extension that contains that field listed next to it.
Once you know the name of the graph extension, you can use that to get the extension instance for the current record, like this:
InventoryItem row = Base.ItemSettings.Current;
InventoryItemExt rowExt = row.GetExtension();
Replace "InventoryItemExt" with the name of the actual graph extension that contains the fields you're interested in.
Then you can access the Manufacturer and Manufacturer Model fields like this:
string manufacturer = rowExt.UsrManufacturer;
string model = rowExt.UsrManufacturerModel;
Replace "UsrManufacturer" and "UsrManufacturerModel" with the names of the actual fields in the graph extension that you're working with.

Shopware 6: Product Slider data is null when use manual assignment

I have a issue with the product slider.
First issue: In administration, i added a product slider that using dynamic product group and a product slider that using use manual assignment.
I created a my resolver class that inherit from ProductSliderCmsElementResolver for loading data on storefront.
But on Storefront only display data from dynamic product group , data from manual assignment is null.
Second issue: On Storefront can’t display product’s cover (I still using Product Slider). Do I need to do anything at resolver class ?
Thank everyone.
It was fixed by the OP by extending their resolver from ProductSliderCmsElementResolver. By this the existing logic / template is used and the data is displayed.

Acumata Web Service Endpoint add Vendor Locations

I'm trying to use a Contract API application to edit and maintain vendor Locations.
I'm slightly confused on how I add a detail to the web service endpoint. I can easily add fields, but it seems when I try to add a new element it's not actually loading anything.
Here is what I did:
Added Object with name "Locations" and type "Detail"
Under that, added a top level call "Location" with screen id "Customer Locations"
Added fields to that
I used this VB code:
VendorFind = soapClient.Get(New Vendor With {.ReturnBehavior = ReturnBehavior.All,
.VendorID = New StringSearch With {.Value = "V01026"},
.Locations = New Locations() {New Locations With {.ReturnBehavior = ReturnBehavior.All}}})
It compiles and works but doesn't load the locations.
Anyone have any thoughts on how I achieve this?
For your custom endpoint you might want to use the 'Populate' option on the web service endpoint screen and select the required fields . Use the Vendor Location summary to get header information like vendor, location name etc and then select the details by selecting the correct mapped object for instance "General Info--> Location Contact " . This works fine and populates location details correctly for a selected vendor using postman tool . I am not much familiar with Vb but I suppose the issue might be in the way the endpoint entities are extended.

How to increase the length of out-of-the-box fields?

Currently, we are using the full 30 characters of the InventoryItem.InventoryCD field, but we need more. How can we increase this field length to 45 characters ?
This can easily be done by creating a customization project containing a database script. This guide will be specific to InventoryItem.InventoryCD, but the idea can be applied to any fields. See the Notes sections at the end for more info.
For InventoryCD, here are the 3 steps you need to follow.
1. Database script in a customization project
Navigate to the Customization Projects screen (SM204505) and create a new customization project. Go to the DB Scripts section, click on Add and choose Script.
Copy the script matching with your database and click OK :
SQLServer
DROP INDEX [Inventory_InventoryCD] ON [InventoryItem]
ALTER TABLE InventoryItem ALTER COLUMN InventoryCD nvarchar(45) NOT NULL
CREATE UNIQUE NONCLUSTERED INDEX [Inventory_InventoryCD] ON [dbo].[InventoryItem]
(
[CompanyID] ASC,
[InventoryCD] ASC
)
MySQL
ALTER TABLE InventoryItem
DROP INDEX Inventory_InventoryCD;
ALTER TABLE InventoryItem CHANGE InventoryCD InventoryCD NVARCHAR(45) NOT NULL;
CREATE UNIQUE INDEX Inventory_InventoryCD
ON InventoryItem (CompanyID, InventoryCD);
These scripts only alter the columns we need but to do so, we drop the existing index and recreate it at the end. You can run these commands manually to test them before adding them to your customization.
2. Publish project and restart application
We have all we need in this customization project. Publish it by going to the Publish menu and click on Publish with Cleanup. When it successfully publishes, navigate to System > Management > Process > Apply Updates screen (SM203510). We are going to Restart Application which will restart the whole website. Make sure to notify all your users to save their work before doing it! When you are ready, click on Restart Application.
This step will ensure that the framework discards the previous database schema and loads the up-to-date schema in memory.
3. Change segment length
The last step will be to modify the INVENTORY segment to allow longer length on our InventoryCD. Navigate to Configuration > Common Settings > Segmented Keys > Segmented Keys screen (CS202000) and select INVENTORY as the Segmented Key ID. Apply the new length to the segment in the grid and Save. You are now ready to test !
Notes
If you want to modify any out-of-the-box fields in Acumatica, step 3 will have to be adapted to the field.
3a. Alternate DAC modifications
In this steps
, you would need to make sure that the DAC field type attribute matches the new columns length. As an example, a DAC string field could have been changed from
[PXDBString(30, IsUnicode = true)]
to
[PXDBString(45, IsUnicode = true)]
You can find more info on DAC fields attributes modifications at this link :
https://help.acumatica.com/(W(11))/Wiki/ShowWiki.aspx?pageid=1911428f-d4ca-4207-9396-a744db21cdfb
Be aware that increasing field length may corrupt data during upgrade as database schema that is used for upgrade procedure is defined inside %AcumaticaPath%/Database/database_schema.xml
For smooth upgrade don't forget to modify database_schema.xml:
<col name="InventoryCD" type="NVarChar(30)" />
to
<col name="InventoryCD" type="NVarChar(45)" />
Otherwise you may receive "string will be truncated" errors followed by data corruption.

Extend Cases to include an additional tab with a list (AEF)

I have been extending Acumatica screens by adding new fields accordingly. However, for this particular scenario, I want to create a new tab in the Cases screen.
This tab would include a list of items. These list of items would be a custom table that I will be adding to Acumatica.
Is this possible?
And is this the correct list of Steps?
1. Create table in Acumatica for the list of items
2. Create DAC for the new table
3. Extend the Cases Graph and add a new Data View (i.e. PXSelect)
4. Edit the Cases screen so that a table and grid are added accordingly
5. Link the grid to the Data View through the Data Member property
I am not sure whether you would also need to implement some additional events, but I believe that if the DAC has the correct link to the Case and the correct attributes ... it should work.
Would be much appreciated if someone helps to confirm the above approach please.
Adding a tab page containing a grid bound to a DataView on a custom DAC in the case entry screen is a supported scenario.
There are a few ways to do it. Whether you are working on a Customization Project or an Extension Library will influence how you approach this requirement.
Your steps seems all right. Here's how I would do it in a Customization Project:
Create a new table in the database using a DB management utility (ex: SQL Server Management Studio). Restart WebSite instance or IIS to make sure Acumatica picks up DB schema change.
In DB script section of the customization project, add the new table and check import table schema from database. This will ensure publishing the customization project will create the table in the database.
Create a new DAC for the new table, DAC name should be the table name.
Extend the case entry graph (CRCaseMaint) and add a new DataView on your DAC.
Edit the case entry screen (CR306000), add a TabPage and a grid.
Bound the new grid to your DataView using the DataMember property

Resources