It's all about the answers!

Ask a question

How do I assign the value of a custom Contributor attribute in RTC to a variable in RPE?

Marshall Smith (154) | asked Dec 01 '17, 5:45 p.m.

 I have only been able to find contributor data in two places:

  • /workitem/contributor/
  • /foundation/contributor/contributor/
I have not been successful accessing the data in either repository from within RPE.  
In both cases I get an error when running the report that the engine “Cannot access to the OAthentication URL”

I am currently drilling down through two paths in the repository to get the itemId for whenever I can get at the contributor data.
  • /workitem/workItem/allExtensions 
    • Filter on key ( key == <attribute_id>)
    • Assign <helpId> ( helpId = /workitem/workItem/allExtensions/helperId )
  • /workitem/workItem/itemExtensions
  • /workitem/workItem/itemExtensions/value
    • Filter on <helpId> (<itemExtensions/helperId> == helpId)
    • Assign <myItemId> ( myItemId = /workitem/workItem/itemExtensions/value/itemId )
    • Note: there is also a ‘reportableUrl’ field here, but when I try the link directly in the browser I get an invalid object error.
    • There is not a smallString or DisplayValue here that contains the contributor data
From here, I want to use myItemId to filter the correct value out of either repository, but I can’t figure out the query to get at it.  I’m   concerned it might not be in the original query at all because ‘contributor’ is at the same level in the hierarchy as ‘workItem.’  My best guess so far has been:

  • /workitem/contributor
    • Filter on <myItemId> ( /workitem/contributor/itemId == myItemId )
    • Assign <myName> ( myName = /workitem/contributor/name )

But I haven’t been able to add a query for ‘/workitem/contributor’ anywhere in the report that doesn’t break the report.

I have also tried getting the value from the REST API, but I must be missing something, because all I end up with is the string value of the URL.

Accepted answer

permanent link
Subramanya Prasad Pilar (4.5k14) | answered Dec 02 '17, 8:09 a.m.

You can either use the query workitem/workItem/itemExtensions or workitem/workItem/allExtensions. If you are using the query workitem/workItem/itemExtensions, workitem/workItem/itemExtensions/value/itemId will give the itemId for the contributor, that can be used in the (native) filter for the 2nd request. For the Data Source Configuration, you can set URI property that evaluates to https://server:port/ccm/rpt/repository/foundation
Another option s to use Special Attribute in RPE that can fetch the value based on the matching key.

Note: You may need to update the schema (use Replace Schema option in RPE) if you do not find "itemValue" node under allExtensions. In this example, I am retrieving "Tester" value for the work item.

Marshall Smith selected this answer as the correct answer

Subramanya Prasad Pilar commented Dec 04 '17, 12:28 p.m.

Please note that workitem/workItem/itemExtensions/value/reportableUrl is like https://<server>:<port>/ccm/rpt/repository/workitem/contributor/itemId/<ItemId>;. We need to replace "/workitem" with "/foundation". If you are using filter in RPE template, only https://server:port/ccm/rpt/repository/foundationcan be set as the URI for the foundation data source.

Marshall Smith commented Feb 15 '18, 11:02 a.m.

 Thank you for your reply!  This answer got me to successfully generating the report.  

The only issue I have now is that, even though I configure the foundation data source in the report, and the data source is marked "hidden,"  It is still requiring a URL at runtime.  I have worked around this for now by configuring the foundation URI in the metadata configuration for the data source, so that users don't have to enter it.  I would still rather not have the foundation data source configuration visible to users, is there any trick besides marking it as "hidden" and having it dynamically configured that needs to be done so that it doesn't ask to be configured at run time?

Subramanya Prasad Pilar commented Feb 15 '18, 11:28 a.m.

You can of course hide the foundation data source. Are you generating document through RPE Launcher or RTC? Since the data source name "RTC Foundation" starts with "", it should be hidden from RTC report wizard. In RPE, you need to set "Configuration required" property to "hidden" so that it will be hidden.
You can also use
_sessionInfo.getDatasourceProperty("RTC Workitems","URI", " ") to get the URI of "RTC Workitems" data source and modify it using Script Expression and set it to "_RTC Foundation".

Your answer

Register or to post your answer.