It's all about the answers!

Ask a question

Not able to make this Calculated value script to work, is there anything I'm missing?

Aparna Sukumaran (333660) | asked Oct 27 '16, 1:44 p.m.
Setting owner by state of the APAR Workitem .


(function() {
var WorkItemAttributes =;
    dojo.declare("com.example.setownerbystate", null, {

        getValue: function(attributeId, workItem, configuration) {
          var type = workItem.getValue(;
          var state = workItem.getValue(;
          if (type === "apar") {
                    if (state === "APAR.state.s16" || state === "APAR.state.s20" || state === "APAR.state.s1"){
                    return configuration.getChild("parameters").getStringDefault("Firstname lastname 1", "");
                        else if (state === "APAR.state.s3" || state === "APAR.state.s17"){
                        return configuration.getChild("parameters").getStringDefault("Firstname Last name 2", "");
                       else {
                        return workItem.getValue(WorkItemAttributes.OWNER);
    else    {
        return workItem.getValue(WorkItemAttributes.OWNER);


2 answers

permanent link
Ralph Schoon (63.2k33646) | answered Oct 27 '16, 2:04 p.m.
My assumption is, you return 

 return configuration.getChild("parameters").getStringDefault("Firstname lastname 1", "");
e.g. a string like "John Doe".

That never works. And it is not supposed to. See for how limited the API is and especially read the section about supported attribute types.

See Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management   lab 5 for information what the API provides - and what not - and an attribute spy script you can use to print what values are in attrinbutes and display that - or use logging. You can only set contributor type (or other IItem type attributes) by returning the items UUID.

permanent link
Donald Nong (14.5k414) | answered Oct 30 '16, 9:21 p.m.
Have you made the extra configuration which is required in the Process Configuration Source? If you base your code on the Script Based Validation example, you need to understand how it works. Also, as Ralph said, for an attribute of Contributor type, you need to return a UUID, not "firstname lastname".

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.