Built in Approval workflow not started on item edit event - sharepoint

I have requirement where when a user enter new item in a list first approver approves it then publisher approves it. Once publisher approves it the text will be visible to all.
I have used SharePoint built in Approval for that where I have set my workflow to start when new item created and item is changed.
When I Add new item workflow triggers and process of approving the item works fine and update the workflow status as completed.
But when I edit the same item, Workflow on item changed is not fired.
Can any one tell me how to set SharePoint built in workflow to start on new item created as well as item change events.
FYI: I have set content approval to "No" in my versioning settings.

After lots of investigation I found that I have selected checkBox for "After the workflow is completed: Update the approval status (use this workflow to control content approval)".
Here I have not selected require content to be approved option for my list and for the same list I was updating approval status once workflow get completed.
What I observed is deselecting this option my workflow get fired successfully on new item created and Item change events.

To make the checkbox work for you, you need to setup content approval enabled on the library level. If not, it is going to fail with an error in the backgound.

Related

NetsSuite parallel approval workflow

I have made some basic approval workflows for custom records and things like estimates, but they have all been single approver or sequential. Does anyone have some advice on how I might achieve a parallel/asynchronous approval workflow?
I figured the workflow would add the approvers to a workflow variable list, send out an email to each approver and as the emails came back it would remove the people from another list awaiting approval. Once the list was empty it would transition to the next state. Seems like a simple concept but I can't get a workflow to add multiple items to a list...just set a static value which is 1 employee.
Thoughts?
Without more detail it's difficult to give detailed answers but something like the following is the idea:
You'll probably need a custom record that is linked as a child to the record to be approved.
Some workflow action scripts will likely be required to get this working.
When the main record enters the approval state a workflow action script will get the list of approvers and for each create a custom (approval) record linking the approver, approval status and record to be approved.
Another workflow will handle the single record approval of the new approvals record (e.g. sending out the original notice email, cancelling the workflow if the parent is rejected)
A scheduled transition on the main workflow will run searches to transition the main record when all approval records are approved or any approval record is rejected.

How to get the log of SharePoint workflow mail details in a list?

I'm using SharePoint designer workflow for sending mail in my application. Is there any possibility to get the following details as a log in SharePoint list. Details are :
From address
To address
Main sending time
Subject of mail
You can do that. First, create these fields in the list.
Then, in the workflow you can add another action just below the email sending action. In that action (Set Field in Current Item) you just write to the given field whatever info you require.
Alternatively, you can write to SharePoint Workflow History any event you think is necessary. This is also very useful if you're debugging a problem in the workflow and you don't know where exactly it fails.
What I do is I add a log line BEFORE and AFTER any action in the workflow and write this log line to workflow history. The action for this in the Actions menu is called "Log to History List"
You can then access history list by clicking on the workflow instance for your list item. If you do not see the workflow column in the list, go to list settings and click on the view you are using. Then, check the workflow column and save the view. Now you'll be able to click on the workflow instance and see the history.
And finally, there is a "hidden" list in every site called Workflow History.
You can access it by directly typing its URL:
"http://yoursitename/Lists/workflow%20history/AllItems.aspx"
Here you can follow all workflows that ran within the scope of this site.
Good luck!

Notify Admin of an update in Sharepoint?

Is there a way to get an update by email when a user updates a wiki page or adds items into the document library?
Yes, you can simply create an alert on the relevant list (Wiki Pages list or the Document Library in question).
Using alerts you can subscribe to new, modified or deleted items and have details emailed to you immediately, daily or weekly.
From the Actions menu of a list or document library select the Alert Me option and then configure the alert accordingly.
If you like, there's a video showing how to create an alert on a list.

Setting ModerationInformation.Status from Approved back to pending removes

Seeing if anyone else has had this problem and a resolution to it.
I have a visual studio sequential workflow on a list (not a library) which does NOT use tasks, the approval process is done through the Approve/Reject OOTB buttons on the list item. The approval is a 2 stage approval, whereby if the 1st stage is completed (via clicking the Approve OOTB button), i reset the ModerationInformation.Status from Approved back to pending then send an email to the 2nd stage approver.
My problem is, when i set the the ModerationInformation.Status back to Pending from Approved so there is never an approved version, the Creator loses permissions to view the item, and i get the "cannot find item" error from SharePoint for the person who created the item. The 1st and 2nd level approvers and anyone with approve rights CAN still see the item.
Some more background information. the code i am using to update the moderationinformation is
I get the properties from the workflow event and get a hook into the listitem
properties.Item.ModerationInformation.Status = SPModerationStatusType.Pending;
properties.Item.Update();
can anyone help.
Try using properties.Item.SystemUpdate(); this prevents SHarePoint from triggering any attached EventReceivers etc. I've had the same thing happen also. IMHO this is related to the fact that the item goes into update mode, then SharePoint basically has taken control over the item (seeing as workflows are usually run as the System account) but still sends you back to the the return url (i.e. the EditItem page of the list).
Since SharePoint is probably still doing work on the item (and when you use item.Update() it goes through all events etc. etc.) you cannot open it anymore, because you are not the system account.
When SharePoint finishes (after sent the emails etc.) the item is accessible by users again.
Like I said, I had the same thing happen during long running (i.e. longer than 2 to 3 seconds) EventReceivers / Workflows.

How to access the uiserID of the user who initiated a workflow

DUPE: See link below
I have a SharePoint Designer workflow and I need to send an email to the user who initiated the workflow. It is set for manual start only so it should always be running in the context fo a particular user.
I cannot see a SharePoint Designer action to let me do this, only to get the user who created the list item or by accessing the 'Modified By' column on the list. Neother of these is guaranteed to be the user who is calling the workflow.
Found the same question posted before. It appears to not be possible but the code for a custom workflow activity can be found here.

Resources