I’ve been working on customizing the AgileEVM app using sdk 1.32 and I’ve been using preferences to store various values that users will set (multiple billable rates, non-full time resources, etc..). Here is how I’m creating the preferences:
_rallyDataSource.create("preference",
{
Name: 'BillableRate',
Project: '/project/__PROJECT_OID__',
Value: 0
}, function(results) { isTeamLevel = results; } );
The workspace is structured where the parent project has multiple tracks and those tracks have multiple teams. I want the app to calculate the appropriate EVM data on every level of the project hierarchy. I’m running into an issue where I can’t retrieve the preferences of the current project as well as all of its child projects. PROJECT_SCOPING_DOWN is set to true. It seems like preferences are handled differently than stories/tasks/etc..
Here is how I’m getting the preference(s):
var queryConf = {type: 'Preference',
key :'billableRate',
query:'(Project = "/project/__PROJECT_OID__")',
fetch:true};
_rallyDataSource.findAll(queryConf, preferencesRetrievedCallback);
If I include the project oid in the query, I only get preferences associated with that project, none of the child projects. If I remove the project oid from the query, it returns every preference, regardless of hierarchy.
I also tried to accomplish this using CreateAppPreference and GetAppPreferences, but it appeared to exhibit the same behavior.
My question is, am I doing something wrong here? If not, and this is the intended functionality, then how do I best store these variables so that they roll up properly at every level of the project structure?
Thanks in advance for your help.
The Preference WSAPI endpoint is a bit unique in that it doesn’t use any workspace or project scoping information passed in the url except for explicit queries like you have above:
You could use the PROJECT_OIDS_IN_SCOPE hangman variable and construct a large OR’d query, although if you have a lot of projects in scope the request may fail because it gets too large…
Otherwise you could just make a new preference request for each project in scope much like you are doing for the current project.
Another option would be to save the pref as a workspace pref instead and have the value be a json object with keys being project oids and values being the value…