EWM 7.0.2 - Set dueDate based on Iteration endDate

We're trying to develop a metric that measures the on-timeness of the closure of certain work item types.
We're not a typical "Sprint" style company (not software), but we do try to plan work into 4-week chunks.
We look ahead and give a work item a baseline iteration (the basis for the metric) and a planned iteration (which should be in advance of the basline).
I have made a custom attribute called "Baseline Iteration" of type "Iteration"/"Interval".
I would like to be able to automatically set the work item's dueDate based on the end date of the "Baseline Iteration" with Attribute Customisation. I have a few value provider customisations set up already so I'm familiar with how they work.
I'm not sure how to get the "Baseline Iteration" as an interval type then get the end date of it. Can anyone help?
Thanks
Accepted answer

I've been searching for a simple function call that returns the underlying object but still can't find one, however you can access the attribute's underlying object via the work item proxy
- getValue returns the ID
- getLabel returns the visible label
- workItem.getProxy().object.attributes['<attribute ID>'] returns the object underneath
So something like console.log(workItem.getProxy().object.attributes['target'].endDate); will print the end date of the Planned For iteration to the console. This can then be easily converted into a date object and manipulated in a calculated value customisation
One other answer

As far as I am aware, there is only limited support for items in the JavaScript API.
See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript . I am not aware that you can find the iterations in JavaScript.
You would have to try a Java based attribute customization or a follow-up action.