Adding reviewer with API
Here is the code that I'm using. I have a form with a select where someone can choose the reviewers they want. The names are populated in a div below the select. I use the API to retrieve the BaseId of each user selected. When I did this for adding an activity implementer in a MA, all I seemed to need was the BaseId, but I can't seem to figure out what is required for a reviewer. Does someone know what the format should look like?
var reviewer = [];
Thanks for your help.
Best Answers
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭If you're just trying to push into pageForm.viewModel.Activity[x].Reviewer, this should work:
$.each(data,function(i) { reviewer.push({ "Comments": null, "Decision": { "Id": "dae75d12-89ac-a8d8-4fe3-516c2a6a26f7", "Text": "Not Yet Voted", "Name": "Not Yet Voted", "HasChildren": false, "Ordinal": 15, "EnumNodes": [] }, "ClassTypeId": null, "BaseId": null, "TimeAdded": null, "DecisionDate": null, "MustVote": false, "Veto": false, "User": { "Id": data[i].Id, "Name": data[i].Name, "Email": data[i].Email }, "VotedBy": { "Id": null, "Name": null } }); });
5 -
Geoff_Ross Cireson Consultant O.G.@Alex_Marsh
I think you're almost there. But Reviewer is an Array not an object, as you can have more than 1 per RA. So wrap your Reviewer object in [ ] and i think that will work. Sorry not had time to test.5
Answers
I'm trying here to add the affected user of the request in as a reviewer in this instance (obtained from pageForm.viewModel.RequestedWorkItem and stored as variable affu)
I had (perhaps incorrectly) assumed that I could put the reviewer properties in as part of the review activity parameters which would only mean I needed 1 commit instead of adding the review activity, then adding another round of functions to add the reviewers
I think you're almost there. But Reviewer is an Array not an object, as you can have more than 1 per RA. So wrap your Reviewer object in [ ] and i think that will work. Sorry not had time to test.