It's all about the answers!

Ask a question

Using Default Script Base in a Value Set Provider attribute


Gustavo Monti Rocha (251316) | asked Jan 27 '15, 8:51 a.m.
When a workitem is loaded, we have an attribute called "UG" that is loaded (on click event) with Value Set Provider Script (values is provided from webservice). 

How can I set a Default Value to this attribute?

One answer



permanent link
Ralph Schoon (63.6k33646) | answered Jan 27 '15, 9:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can specify a default literal for an enumeration in general.
You can also define a default value provider for an enumeration or enumeration list similar to the value set provider. See https://jazz.net/library/article/1093 Lab 4.

Comments
Gustavo Monti Rocha commented Jan 27 '15, 9:23 a.m.

Ralph,


But How to do that based on fact that attribute isn't loaded yet with value script provider?

If this was loaded on creation, maybe I could get the values... 


Ralph Schoon commented Jan 27 '15, 9:35 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Read lab 4 above. The default value kicks in when the work item is CREATED.


Gustavo Monti Rocha commented Jan 27 '15, 11:02 a.m.

I read lab 4 in this article ( https://jazz.net/library/content/articles/clm/2012/process-enactment-workshop/workbook/pew-rtc-lab-workbook.pdf ) but I didn't find the awnser.


I saw that we can choose the default value (default script base) if my attribute is a enumeration but my attribute loaded with Value Set Provider Script (values is provided from webservice). 


Ralph Schoon commented Jan 27 '15, 11:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
  • In attribute customization, create default value provider for enumeration list.
  • Select your enumeration and the default you want
  • In the work item attributes, select the default value provider now available for your attribute
  • done

Ralph Schoon commented Jan 27 '15, 11:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you load from a web service it is likely script based - and not enumeration based.


Gustavo Monti Rocha commented Jan 27 '15, 11:59 a.m. | edited Jan 27 '15, 12:00 p.m.

I load from a web service. 


How can I load the values (from webservice) using getDefaultValue function

In getFilteredValueSet function we use the context to retrieve data like this:
        var connector= context.getDataConnector("HttpConnector");

The problem is the in getDefaultValue we don't have the context variable:
    getDefaultValue: function(attributeId, workItem, configuration) {}

I don't know if is the best to do this. 


Ralph Schoon commented Jan 28 '15, 3:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can try a script based default value using the HTTP filtered value set in the script like explained here: https://jorgediazblog.wordpress.com/2012/06/27/work-item-customization-httpconector-and-oauth-in-rtc-4-0-for-oslc/

But I am not sure if that would work.

showing 5 of 7 show 2 more comments

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.