Trigger workflow from CEWP button - sharepoint

I have created a site workflow, now I need to trigger this manually when a button in Content Editor Web Part(CEWP) is clicked. How can I trigger it from a CEWP?
Thanks.

You cant directly start Workflows from Javascript ( inside CEWP ) using 2010 client object model. But you can always call a web service:
https://www.nothingbutsharepoint.com/sites/eusp/Pages/4-clicks-or-1-using-jquery-to-start-a-sharepoint-workflow.aspx
or use spservices
http://spservices.codeplex.com/wikipage?title=StartWorkflow&referringTitle=Workflow

I didnt find easy way of triggering site workflow from CEWP(using javascript) so i made a custom list to get updated with required parameter on click of the CEWP button( http://ishaalan.wordpress.com/2010/05/23/adding-an-item-to-a-sharepoint-list-using-javascript/ ). And made list worflow associate with that list to get triggered when a new item was added.It solved my problem.Thanks #dotsa for reply.

This could help:
http://techtrainingnotes.blogspot.ch/2015/10/sharepoint-launch-site-workflow-from.html
It explains how to attachworkflow to any button.

Related

SuiteScript 2.0 detect change on custom field with client script

I deployed a client script that handles a click event on a custom button. When I click the button, I may an api call to get data and the field is populated with the data. This part works great, but when I go to save the new information on the record, I get this alert:
The record has not changed. Do you really want to submit it?
Is there some way to trigger a form changed event or something similar?
try setWindowChanged(window,true)

Orchard Dynamic Forms Workflow not invoked

I made a simple workflow in Orchard 1.9.1 to notify when a dynamic forms is submitted.
I didn't set any prpoperty/data on the Start Activity so that it can capture all Dynamic Forms submission. However there seems an issue and the workflow is NOT being invoked.
I followed steps from here: http://docs.orchardproject.net/Documentation/Workflows
But this notify activity or may be even the start activity doesn't seem to be invoked/working . What More settings are required to get this workflow in action ?
Also, I have set the redirect URL in "Forms" element properties but the form isn't redirecting. What can be the issue here as well ?
I have not seen this problem with a workflow before. I assume there's nothing in the logs?
My first guess would be that it's your form that is not submitting properly, try to remove that redirect, also make sure there's isn't some validation error blocking it, if you placed recaptcha element remove it and try again.
Second guess which is not very likely is that you have somehow managed to hide notification zone, either with CSS or in layout view #Zone(Model.Messages)

Custom E-Mail Event for Sharepoint Upon InfoPath Form Submit

A customer wants an e-mail notification sent to a select group of people when a new InfoPath form is submitted to a particular Document Library on their SharePoint 2007 setup.
Easy, right? Use a custom set of rules for an e-mail submission in InfoPath, plop in the addresses, use a fancy equation to construct a useful e-mail subject line... and done. Worked like a charm. Problem solved in just a few minutes...
However, the customer doesn't want the whole form e-mailed out or even attached to the e-mail. They only want a few select fields from the form in a very simple message.
I've tried writing an ItemAdded event handler from the SPItemEventReceiver base class, but it doesn't seem to do anything. Yes, I added the event handler to the GAC and created a Feature.xml and Elements.xml to register the event handler with SharePoint. But, I'm not sure if this is even the right event to customize. Is an item in a Document Library the same as an item in a List?
Has anyone had luck doing a similar e-mail notification event? Is there an easier way to accomplish what I'm attempting? Perhaps there's a way to do this easily through the SharePoint interface or edit the contents of the e-mail submission rule to be a simplified version of the form?
Any advice is greatly appreciated!
How about a very simple SharePoint Designer workflow that is triggered when the form is uploaded. From there you send an email and include content of the (exported) columns in an email body.

How to use custom WrkTaskIp.aspx page in custom sharepoint workflow?

I have created as custom task edit browser enabled Infopath form which successfully gets open when user clicks on Edit task. But by default it opens up in the WrkTaskIP.aspx page which is available in 12 hive..Layouts folder.
Now the default WrkTaskIP form provides two following options as hyperlinks
1. Delete item, and
2. A link to navigate to the task display form
I want to customize the OOB, WrkTaskIP page and associate that with my workflow.
How exactly can i achieve this ?
Thanks.
Assuming you've got a custom task content type you can create a custom feature with an application page and make the task open the form in this page instead.
Copy the WkrTaskIP.aspx page from the 12 hive, modify the contents as you require and deploy this as an application page.
Then in your taskcontenttype.xml file point to your custom page by setting the Display or Edit values to the deployed location of your custom page:
<FormUrls...>
<Display>_layouts/YourCompany/Workflow/YourWrkTaskIIP.aspx</Display>
<Edit>_layouts/YourCompany/Workflow/YourWrkTaskIIP.aspx</Edit>
</FormUrls>

Sharepoint : Event Receiver : Item Adding

Anybody used the "ItemAdding" method successfully in an Event Receiver in Sharepoint for validation?
I think it just can't work properly for validation purposes because it seems that :
You can't access the data you just
entered in a form
If you add an error message,
instead of displaying the form
back with your error, Sharepoint
display the big ugly error page.
Here's what I found so far on the web for the ItemAdding method :
http://www.sharepoint-tips.com/2006/09/synchronous-add-list-event-itemadding.html
http://www.moss2007.be/blogs/vandest/archive/2007/07/20/wss-3-0-event-handler-pre-event-cancelling-issues.aspx
http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25
Anyway, if somebody successfully used that method, please tell me how because I think that it's just broken/missing something!
Thanks!
You can't use ItemAdding to perform that kind of "friendly" validation checking. If you set e.Cancel = true and set e.ErrorMessage, sharepoint will redirect you to the standard error page and display your message. You can't make it redirect back to your form page.
Rather than trying to hack the built in pages, you should use an infopath or aspx form bound to a content type. Infopath has built-in validation controls and with aspx forms you build yourself you can treat it like any web app and choose your own validation.
No easy way out here I'm afraid.
-Oisin
You can access data that was just added in the form. Look at properties.AfterProperties in the adding/updating event receivers.
An example would be properties.AfterProperties["Title"].
I agree that error handling is a little hard, but I recommend that you do validation in your event receivers in addition to having your UI do validation. If it is not a custom page, then you can add JavaScript to existing pages using a Content Editor Web Part to do the validation.

Resources