Hi @BernardoBermudez27
When you want to insert a record into a table, you typically need to use the graph that is associated with the DAC of that table. The Insert() and Persist() methods are defined in the graph, not the cache. You also need to ensure that you have properly defined your DAC, including all DB-bound fields and their appropriate attributes, and that the DAC matches the structure of your database table.
Here is an example of how to insert a record:
PXGraph graph = new PXGraph(); // or any other graph that you have, like SOOrderEntry graph for SOOrder DAC
DACName dac = new DACName
{
Column1 = value1,
Column2 = value2,
Column3 = value3
};
graph.Caches[typeof(DACName)].Insert(dac);
graph.Actions.PressSave();
You should make sure to save the changes after inserting a record with the PressSave() method. Persist() method saves all the changes that have been made to the data in the caches (Insert, Update, and Delete operations) since the last persisting of the data.
Also, please ensure that there is not any exception occurring during the operation.
Remember to do proper error handling and check for any errors in the row or cache after the insert operation. For instance, you can use the PXUIFieldAttribute.GetError<FieldType>(cache, data) method to check if any error was set for the specified field.
If the issue persists, please provide more context or relevant parts of your code and we might be able to give a more specific answer.