cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Set Timestamp IBA Value

dwilliams
6-Contributor

Set Timestamp IBA Value

Hello,
I am looking to set a TimestampValue IBA on a change request from a wf expression. I have figured out how to set a string and integer value but the Timestamp value is giving me grief. Can anyone provide the code needed to accomplish this?

Thanks for your time,
Dax Williams
Windchill Business Administrator
Lifetime Products

4 REPLIES 4
avillanueva
22-Sapphire I
(To:dwilliams)

The OOTB CMII Workflow has a robot called "Set Submit Date". This sets a
workflow variable, not an IBA though. I've used workflow variables since
they can still be displayed on the details pages easily without adding
attributes. What's the issue you are seeing?

submitDate=new Timestamp(System.currentTimeMillis());




dwilliams
6-Contributor
(To:dwilliams)

Hi Antonio,
Thanks for the reply. I think I got it. I was using the TimestampValueDefaultView where I should have been using TimestampDefView to get the name of the attribute.

wt.iba.value.IBAHolder ibaHolder = (wt.iba.value.IBAHolder) ((wt.change2.WTChangeRequest2)primaryBusinessObject);
ibaHolder = wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, null, null);
wt.iba.value.DefaultAttributeContainer defAttCont = (wt.iba.value.DefaultAttributeContainer) ibaHolder.getAttributeContainer();
wt.iba.definition.litedefinition.TimestampDefView attDef = (wt.iba.definition.litedefinition.TimestampDefView)wt.iba.definition.service.IBADefinitionHelper.service.getAttributeDefDefaultViewByPath("RequestedImplementationDate");
if (defAttCont.getAttributeValues(attDef).length==0)
{
wt.iba.value.litevalue.TimestampValueDefaultView newValue=new wt.iba.value.litevalue.TimestampValueDefaultView(attDef,timeStamp);
defAttCont.addAttributeValue(newValue);
}
else {
wt.iba.value.litevalue.TimestampValueDefaultView attValue= (wt.iba.value.litevalue.TimestampValueDefaultView)defAttCont.getAttributeValues(attDef)[0];
attValue.setValue(timeStamp);
defAttCont.updateAttributeValue(attValue);
}
wt.fc.PersistenceHelper.manager.save((wt.fc.Persistable) ((wt.change2.WTChangeRequest2) primaryBusinessObject));

Thanks again,
Dax
scaron1
4-Participant
(To:dwilliams)

Dan, see attachment for an example.



Regards, - Merci,


Serge Caron
Senior Application Engineer, Software PLM Services - Ingénieur d'application sénior, Services informatique PLM
BRT Solutions - Montreal
8268 Boulevard Pie IX, Montréal, Québec, CANADA, H1Z 3T6
TEL. 514.727.7113 / 1.877.399.7113 (EXT.230)
CEL. 514.913.3383
FAX. 514.727.2600
SCaron@brt-solutions.com <">mailto:SCaron@brt-solutions.com>
www.brt-solutions.com

hi,

see UpdateIBAs in ext.tools package on pdmteam.com ...

martin

Dax Williams wrote:
>
> Hello,
>
> I am looking to set a TimestampValue IBA on a change request from a
> wf expression. I have figured out how to set a string and integer
> value but the Timestamp value is giving me grief. Can anyone provide
> the code needed to accomplish this?
>
>
>
> Thanks for your time,
>
> Dax Williams
>
> Windchill Business Administrator
>
> Lifetime Products
>
>
>
>
>
> -----End Original Message-----
Top Tags