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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Need help with trigger script

smccoy
1-Newbie

Need help with trigger script

Hi,

I haven't been able to find an example, or figure out the actual data format, on my own... So I'm hoping that someone can point me in the right direction.

The task is simple... We have a multi-select IBPL field. From a trigger-script we need to populate this IBPL field with all possible values. Currently, we're executing a query to get all the values, but I don't have the right data-format to make it work.

Below is an excerpt from our script files that is not working for us. Logically, it is what needs to happen. I'm not able to get the data in the right format and/or using the proper data-types.

Any help on this is greatly appreciated.

-Sean

Code snippet:

var controlsProductIDs = query("(field[Type] =\"Controls Product\")");

var controlsProductHashSet = new java.util.HashSet;

for (var i = 0; i < controlsProductIDs.length; i++)

{

var controlsProductBean = sb.getIssueBean(controlsProductIDs[i]);

var controlsProductName = controlsProductBean.getFieldDisplayString("Controls Product Name");

if (controlsProductName == "Reference" || controlsProductName == "Integrity")

{

// do nothing - skip them for now

}

else

{

controlsProductHashSet.add(controlsProductName);

}

}

var releaseIDs = query("(field[Type] = Release)");

for (var i = 0; i < releaseIDs.length; i++)

{

var releaseBean = sb.getIssueDeltaBean(releaseIDs[i]);

var releaseName = releaseBean.getFieldDisplayString("Release Name");

if (releaseName == "Reference" || releaseName == "Integrity")

{

// do nothing - skip them for now

}

else

{

// Sean !!! - This is not working.. Need to get the actual data-format for doing this operation.

releaseBean.setFieldValue("Controls Products for Release", controlsProductHashSet);

}

}

1 ACCEPTED SOLUTION

Accepted Solutions
smccoy
1-Newbie
(To:smccoy)

Figured it out... Use "setPickFieldValue" instead of "setFieldValue"..

View solution in original post

1 REPLY 1
smccoy
1-Newbie
(To:smccoy)

Figured it out... Use "setPickFieldValue" instead of "setFieldValue"..

Top Tags