NetSuite purchase request approval through email - workflow

When NetSuite sends a purchase request notification email to a designated approver, is it possible for that email to contain buttons that the approver would be able to use to approve/reject the request? Alternatively, is there another way to allow the approver to approve / reject the request through email without having to log into the system?

Not that I am aware of. However, one potential solution would go something like this:
Build a Suitelet or RESTlet that performs the approval (RESTlet preferred).
Build a PHP page (or any server-side page in whatever language you want) that constructs the appropriate HTTP request for the RESTlet
Put a link to the PHP page in the email.
The user would simply see and click a link in the email, and the PHP/RESTlet would take care of the approval action.

Yes, approval or rejection is possible through email response.
You have to use NetSuite Email capture plug-in along with an workflow. In the mail sent to approver (from Workflow SendEmail action) have the following html snippet included in email body. In this example, subject included values to indicate Approval/Rejection, Transaction to act on, CurrentState of Workflow.
' &subject=Approve%20{tranid}%20FinanceApproval&body=">Click here to Approve '
Emailcapture plug-in user event gets triggered once the email is received. Event script can check the subject, perform validations and then perform necessary action on the workflow using nlapiTriggerWorkflow.
Note:
1. Use workflowactionApprove, workflowflowactionReject as button id in all the states in the workflow, so that its easier to refer in the script.
2. If additional comments needs to be captured during approval/rejection, mention in the mail sent to approver, to provide his comments in the body of the response mail. Emailcapture plug-in event can parse the mail body and update necessary fields.
thanks,
Veda.
Skalable Technologies.

Related

Button function in a SendGrid Email to Trigger an external Webhook

forgive my naivete in asking this question, but I'm hoping someone can help me.
I have an email I send out through the SendGrid api using a dynamic template. The content of the email is different for each user I send it to (highly curated). I send products, their name, info, and a link to buy them.
I am looking to create a "LIKE" button next to each product for the user to interact with in the email and provide feedback on that product. That is, if they like that product but don't want to click to buy yet, they can hit "LIKE" and I'll be informed.
I am thinking I would do this through a webhook using something like integromat where a click of the button would trigger the webhook and then I would use something like airtable to update information.
Is something like this feasible? Would I just put the webhook URL in the href tag of a button? Is it possible to trigger the webhook AND then redirect to a window/tab that would acknowledge that the button was clicked?
Thank you for any feedback!
Links in an email will open a web browser outside of the email. This will make an HTTP request to the URL that you set as the HREF for the link (<a>). So, you can point that HREF directly at an endpoint on your own application and handle the request, storing the data about which user liked which product and rendering or redirecting the user to a confirmation page.
I think you may be complicating the idea by introducing the term webhook to this. I also see no reason you would want to include a third-party like Integromat to the proceedings.

PayPal REST API v2/checkout/orders does not redirect back after approval

I've never used PayPal before, it's not really popular here, and I'm confused by how the order and payment works. Can anyone explain it to me? I've read the documentation and I'm still confused.
To complete payer approval, use the approve link to redirect the
payer. The API caller has 3 hours (default setting, this which can be
changed by your account manager to 24/48/72 hours to accommodate your
use case) from the time the order is created, to redirect your payer.
Once redirected, the API caller has 3 hours for the payer to approve
the order and either authorize or capture the order.
I have created a working PHP curl call for this API in sandbox env according to the sample
https://developer.paypal.com/docs/api/orders/v2/#orders_create
The APIs I created before work like this:
Send a request to 3rd party payment
Get a response containing a checkout link
Redirect customer to link
Customer complete payment
3rd party send a request containing order and payment detail to a file/path on my server
My server receives the request and updates the order status/payment in my database
3rd party redirect the customer to my webpage
With PayPal, what I got so far is:
Send request containing order detail to /v2/checkout/orders
Get a response containing various links
Redirect my customer to the rel:approve checkout link
Log in to my sandbox customer account and pay using PayPal balance, click Continue
A popup message is shown: We're sending you back to xxx's Test Store to complete this purchase
The popup message is closed and I'm still at the same payment page with the Continue button as seen in the image
Send request containing order detail to /v2/checkout/orders
Get a response containing links
Redirect my customer to approve link
Step (3) is an old integration method, for websites using an old redirect-based flow. The preferred way to integrate PayPal uses no redirects. At all. Your website remains loaded in the background. Do the following:
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
If, for some odd and inexplicable reason, you insist on using the legacy flow with a full page redirect instead of what I just described above, you must include a redirect_url in your orders creation request, so that PayPal has somewhere to return to after the order is approved. Immediately when the return happens, capture the order with an API call and show the success/failure result to the customer. If you want an intervening order review step before capture, you can do this, but you must also edit your initial order creation request to change the verbiage of the last button at PayPal from "Pay Now" to "Continue" so that the user is clicking on something that corresponds to what the next step will be. application_context.user_action needs to be continue for this change.
Capturing an order will return a v2/payments object which is the completed transaction with its own ID for accounting and refund purposes. (The order ID is only used during payer approval, and unimportant otherwise)
I had this issue too, and I eventually got a solution from the documentation.
You have to add application_context.return_url to your request.
Attached is an example in PHP:
$postData = [
"intent" => "CAPTURE",
"purchase_units" => $purchase_units,
"application_context" => [
"return_url" => "",
"cancel_url" => "",
],
];
You can make a whole lot of customisations to the PayPal Payment page by adding the Application Context option, For a full list of the possible customisations, you can check up the official documentation Application Context Documentation

How can i get the hyperlink for "Approve", "Reject" work in Email using Apps Script

Problem: Seeking approval from manager upon each google form submission, the manager need to review the details and clicking approve or reject
BUT: how can i get the hyperlink for "approve", "reject" work
Desired solution: preferable Google Apps Scripts, when respondent click approve or submit, should save the response into google sheet and send second email to second layer approval
Tried: Able to extract detail from google form, but not able to perform approval and rejection button
A possible workflow is as following:
Use the form submit trigger - either for FormApp or, optionally, for SpreadsheetApp - if the responses are automatically stored in a destination sheet
Trigger onFormSubmit a notification email to be sent to the manager
Implement into the the notification email two links - one for approval, one for rejection
Create two WebApps - one that contains a script approving the form submission, copying the form response into a google sheet and sending emails to a second level approval; the second Web App contains a script that should be run in case of rejection (e.g. a notification email to the submitter about the rejection)
Use the Web App URLs as approval and rejection links in the notification mails to the manager
I hope those instructions are clear enough and helpful to you!

GDPR re-permission email

looking for a little advice on HTML emails and GDPR re-permission.
With the new GDPR regulations I have to create an email to send out to an existing list requesting their consent to continue contacting them.
My intention is to have an 'I'm in' button in the email, which when clicked takes the user to another page/url which has a simple form on it requesting the users email address and checkbox for them to tick to opt in.
My question is can I achieve this another more simple way. For example in the email itself when the user clicks the 'I'm in' button, can a post submission be made automatically with their email address, that gets sent to clients email, and they then just get re-directed to a standard success message. Is something like this possible? It would save having to create a form somewhere and make the process easier for the user.
I don't normally do HTML emails so I'm a little unsure - any help on this would be greatly appreciated, thanks in advance
Yes, you could embed their email in the query string of the URL and then have a webapp at that URL pick up their email from the querystring and process it. Obviously you'd need to code the webapp side accordingly.
E.g:
I'm in!
If you can still send an email to the user, the collection of consent can be quite simple. It will be sufficient to send each user an email containing a link to accept the newsletter (e.g. "Yes, I want to receive the newsletter"). The email should also contain the terms and conditions of the service, and the privacy policy. What come next can be either automated, or handled manually.
The best option would be to automate the process. This can be done in multiple way, the simplest being with a customized link for each user pointing to a website capable of interpreting the data transmitted by the link itself. To achieve this result, the link contained in each email should contain an identification code - which should be anonymized where possible - so that it will be possible to link the new consent to each user. In this way, when the user clicks the link, he or she will be taken to the website. At that point, the backend will be able to collect the code passed by the link, identify the user and, finally, re-subscribe the user to the newsletter.
In practical terms, in the email there could be a link with a value to be passed as a `GET« parameter:
Yes, I want to receive the newsletter
The server-side logic could be as follows (in PHP synthax):
// re-subscribe.php
$uuid = $_GET['uuid'];
$user = getUserByUUID($uuid); // assumed function that gets the user infos by a UUID
subscribeUser($user); // assumed function that re-subscribes user to the newsletter
echo 'Thank you!'
This could even be accomplished manually, provided that a link tracker service/tool is used.
In this – less ideal – case, in the email there should only be a single clickable link, the one required to express consent (e.g. "Yes, I want to receive the newsletter"). This link could take the user wherever deemed most appropriate. What matters, in this case, is the ability, through the tracker service/tool, to know which users have clicked the link. As long as there is only one link in the email, this would inform us that the user has expressed his or her consent, and thus we could manually re-subscribe them to the newsletter. In this case, the link to the terms and conditions and to the privacy policy should be included as static text, and not as an actual clickable link.
For more info, check out our blog post, inspired by this question, at blog.autoprivacy.eu/2018/05/newsletters-after-gdpr-existing-and-new.html

Bigcommerce Custom Emails

When the order status of an order in Bigcommerce is changed, it sends out an email using the template order_status_email.
I want it to send out 2 emails when this happens. (that default email, and another custom email template)
Is there a way to use the API or customize my store to send out an custom email when the order status is changed?
You'd have to set up your own system to send out the email, but you can access order statuses through the API no problem. Docs can be found here: https://developer.bigcommerce.com/api/objects/v2/order_status
I'd recommend working with the webhooks feature, it'll make this a lot easier.
https://developer.bigcommerce.com/api/webhooks