[Anthill-pro] Script Notifications - Get Project Property Value
Frederic Jean
frederic.jean at ubisoft.com
Wed Oct 7 11:29:57 CDT 2009
Hi Peter,
Generally anthill cache object you fetch so often for other buildlife or request to fetch the value you just changed in an evaluate script , you need to commit your change.
BuildLifeLookup.getCurrent().setPropertyValue("propertyname", "value", false);
BuildLifeLookup.getCurrent().getUnitOfWork().commit();
Much like if you have an evaluate script that need to fetch properties from another request or buildlife as they might change during their life, you need to tell anthill to reload your object :
import com.urbancode.anthill3.persistence.*;
BuildRequest currentRequest = UnitOfWork.getCurrent().lockAndReload(BuildRequestLookup.getCurrent());
This fucntionnality are available on buildlife,request,etc.
Hope it helps J
Frederic Jean
De : anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] De la part de Peter Steele
Envoyé : 7 octobre 2009 11:53
À : AnthillPro user and support list.
Objet : RE: [Anthill-pro] Script Notifications - Get Project Property Value
What about creating/setting a new BuildLife property? I've tried
BuildLifeLookup.getCurrent().setPropertyValue("propertyname", "value", false);
but this doesn't work. Complains there is not such method but I can't find which method to use, or if there even is a method for this purpose.
From: anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of Frederic Jean
Sent: Wednesday, October 07, 2009 7:30 AM
To: AnthillPro user and support list.
Subject: RE: [Anthill-pro] Script Notifications - Get Project Property Value
What are you trying to fetch....
A project property ?
A request property ?
A buildlife property ?
Cause in the example below , if its indeed a project property, the code won't work as it only look in the request properties...
This alone should work :
import com.urbancode.anthill3.runtime.scripting.helpers.*;
projectProperty = PropertyLookup.getValue("projectpropertyname");
context.put("projectProperty ", projectProperty);
PropertyLookup will try to resolve your property in a cascading manner :
Current request properties
Buildlife properties
Project properties
Server Properties
Until it found the property your looking for or return nothing if it don't.
Hope it helps
Frederic Jean
De : anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] De la part de daniel.tranter at thomsonreuters.com
Envoyé : 7 octobre 2009 10:16
À : anthill-pro at lists.urbancode.com
Objet : RE: [Anthill-pro] Script Notifications - Get Project Property Value
Has anyone gotten this to work successfully, using either of the two methods explained in this thread? I've tried it both ways and am unable to pull the property value. I'm trying to pull a workflow (not project) property and insert it into the subject and/or body of an email-type template, has anyone been able to successfully do that?
From: anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of Barringer, DavidC
Sent: Monday, August 10, 2009 8:12 AM
To: AnthillPro user and support list.
Subject: RE: [Anthill-pro] Script Notifications - Get Project Property Value
I was actually able to get the info I needed this way:
import com.urbancode.anthill3.runtime.scripting.helpers.PropertyLookup;
import com.urbancode.anthill3.domain.property.PropertyValue;
import com.urbancode.anthill3.domain.buildrequest.BuildRequest;
.
.
.
BuildRequest request = workflow.getRequest();
PropertyValue propval = request.getPropertyValue("value of interest");
String propval_ofinterest = propval.getValue();
context.put("propval_ofinterest", propval_ofinterest);
I will also try your suggestion, less lines of code.
From: anthill-pro-bounces at lists.urbancode.com [mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of Jeffrey Fredrick
Sent: Friday, August 07, 2009 8:06 PM
To: AnthillPro user and support list.
Subject: Re: [Anthill-pro] Script Notifications - Get Project Property Value
Hi David,
This isn't something I've done but have you tried something like:
value = BuildLifeLookup.getCurrent().getOriginatingWorkflow().getRequest().getProperty(propertyname);
I found that in this example in the script repository:
https://bugs.urbancode.com/browse/AHPSCRIPTS-2
Jtf
Jeffrey Fredrick
Technical Evangelist
Urbancode, Inc
http://www.anthillpro.com/blogs/
On Aug 5, 2009, at 8:00 AM, Barringer, DavidC wrote:
I want to modify the notification template to include property values from the project related to the build/workflow executed but have not been successful in my attempts. Can some provide example scripting?
Thanks
David C. Barringer
Assistant Vice President, B2B Quality and Build
Fifth Third Bank
38 Fountain Square, MD 1090U2, Cincinnati, OH 45263
Work: 513.534.8874
Cell: 513.478.9436
ePage: 5139192783 at gocbw.com <mailto:5139192783 at gocbw.com>
mailto: DavidC.Barringer2 at 53.com <mailto:DavidC.Barringer2 at 53.com>
This e-mail transmission contains information that is confidential and may be privileged.
It is intended only for the addressee(s) named above. If you receive this e-mail in error,
please do not read, copy or disseminate it in any manner. If you are not the intended
recipient, any disclosure, copying, distribution or use of the contents of this information
is prohibited. Please reply to the message immediately by informing the sender that the
message was misdirected. After replying, please erase it from your computer system. Your
assistance in correcting this error is appreciated.
_______________________________________________
Anthill-pro mailing list
Anthill-pro at lists.urbancode.com
http://lists.urbancode.com/mailman/listinfo/anthill-pro
This e-mail transmission contains information that is confidential and may be privileged.
It is intended only for the addressee(s) named above. If you receive this e-mail in error,
please do not read, copy or disseminate it in any manner. If you are not the intended
recipient, any disclosure, copying, distribution or use of the contents of this information
is prohibited. Please reply to the message immediately by informing the sender that the
message was misdirected. After replying, please erase it from your computer system. Your
assistance in correcting this error is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.urbancode.com/pipermail/anthill-pro/attachments/20091007/06946d9f/attachment-0001.htm
More information about the Anthill-pro
mailing list