Sharepoint 2007 approval email - sharepoint-2007

in our Company we have a Sharepoint 2007 Server which we are using to keep track of our cars.
What I try to achieve is to have a aspx page where you can select a car of the cars list and then click "request". If you did that the page must switch to another text saying something like "car request in progress" (and of course hide this car in the cars list if the next person enters this page) and send an email to someone which contains two buttons: "accept" "decline". If he clicks "decline" the cars status has to be set to available again so someone else can do a request for this car again. if he clicks "accept" another person gets an email telling him that person1 requested this car and this has been approved by person2. this emails are easy to create using workflows which are waiting for the status to change but how can i create a link which changes a cars statusfield in the cars list and what code do i need in the aspx request page?
Thanks in advance!
MemphiZ

Make a link that, when clicked, will run the appropriate action on the users behalf. If you are using workflows, this is as "simple" as changing the items property and letting the item-change event be handled. Make sure to avoid cyclic changes.
This can be done trivially by encoding the items GUID (and perhaps list and action and whatever else you want) in the URL; the GUID can be used with the SharePoint Object Model for the lookup.
Perhaps the above can be done using SPD without a separate/"code" ASPX, but I don't touch that pile of "fun".
Edit for comment:
In my scenario we just encoded the link as http://foo.com/whatever.aspx?id={THEGUID}. The aspx handler just read the query parameters. Item editing ability used standard SharePoint list permissions. Double-submissions were rejected because after the link is handled the item modified to be in a new state which does not accept said link-action (thus clicking the link again simply resulted in no-operations). Working out a total state-diagram before starting work can save lots of time.

Related

Zapier: How to send data to my Node.js web app from ScheduleOnce using Zapier

Here is my workflow:
Person clicks on my ScheduleOnce link and schedules a meeting
Upon completing the ScheduleOnce booking form, the person clicks the done button
When this done button is clicked the person is redirected to a Node JS web app that displays an application page. This application page needs to be auto-populated with the information from the ScheduleOnce page.
Between step 2 and 3 is where Zapier comes in. I am trying to use Zapier to capture the data from the ScheduleOnce booking, which it is. Then I am trying to use a Zap to send that data to the page the person is redirected to, to auto-populate some of the fields.
I thought using the Code Javascript functionality would work but it does not. So then I was thinking about using the StoreClient option or the API. I am just confused on how to get the flow to work to access the data and auto-populate the fields on the next redirected page.
Some help would be greatly appreciated.
Here is the code I have for the Javascript option:
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.then(function() {
return store.getMany('firstName', 'lastName', 'email', 'mobilePhone', 'otherPhone', 'businessWebsite');
})
.then(function() {
callback();
})
.catch(callback);
David here, from the Zapier Platform team. This is a cool use case and is probably possible. Something you need to remember is that Zapier is running totally separately from the user, so interaction will have to be indirect. Zapier can't redirect your user anywhere, it can just store data in response to a button push.
In your case you can skip everything after the setMany, since you're not trying to use the values in the zap; you just need to store them (and verify that action completed without errors).
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.catch(callback);
You'll need to solve a couple of problems:
Speed. the user will reach your landing page before the zap completes (as it has to make a couple of HTTP round trips and execute code). You'll want to play them a 3 second loading gif, or put a waiting message and allow them to refresh the destination
Populating the page. I'm not sure what the nature of the destination is (best case scenario is that it's a server you control), but something will need to make an http request to store.zapier.com to retrieve the stored data and surface it in the view. This is easy if
Identifying the user. You'll need some way to identify the user getting redirected to the data you stored in StoreClient. If two users fill out the form in quick succession, the second one will currently overwrite the first. Plus, it seems to be semi-sensitive data that you don't just want available to anyone on your site. To that end, you'll probably want to store all of the data as a JSON string keyed by the user's email (or something else unique). That way, when I (the user) finish the form, I'm redirected to yoursite.com/landing?email=david#zapier.com, the backend knows to look for (the david#zapier.com key in store) and can render a view with the correct info.
To that end, I'd tweak the code to the following:
var store = StoreClient("Secret");
store
.set(inputData.email, JSON.stringify({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite}))
.catch(callback);
Hope that points you in the right direction. You're working with a pretty complicated workflow, but I bet you can do it!

SurveyMonkey: How do you determine a survey's ID?

For a given survey, how do you determine its survey_id for use with the SurveyMonkey API?
A list of all IDs is returned by the API method get_survey_list, and you could subsequently call get_survey_details on each survey to determine which one is the intended one, but that seems needlessly complicated. There has to be a way to get a survey's ID from the My Surveys page, right?
Edit:
Whoops, get_survey_details isn't actually necessary, since get_survey_list can take a fields parameter that includes the survey's title.
If you want to get the survey ID via the web page you can:
Right click on the survey in the "ALL SURVEYS" surveys view, and press "Inspect Element" or "Inspect" depending on your browser.
In the bottom of the browser, you will see a highlighted block that starts with:
<a href="/summary/...
Scroll up a few lines until you see a line that starts with:
<tr class="survey-row" id=`
The number that follows id= is the survey id, which you can then use in the API.
Nothing much to add to what Tony & Miles said, just that my UI form contains these fields:
1) An Age limit - eg the past 365 days
2) A keyword in the title - typically all the surveys for one client have that client's name in the title. Hint: if you can be organised enough to enforce a convention, and put keywords in the nickname, the nickname is what the API looks in for Title, although what the user sees is the other title.
3) A start date to get responses only after a start date - the first day may have been only a test.
4) A combobox with all the matching surveys is presented showing the title, number of respondents, date created and date recently modified, pretty much the same as what appears in the SurveyMonkey web UI. That's where they pick the one they want.
HTH
Patrick

Sharepoint 2007 get link to items in a custom form

I have a SharePoint Server 2007 installation. What I needed to do is to create a simple printable page/file which is populated with data from a list. For various bugs and reasons I can't do this with a word template in a word document library and I can't use workflows.
My solution so far is very rude and simple, but it gets the jobs done:
I created a new custom form called print.aspx
I insert a Custom List Form based on the display form.
Successfully pasted the text, put the data fields and added a couple of text fields for additional data that is required in the print form but not on the list item.
This print.aspx custom form won't save anything and it is not required.
Now what I want to do is place a link in the customized DispForm.aspx that leads to the printing page so when the user enters the list item and it is approved they can click to see it. At the bottom of the DispForm.aspx there will be a simple link to print.aspx saying "To print this click here". Unfortunately I have no idea how to link to the ID of the item in print.aspx.
Example:
In InternalPortal/Lists/ImportantList/DispForm.aspx?ID=5 I want the link to point to InternalPortal/Lists/ImportantList/print.aspx?ID=5
Already tried ID={#ID} and ID=item.ID but to be honest and not sure how to use them.
Edit: In summary - the link ends in ID={#ID} but it should be in the DataFormWebPart. This will not work outside of it.

Rails AJAX filtering has me totally stumped

It's not often that I find myself completely baffled as to how to go about solving a problem, but for this one, I honestly haven't a clue.
I'm building a site that has many projects, and on the homepage, I'd like people to be able to browse these projects by turning on and off filters. One of the filter types, for example, is GENRE. The user sees a list of genres which, when clicked, filter out all projects that match that genre. Furthermore, if you click on two different genres, you'll see only the projects that match BOTH of those genres.
The problem is, this all needs to be done via AJAX, and that's when things start to get confusing for me. How can I make an ajax call that not only sets up a new filter, but remembers the filters that are currently in place? When the page is loaded, I could do something like
First Genre
Second Genre
But the problem is that when I click two at a time, I end up only filtering by a single genre. I could, perhaps, update all the links to contain an array of already-selected genres using JS each time one is clicked, but this seems incredibly sloppy. Each and every link would then have something like:
First Genre
Another thought I had was to maybe store all current filters in a cookie and then when a link is clicked, add that new filter to the list of filters in the cookie, but again, this seems sloppy.
Point is, I have no idea what the proper way to do this is, and I'm feeling a bit lost. To anyone out there who's had success doing something like this before, help!!
Ajax filters always create two issues from user point of view. one is user can't bookmark filter urls and can't use back button.
For example, user click on filter 1, then click filter 2. if user click on back button or reload page, user will lose all filter data.
Here is one method to manage all
You can use this method Jquery BBQ http://benalman.com/projects/jquery-bbq-plugin/
on click of genre filter, you can append filter values into hash of url by using above plugin and whenever user reload page or use back button, you have all selected genres into hash.

How do I make a "back" link?

I have a detail page that gets called from various places and has a nice readable url like
"www.mypage.com/product/best-product-ever".
The calling pages (list of products) have a more complex url like:
"www.mypage.com/offers/category/electronic/page/1/filter/manufacturer/sony/sort/price" and
"www.mypage.com/bestseller/this-week".
How can I make a backlink from the detailpage to the calling product list?
I cannot use javascript
I don't want to have the calling page in the URL, because it gets to long
I really want links between pages, no http-post
I cannot use Sessionstate
EDIT:
Sessionstate is ruled out, because if there are 2 Windows open, then they would share the same "Back" page information.
Like Lee said, use the referrer value:
Back
If you don't want the URL in the link because it's too long, try running some sort of simple compression algorithm over the URL, display the compressed data as unicode text and then append the compressed URL as a parameter to a redirect page, e.g:
Back
What about using the referrer header value?
Here's a crazy idea that will require a fair but of work and may not be healthy for performance (depending on your users).. but here we go:
Create a repository for caching 'ListResults' (and wire it to persist to the DB of you like.. or just leave it in memory on the server).
In short what this Repo can do is store a ListResult which will include everything to persist the state of the current view of the list any given user is looking at. This might include routes and other values.. but essentially everything that is needed to redirect back to that specific page of the filtered and sorted list.
As the ListResult item is added to the repo a small unique hash/key is generated that will be url friendly - something like this "k29shjk4" - it is added to the item along with a datetime stamp.
ListResults are only persisted from the moment a list gets off the default view (ie. no filtering, sorting and Page 1) - this will help in a small way for performance.
A ListResult item may never actually get used but all detail actionlinks on the particular list view have the ListResult.Key hash value added to the route. So yes, it might end up as a querystring but it will be short (url friendly) and if you wanna mess with routes more, you can tidy it up further.
For navigation "back" to the list, you may need a new small controller which accepts simply the ListResult.Key hash value and redirects/re-creates the state of the list view (paging, filtering and sorting included) from the lookup in the repo.
So we have met the requirements so far: no calling page in the url (in the sense that its not the whole page - just a hash lookup of it); no POSTing, no sessions, no js.
To stop the ListResult repo from getting to big (and dangerous: if you persist it to the DB), you can use a ASP.NET background service to periodically prune the 'old' routes by way of the timestamp.. and 'extend' the life of routes that are continuously being used by adding time to the stamp of a ListResult item when it's requested via the new controller. No need to persist a route indefinitely coz if a user wants a permalink to a list view, they can bookmark the long list route itself.
hope this helps somehow
Do you have a cookie?
If so, you can put it in there, or use it to create your own session state.
I think this is more like a "Back to results" then a generic "<< back" link, because you would expect the generic back link to return to the genetic list, not the heavily filtered list you described, right?
I don't know if this falls into your "no post" condition, but the only option I can see is having the Detail action be POST-only ([AcceptVerbs(HttpVerbs.Post)]) and include another parameter like string fullRoute which is converted to the 'link' on the detail page for "Back to results". Overload the Detail action missing the fullRoute param and have the overloaded action be a GET action so that the POST fullRoute value is not required (for when users are ok with the 'generic' "Back" link). This should serve both 'generic' GET requests to the Detail page and the POST request which will include the specific "Back to results" link for the filtered list.

Resources