Javascript Add Approver to RA
Hello Community,
I am wondering if anyone has any insight on how to do this, I am guessing if I dig deep enough in the portal I will find how the Add button within the RA works, right now I am making a task for approver adding, and I was wondering if anyone has attempted this before I get too deep into the portal source. Any help, suggestions or ideas is much appreciated!
Best Answer
-
james_kleinschnitz Cireson Dev, Product Owner Advanced IT Monkey ✭✭✭@Davin_Clouthier
The viewModel for activities and the reviewer are actually fairly complex. I have written some fairly imperative code that should do what you need. You will, however, have to get the user object for the reviewer and the activity object from the pageForm.viewModel.Activity array.1
Answers
just to be sure - you just want to add a reviewer via JavaScript?
How should the reviewer be selected ? (if it is always the same reviewer - it could be included in the template), is the Review activity already there, or should the activity also be added at the same time ?
To get a better understanding of your requirement - why do you not use the out-of-the-box functionality ?
Depending on this, the pageform.viewmodel object is a good starting point and the "/api/V3/Projection/Commit" API call should be helpful, too
regards
Yeah maybe a bit more info might be in order, we used to have and use the template system but we realized the static world was becoming a huge headache to where we would have 100s of templates mass deleting of improperly selected templates on tickets, so awhile ago we opted to implement a dynamic world where the CR is blank and the template is applied from javascript and ma's and ra's can be added on the fly from the portal page, sothe adding MA and RA's to add to the ticket just fine using the commit api, just was having some issues getting the reviewer to add properly, if that makes sense
The viewModel for activities and the reviewer are actually fairly complex. I have written some fairly imperative code that should do what you need. You will, however, have to get the user object for the reviewer and the activity object from the pageForm.viewModel.Activity array.
@james_kleinschnitz we are struggling to get our heads around where to put this script (does it go in the custom.js?)
Sorry for the post, we are new to Cireson/SCSM and are having issues
Just following up with this, anything else I can help out with here?