How to bring in Business Accounts which are classified as both Customer and Vendor via Import Scenario in Acumatica?
Out-of-box Extend To Vendor
action cannot be used in Import Scenario since it redirects to vendor screen with pre-populated data and user has to manually save the vendor.
In below code snippet, we are creating a new hidden action which invokes base Extend Customer To Vendor action and persists the vendor data rather redirecting to vendor screen.
using System;
using System.Collections;
using PX.Data;
using PX.Objects.AR;
namespace PXExtendCustomerToVendorExtPkg
{
public class CustomerMaintPXExt : PXGraphExtension<CustomerMaint>
{
public PXAction<Customer> extendToVendorPXExt;
[PXUIField(DisplayName = "Extend To Vendor Ext",
MapEnableRights = PXCacheRights.Select,
MapViewRights = PXCacheRights.Select,
Visible = false)]
[PXButton]
public virtual IEnumerable ExtendToVendorPXExt(PXAdapter adapter)
{
try
{
if (Base.extendToVendor.GetEnabled())
Base.extendToVendor.Press();
}
catch (Exception ex)
{
if (ex is PXRedirectRequiredException)
{
PXRedirectRequiredException rdEx = (PXRedirectRequiredException)ex;
rdEx.Graph.Actions.PressSave();
}
else
throw ex;
}
return adapter.Get();
}
}
}
After publishing the customization, modify Import Scenario
for Customers
(SM206025) and add new Extend To Vendor Ext
action after Save Action.