This was initially posed in 2012, and is likely not the best way to do this anymore. It’s preserved here for any historical interest.
A quick blog post to note an interesting new feature I learned about in V7 of FinancialForce.com’s accounting application.
In V7 it is now possible to amend documents via the API, and depending on the settings in your org even dimensions on posted documents can be edited this way. As there’s not a new specialized API call to do this it’s very easy to overlook.
First, if you want to amend dimension fields you need to ensure “Enable Edit Dimensions (after posting)” on the “Accounting Settings (FF)” custom setting is checked otherwise you’ll get an “Object validation has failed” error trying to edit dimension fields.
From there it’s a matter of calling the Update/BulkUpdate API calls with the new values (note: API key is required, contact support to get one for free) like so:
c2g.CODAAPICommon.Reference ref = new c2g.CODAAPICommon.Reference(); ref.Name = 'SIN000XXX'; c2g.CODAAPIInvoiceTypes_7_0.Invoice inv = c2g.CODAAPISalesInvoice_7_0.getInvoice(null,ref); inv.Dimension1 = new c2g.CODAAPICommon.Reference(); inv.Dimension1.Name = 'New Dimension1'; c2g.CODAAPISalesInvoice_7_0.updateInvoice(null,inv);