How to add notify me functionality on pdp page in demandware - demandware

Hello I am new to demandware just worked on few POC's and I need to create a notify button on pdp page if a product is out of stock then on clicking this button a pop up window will open which will ask for email id that should be saved in a custom object and the user should be alerted when the product comes in stock via email that has been saved in custom object

Generally you should rely on a third party system (usually the OMS or some other back-end system) to store and send notifications. The mechanism I've seen used most often to achieve this is to record the product ID, customer email address, and timestamp into a Custom Object. Periodically these Custom Objects should be exported to the third party system via a job and then deleted from the Demandware system. Deletion is important because of system quotas limiting the total number of Custom Objects than can be stored.
The third party system would periodically look at the the products that have been 'subscribed' to, if they have inventory, then email the people who wanted to be notified.

What you can do is create a simple button on PDP upon clicking which, a popup box is shown which contains a form with hidden pid field and a text box for entering user's email, and a submit button to submit this information.
Use jQuery and AJAX to get the form data (pid & email), pass this on to Controller, store the data into custom object, get the response back from the Controller, and show the response back on the popup or in any other way you feel fit.
You'd need to create custom object to store this data, wherein your unique key would be combination of email and pid (encryption recommended).

Related

What is right way to create multi purpose rest end point?

I want to create a rest end point but I am not sure what is right way. For example I want to expose endpoint to create account but there are multiple account type like:
Normal account with property name, description, and current balance
Credit Card account with property name, description, current balance, grace period, billing date and current outstanding. Now the confusion is, Shall I create two endpoint for each of account type? or Shall I create single end point with all the property.
Shall I create two endpoint for each of account type? or Shall I create single end point with all the property.
How would you do it on a web site?
You might have a single create-account form; you collect the information that you need from the visitor, the form is submitted to the server, and the server looks at the form details to determine what kind of account to create. Create the account, and send back a response to the browser announcing where the web page describing the account is. And that's fine.
You might do the same thing with multiple forms; through a series of links you guide the visitor to the form that best fits their circumstances, and then the remaining work is the same as above - the form is submitted, the server looks at the form details to determine the account to create, the account is created, the server sends back a response to the browser announcing where the web page describing the account is. And that's also fine.
You could do the same thing with multiple forms, but have each of the forms submit using a different target URI; you could even have each form submitted to a different host! Again, the actions taken by the host receiving the form are the same - do the work, return the result announcing where the new web page is.
Thw browser doesn't care, it's just collecting form inputs using standardized form processing rules, and then submit the result using the meta data in the form.
You'll want different code responsible for creating each of the different kinds of accounts (the "separation of concerns" idea), but it doesn't much matter if the routing of the request to that code is done purely mechanically (because you are using different URI) or "by hand".

Using SmartSheet API for "Smarter" email notifications

Currently in SmartSheet, users are able to assign email notifications to users, which are triggered when "Anything Changes" or a pre-specified column changes in a sheet.
While this is useful, there is a common business case where a sheet administrator needs to notify users based on the contents of a cell. For example, if the drop down option in Column A is set to Option A, User A gets notified, or if set to Option B, User B gets notified, etc.
Is this sort of conditional notification logic possible in the SmartSheet API v2.0?
The Smartsheet API doesn't currently support creating or managing alerts (i.e., notifications and reminders). So, to achieve the type of scenario you've described, you'd need to create an integration that:
is able to know when the specified changes occur in the Sheet (ex: Column A is set to Option A for any row)
contains the logic to determine which user(s) to email (ex: if Column A is set to Option A for any row, then email User A)
sends the email(s)
At a high level, you have a couple of different options for accomplishing what I've outlined above:
Poll Smartsheet periodically (ex: hourly) to determine if the Sheet has changed (Get Sheet Version) and if it has changed, evaluate sheet data (Get Sheet); if data meets your criteria for sending email(s), then send email(s).
Alternatively, you could use "Smartsheet Webhooks" such that your integration will be notified when changes occur in the Sheet, then react to such notifications by subsequently using the API to evaluate sheet data (Get Sheet or Get Row); if data meets your criteria for sending email(s), then send email(s). Smartsheet Webhooks are currently in Private Beta -- if you'd like to be considered for the private beta, you can apply by completing this web form.

How to allow user to only submit an infopath form without read/write access?

I have a infopath form already built, how do I achieve the following?
user is able to access the form via infopath form web part.
user is able to fill out the form and submit via the web part.
user cannot go to Site Contents to even view the result, neither their own, nor others'
user cannot view/edit any results. Submit data only.
Is this possible in SharePoint 2013? So far the closest I could get to is use custom permission level to allow user to only view but not edit item. But I don't want them to even view the result of others. They should only see the form via the web part and submit data there.
Create custom Event receiver on item added event. once the item added just break the permission inheritance and assign the permission for admin only.
So now user can submit the data but they can't able to see that
I think it is possible to submit the form data to another site by web services.

Submit One form to 2 apis

I'm trying to create a form that will submit data to 2 different API's based on a check box and one submit button.
Basically, I'm working on creating a form that allows a site vistor to register for a gotomeeting event. That's the main function of the form. Secondary to that, I want to include a check box that would allow the user to subscribe to an email list.
If the user leaves the checkbox unchecked - he or she would simply be signing up for the event via GTMeeting. If he or she checked the box, that means they register for the event and want to subscribe.
In case 2, The user data needs to be passed separately to Aweber (email client of choice here) and GoToMeeting.
I've created separate forms to handle these tasks separately - and with success. But I cannot figure out how to make the 2 post calls with just one submit button.
I read this post here from ant which seems like it should work: Submit form to 2 different action page
can anyone confirm this for me - in theory?
Thanks.
Craig

In salesforce, can you verify that an email sent by a workflow was opened by the recipient?

I am using a salesforce workflow to send out product information and invoices to clients but I am running into problems thinking of how to verify if a client receives the email and or opens it. Is there any way to prove that a client received my inventory list or invoice? Doing some prior research on this subject I have come across the following suggestions:
Adding a 1x1 invisible image to the email with a unique id
Adding a regular image instead of a 1x1, maybe company logo
Having the recipient click a link to see the invoice
With all these solutions, you have to detect image requests or link request for them and extract/produce a unique id for each client. I am not really sure how to do this in salesforce so any help would be appreciated, along with other detection ideas.
If you have Salesforce Content, there are some ways to expose documents to clients with the features you need. Basically you'll send an email with link and later you can track confirmation of opening, count how many times was it downloaded.. You can also set the expiration date to the document (can't be downloaded anymore after the date).
As for "pure" email from Apex/Visualforce and basically manually recreating the Content's functionality... nowadays most mail clients block external pictures unless explicitly allowed by the mail recipient, so I suspect you'll have poor track of emails marked as opened. Probably you could create a small Visualforce page (no header, no styles, just controller that makes update "invoice viewed" in the database). Display image from Documents on this page (make sure it's "externally available image") or even just display 1 pixel encoded in base64...