0

I've created a workflow for a review process, that copies a file into a "working" library, takes the check-in comment through Rest API (with elevated permissions and full appinv access) and then saves it as part of the comments history log (Among many other things, but this is the problem specifically).

This has been working great and dandy UNTIL, I've packaged it and need to deploy as template, I've noticed that the workflow ID changes and this means that each time a new site (Project site) is created, needs to send a mail/flag somehow someone from IT to elevate permissions in the appinv for that specific site collection (manual Admin appinv authorization).

I know how to do all of the above very well, with the exception that it's not going to work for a massive deployment. With all of the above said this are the questions:

My first suggestion was, could we create a new field and add the comment there followed by a no, it has to be the Check In Comment sadly.

Thank you!

2 Answers 2

1

Sorry, I am not really sure about how to handle APP situation. I can think of below messy alternative. This can only work on Classic sharepoint page and involves using JSOM/REST . (not on Modern page)

As you know, for every checkin , sharepoint opens _layouts/15/checkin.aspx with list and item id appended in URL

What you can do is insert a script in your master page which will function only when URL has checkin.aspx

Then bind additional event on OK button click.

This event will copy comment Text and insert in separate comment list along with list ID and Item ID

You workflow can always query this separate comment list with ID being common key

I understand this might not be best solution, however for now thats the best way i can think of.

1
  • I'm trying to avoid both Rest API (I'm already using this path but if the WF is not elevated through APPinv.aspx I can't read the check in comment) and customizing the site beyond OOTB function. Thank you though as this might help other users!
    – Yugo
    Jul 30, 2019 at 14:33
1
+50

You can deploy workflows globally throughout the farm by attaching a globally available reusable workflow to a Content Type, and using a Content Type Hub to deploy the content type (and workflow - sort of) to each new site... You still have to export the workflow as a template in designer, and upload it to each site's Site Solutions area, and activate it as a feature on each site...

Aside from the steps in Designer, most of this can be deployed with PowerShell. Let me know if you need an example script.

A lot of what I am describing above can also be done in a C# Solution... While I can't give you much info on that, it may be worth considering doing a lot of things in C# if you have a big deployment.

Also...

You can get a "Check In Comment" with a SharePoint 2010 Workflow:

enter image description here

You can also set item level permissions in a SharePoint 2010 Workflow using "Replace list permissions"

4
  • 1
    Oh I actually haven't used 2010 WF, all I need to retrieve is the Check In comment and I've been doing through a 2013 WF but through REST API as it doesn't bring the check-in comment otherwise. I'll try this out and set it as answer afterwards. On regards to the permissions, I'm talking about Workflow App permissions in the appinv.aspx in the root site collection. Thanks will update as soon as I can!
    – Yugo
    Jul 30, 2019 at 14:35
  • Yeah the SharePoint 2013 WF system is external to SharePoint, and mainly uses the REST API, however the 2010 WF system is actually part of SharePoint and can do a lot of things that the 2013 WF system cannot. Can't really help with appinv.aspx permissions, sorry. I don't have enough experience with that. You may need to have a mix of 2010 and 2013 workflows, and perhaps even some PowerShell in the background?
    – user43832
    Jul 31, 2019 at 7:23
  • 1
    All I needed was a 2010 WF in the end, I'm giving you the bounty because that was the what else could be done. Didn't need to elevate permissions for the app to read the check in comment as you would need in a 2013 WF with REST API. Thank you.
    – Yugo
    Jul 31, 2019 at 14:02
  • Glad to have helped! :) Yeah, SharePoint 2010 workflows are pretty good. You can even pull Profile Service information with them, which I believe you can't do with the 2013 workflows. Cheers for the bounty! :)
    – user43832
    Jul 31, 2019 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.