Copy Oppo_OpportunityId to custom field

The 'Oppo_OpportunityId' field does not appear to be available to display on any of the grids so I decided to create my own field and just copy the Id into that. I'm having a little trouble getting this to work.


I first added a sql script to my workflow but this is only actioned after the opportunity is progressed. What I really need is for this to happen the moment the opportunity is generated. This led me to table level scripts but i'm unclear on the exact syntax required, I either get errors, nothing happens or I have multiple entries for one form submission which is strange.

Table level script currently looks like this

[code]

function InsertRecord()
{
var tempVal = Values("Oppo_OpportunityId")
oppoRecord = eWare.FindRecord("Opportunity","Oppo_OpportunityId="+tempVal)
oppoRecord.oppo_cust_oppo_id = tempVal;
oppoRecord.SaveChanges();
}

[/code]

Also tried

[code]

PostInsertRecord() {

Query=CRM.CreateQueryObj("update Opportunity set oppo_cust_oppo_id = Oppo_OpportunityId where oppo_cust_oppo_id IS NULL AND Oppo_OpportunityId IS NOT NULL");

Query.ExecSQL();

}

[/code]

But no luck so far, any advice is appreciated.