It is absolutely possible, we do it all day long. Read this article:
Hi @di93 There isn't a built-in way in Acumatica to dynamically add or remove items from a Template ID after it's been created. However, you can achieve this using a custom process or customization. For example
in the Stock Items screen (IN202500), create a new template item that includes all the attributes (sizes and colors) needed. Let's assume you create a template item with Template ID 'T1'. Add a new action to the InventoryItemMaint graph extension. This action will update the template ID of an existing item and create new stock items based on the new template.
public class InventoryItemMaint_Extension : PXGraphExtension<InventoryItemMaint>
{
public PXAction<InventoryItem> UpdateTemplate;
PXButton]
PXUIField(DisplayName = "Update Template", Enabled = true, MapEnableRights = PXCacheRights.Update)]
protected virtual void updateTemplate()
{
InventoryItem item = Base.Item.Current;
if (item == null)
return;
// Update the template ID of the existing item
item.TemplateItemID = "T1"; // New template ID
Base.Item.Update(item);
// Create new stock items based on the new template
foreach (var size in neww] { "S", "M", "L" })
{
foreach (var color in neww] { "Red", "Blue", "Green" })
{
InventoryItem newItem = new InventoryItem();
newItem.InventoryCD = $"{item.InventoryCD}_{size}_{color}";
newItem.Descr = $"{item.Descr} - {size} - {color}";
newItem.TemplateItemID = "T1";
newItem = Base.Item.Insert(newItem);
// Add attribute values
PXCache attributesCache = Base.Cachesstypeof(CSAnswers)];
CSAnswers sizeAttribute = new CSAnswers();
sizeAttribute.AttributeID = "SIZE";
sizeAttribute.Value = size;
attributesCache.Insert(sizeAttribute);
CSAnswers colorAttribute = new CSAnswers();
colorAttribute.AttributeID = "COLOR";
colorAttribute.Value = color;
attributesCache.Insert(colorAttribute);
}
}
// Save changes
Base.Actions.PressSave();
}
}
Note that this example does not handle data migration or inventory adjustments. You may need to adjust transactions, like sales orders and purchase orders, that were previously linked to the old stock item. You can do this using the Data Import functionality or by running a SQL script to update the references in the database.
I’m curious about this too. Doesn’t seem possible.