Hi,
I am working on a customization and I am looking to automatically save the default values in a setup form when the customization is installed. We would like to have the record inserted into the database without users needing to go to the setup form.
I am using a constructor in the setup graph to insert a record but I am getting an error: “The cache PageSetup has not been found in the list of auto-initialized caches.”
Is there a better approach for this? I have included my code below. Thank you!
public SelectFrom<PageSetup>.View Setup;
public PageSetupMaint() // Constructor
{
// Check if a record exists in the database
PXResultset<PageSetup> recs = PXSelect<PageSetup,
Where<PageSetup.dnloadStockItem, Equal<Required<PageSetup.dnloadStockItem>>>>.Select(this);
if (recs.Count < 1)
{
Setup.Insert(new PageSetup());
Save.Press();
}
}