I have a record that I read from CDS which I put into a local variable. I can't seem to update that local variable. Creating just a simple record and patching that works fine, but for some reason when I get a record from CDS I can't patch it locally. I do NOT want to patch the record in CDS, I'm just trying to patch the local copy of the record. Any suggestions?
// this doesn't work, 'Program Code' is not updated
UpdateContext({Program: First(MAG_MDM_Programs) });
UpdateContext({Program: Patch(Program,{'Program Code': "Test Program Code"})});
// this works, count is updated
UpdateContext({record: { name: "Hello", count: 0 }});
UpdateContext({record:Patch(record, {count: record.count + 1})});