SharePoint Approval - sharepoint

I need to add sharepoint approval to a list... and I was hoping to use the default approval process... but... I need to run some code once an item is approved. Do I have to then use VS to create a custom workflow?
I need to run some code that currently runs in an event reciever. I need to move the code to another function (as we are moving the processing out of event reciever code and now based on item approval). This code would execute after the item is approved and can be hosted as a service or .net code.

Full commented source to a state-machine based approval workflow comes with the MOSS SDK 1.5 in the samples directory.
http://www.microsoft.com/downloads/details.aspx?familyid=6D94E307-67D9-41AC-B2D6-0074D6286FA9
-Oisin

Related

Can I use default workflows for this?

I have to create a workflow in Sharepoint online shown in the image. Below is the explanation of the workflow
A Sharepoint list form will be defined with required fields.
Step 1:
Whenever a new project requestor wants to request for resources, they use the link to create a new line item and submit
Step 2:
This item should be assigned to Manager. He will verify the details and assign it to some Lead.
Step 3 :
Lead will work with the requestor offline to gather details about the request and comes up with level of efforts, no. of resources required, etc. and creates a form(some excel template). This form needs to be uploaded to this request and on submit,
Step 4:
Now this item should go back to the manager. Manager will finally review the form created by the lead (and allocate resources - not part of this workflow) and closes the request, and the requests lifecycle is ended.
Is there a way I can achieve this using the inbuild workflow types given in SP online, or Should I create the workflow from scratch - I'm very new to SP, so sorry for the basic question
I don't think the default workflow would meet your requirements. Here are two options for you:
Use microsoft flow to build your workflow.
If you do not have flow license, I would suggest you use SharePoint Designer to build your wokflow.
If you have questions to build your workflow, feel free to ask.

How to write custom code on save of Share Point List New Item

I want to write custom code on Click of Save, when a new List Item is created in Share Point site.
Which is the easiest and most well controlled way to do that.
I have C# Code to do the stuff
If you want to trigger custom logic after item saved, there are two solutions.
SharePoint add-in Remote event receiver
SharePoint 2013 workflow
If you want to trigger event before item saved, check PresaAction(JavaScript)
As #Lee stated (link) there are a few options.
If you want to run server side code? The option i would go on is Custom code to run an Eventreceiver (not to be confused with Remote eventreceiver). I would prefer this option than doing it by using a remote Event Receiver.
Then you can trigger this on the ItemUpdated or ItemAdded event.
Microsoft's article regarding How to: Create an Event Receiver

SharePoint workflows cannot automatically start

I'm trying to make a SharePoint workflow start automatically for any new document that is uploaded to a specific doc library. I've configured the workflow in SharePoint Designer to auto start for new documents or changed documents. However, the workflow never starts automatically! I can run it manually, but it won't execute itself.
I've searched around and have found the core issue, which is reflected in my log:
"Declarative workflows cannot automatically start if the triggering action was performed by System Account. Canceling workflow auto-start."
However, all the fixes I've seen have not worked for me. A common solution is to not run or create the workflow as the SharePoint System Account. Well, my SharePoint service accounts are not the ones I'm logging in as to upload my documents nor was it the one I used to create the workflow. I've tried editing & re-publishing my workflow as a totally new account and it still won't auto-start.
Just focus on two things:
Workflow will never start automatically with system account.
Check the options Start workflow automatically when an item is created or changed from Workflow Start Options.
While publishing the workflow, u need to select the checkbox Start workflow automatically when an item is created or changed for the workflow to start automatically or else whatsoever the WF will not start automatically.
Instead of using Sharepoint system user account, u could use an account having contribute permission on site level and full control over the library
Run the command at the server in powershell
stsadm.exe –o setproperty –propertyname declarativeworkflowautostartonemailenabled –propertyvalue yes
After I did that, the workflow runs perfectly although it shows the created by as being "system account".

Is it possible to add workflow modification programmatically?

I`m interested in adding SharePoint Workflow Modification programmatically from my workflow, without using forms.
What i'm trying to achieve - I want to add Workflow modification when user uploads new document version to document library. I have OnWorkflowItemChanged and from there i'm willing to add WF Modification.
Is this possible?
To clarify some things:
I`m writing a custom Workflow in Visual Studio.
What I want is to add items to (SPWorkflowModificationCollection) SPWorkflow.Modifications object. However there is no Add method, but the designed way to add items there is by using Workflow Modification forms.
In this case, i don't want user to use modification form, but i want to add workflow modifications (which will populate the collection AND triger OnWorkflowModified event).
I am not 100% sure what you mean by workflow modification. Do you want to modify the workflow itself from a workflow or just modify a document or item from a SharePoint Workflow?
Regardless, I'll give you the same answer to what was accepted as the answer to a similar question.
Workflow is one of the strong parts of SharePoint. Out-of-the box you or your users can build workflows using the free SharePoint Designer. Depending on your exact requirements this may be good enough.
If you need a more advanced workflow editor then you may want to consider Nintex Workflow or K2. Alternatively you can write your own workflows in Visual Studio or buy 3rd part Workflow Actions for SharePoint Designer.
I have included some useful links below:
Building workflows using SharePoint Designer
Creating workflows using Visual Studio
3rd Part Workflow actions to embed VB or C# directly into SharePoint Designer Workflows. Note that I have worked on this product so consider my recommendation biased ;-)

sharepoint workflow

I am new this sharepoint development and i have task in hand to do the following.
1.When a new document added to the library, the system will prompt for approvers & audience from a database table. this will be stored for future revisions for the document.
2. Upon successful completion of assigning approvers, audience the system will initiate the workflow to complete the approval process.
It would be great if anyone can point the direction to do the following:
1.is it possible to call a aspx page/form from document library insert/update event?
2.How to assign approvers to a workflow programmatically?
Thanks in Advance!
Alex
I'm not sure it is possible to explicitly call another page but you can use the "Source" url parameter to specify the page they are directed to after they press OK. Obviously, you will have to change "www.google.com" to be your new URL.
/Lists/Announcements/NewForm.aspx?Source=www.google.com
You can probably do all of this using custom workflow. With custom workflow you have two options: creating the entire workflow in visual studio or create custom workflow actions and using SharePoint Designer to build the workflow.
Building custom Workflow Actions.

Resources