Fetch a list of record revisions and display them in WebDrawer
Intro
This video goes start to finish fetching a list of record revisions and creating a list in WebDrawer. Along the way I show where in the ServiceAPI help I found all the information I needed to achieve this.
Sample Code
In this video I call the ServiceAPI with a URL like the one below to fetch a list of record revisions.
http://localhost/HPRMServiceAPI/Record/REC_15?properties=ChildRevisions
I write this Razor code:
<ul> @foreach (RecordRevision revision in this.Model.Results[0].ChildRevisions) { <li><a href="~/Record/@this.Model.Results[0].Uri/RecordRevision/@revision.Uri">@revision.Description</a></li> } </ul>
Modify a routeDefault to look like this:
<add name="Record" model="RecordFind" template="MyRecordDetails" properties="NameString,RecordIsElectronic,enabledcommandids,RecordRelatedRecs,RecordIsContainer,RecordIsInPartSeries,RecordRecordType,RecordPrimaryContact,RecordExtension,ChildRevisions" propertySets="Identification,ChildDetails"/>
Add this custom property Set:
<add name="RecordRevisionChildDetails" propertySets="All" properties="RecordRevisionDescription,NameString"/>
Notes
The custom property set I added above has redundant information. I specify the propertySet 'all' which means that I do not need to specify the individual properties at all.
Also, you might notice a record revision property in the help that has a numeric ID (in fact I comment on this). This was the result of me working with a partially re-built instance of HPRM.
And lastly, if you see some odd looking things in WebDrawer (such as the 'Create' button) just ignore them. They are a part of some other sample code I am currently part way through building.