I'm trying to update the id (not pk) of a record onAfterCreate
in auto save mode. The createContractNum_SOW()
is a server script that returns a number. I have also tried using
app.datasources.MyDatasource.item.MyField = 'My new value';
but that does not work either.
Is there something that I am missing?
if (contract_type === "Statement of Work"){
var next_id = createContractNum_SOW();
record.contract_num = next_id;
}
You probably need to save the record after you modify it.
Since the datasource events are server side you can do that with app.saveRecords([record]);