Could someone please help with following scenario ?
So this Data Pipeline has multiple activities (Set Variable) targeting to Single activity Send Email (Want to make Send email a Generic activity).
So the Idea is to Capture error from each activity into a Variable and pass that variable to Send email Activity to send email having Dynamic Content .
But Unfortunately unless all Set Varialbes are not Completed, the send email is not being Executed.
Any thoughts ?
Cheers
V!!
There are multiple conditions where both error variables will not be set in which case no email will be sent.
1 solution is to add another set of triggers incase any of the Set variable activities is skipped. You will need to add an IF condition to check the error variables and only send the email if either of them have a value. Else do not send. In my pipeline, I have put the send email only IF the IF condition evaluates to TRUE. I set the IF condition to
or(not(equals(variables('error1'),'')),not(equals(variables('error2'),'')))
Below is screenshot of when both errors are generated.
Below is a screenshot when 1 error is generated. The email will be sent in this case.
Below is a screen when the other error is generated. The email will be sent in this case.
Below is a screenshot when no error is generated. You can see that neither of the errors were set. The IF condition was completed and evaluated to False and no email will be sent.
Related
I want to create site workflow to send a reminder email to created by(emails) when Item created is more than 30 days and choice field called "Status" is "open". When someone has more than one items with status open in list then that person get one reminder mail only
Thanks in advance
Aside from the issues of maintaining multiple long-running workflows on a site, each item with an open status would need its own workflow so that when it was updated to any other status it could self-terminate.
To resolve prevent duplicate emails, there would need to be an additional list to track which user received a notification email along with the date/time. This list could be queried by a standard rest API call with $select=Id,Modified&$top=1&$orderby=Modified+desc&$filter=<userIdField>%20eq%20<ID> which would provide the most recent record and based on the date determine if an additional email was warranted. If there is no record of an email sent, then a record can be inserted to indicate that "this" workflow instance will send out an email.
It may be important to run this query a second time before the email is delivered to ensure that a race condition did not occur, but if found, the duplicate record with the newer time-stamp will delete its duplicate and self-terminate.
I have created a Azure Logic app to read the email body and check for the condition - If the email body 1st line has the only word called "Approved", then trigger another process or else do nothing.
But when performing it, I could see the condition gets to false even though the mail has only Approved word in it accommodated with signatures in the bottom. After researching, I could see the email is being read like HTML tags. So i created two more variable to extract a part of this e-mail and check for condition.
EmailBodyTrimmed = trim(substring(toUpper(replace(replace(trim(variables('EmailBody')),' ',''),'.',''),),0,500))
EmailBodyTrimmedFinal = trim(substring(trim(replace(trim(variables('EmailBodyTrimmed')),' ','')),0,indexOf(replace(variables('EmailBodyTrimmed'),' ',''),'<')))
But nothing seems to give correct answer. Can anyone help me ?
I think you can use Body Preview to receive the body of the email:
According to my test results, it receives the text in non-HTML format, so you don't have to extract the body from the HTML text.
Then you only need to add a condition and use starts with to determine whether it starts with approved.
Of course, this premise is that your email body is in plain text format, if it is in excel format, you need to do other processing.
I am trying to set up Gmail Push Notification to create a watch request for any new email received in the INBOX. So far, this is fine. However, I am trying to create a watch request as described here :
https://developers.google.com/gmail/api/guides/push#getting_gmail_mailbox_updates
I would like to set up a watch request for any email received from a specific email(info#abc.com) address having a subject line "[Important]" and having a PDF attachment.
Any idea if such a watch request can be set up?
Currently, I am reading all the emails from INBOX using imaplib received in the last 24 hours and manually search for emails having the subject line and attachment. However, I believe, this solution is not ideal.
Issue:
The only filter you can apply to Gmail Push Notifications is which label/s to retrieve notifications from, as can be seen here. Because of this, the filtering of messages depending on (1) who sent the message, (2) the email subject and (3) whether the email has a certain PDF attachment cannot be done at this stage, but after receiving the notifications. Luckily, though, there is no need to look for these messages manually, you can code your application to do that for you.
Workflow:
- Step #1. Set notifications for all INBOX and retrieve startHistoryId: As was said before, you have to receive notifications for all INBOX, since there is no more specific filter available. A call to Users: watch, providing INBOX in the labelIds field and the topic you created in topicName, will effectively configure the notifications. The response to watch has this shape:
{
historyId: 1234567890
expiration: 1431990098200
}
Where historyId refers to the mailbox’s current state. Let’s store it somewhere, and call it startHistoryId.
- Step #2. Get INBOX changes: After completing step 1, whenever there is a change in your INBOX, your application will receive a notification message describing the change. Whenever a notification is received, you want to get information about the specific changes made to the INBOX, and to achieve that, you should call history.list().
That is to say, your application should call history.list() every time a notification is received. Now, you want to get changes since last time, and that’s why you should provide the historyId retrieved in step 1 as the parameter startHistoryId. If you want to only retrieve new messages (and not deletions, or label edition/removal), you can set historyTypes to messageAdded. The request could be like this:
{
userId: “your-email-address”,
historyTypes: “messageAdded”,
startHistoryId: “your-start-history-id”
}
As a response, you’ll get something like this:
{
"history": [
{
"id": unsigned long,
"messages": [
users.messages Resource
],
"messagesAdded": [
{
"message": users.messages Resource
}
]
}
],
"nextPageToken": string,
"historyId": unsigned long
}
Here, you should retrieve historyId, which will be used as startHistoryId the next time history.list() is called, and messagesAdded, which contains the IDs of the new messages you want to look for (only ID and threadId seem to be populated).
- Step 3. Filtering messages: Now you have the list of message IDs that have changed since last time (messagesAdded), and you want to know which of them match your criteria. To know that, you’ll have to iterate through all IDs in messagesAdded and call Users.messages: get for each ID. This will return the corresponding message resource. For each message, you’ll have to check whether the criteria are met:
Sender email: inside the resource, access the headers (message[“payload”][“headers”]), and loop through them, looking for the one whose name is From. You have to check whether the corresponding value is the email you’re looking for.
Subject: as in step (a), access the headers and look for the header whose name is Subject. The corresponding value is the email subject. Check whether it starts with [Important].
Attachment: you’ll have to look for the email attachments in message[“payload”][“parts”]. The process is a bit more complicated, but see, for example, this related question.
Reference:
Gmail API: Push Notifications
I'm trying to do some validations using a user event script but I want to show user some meaningful error instead of the default 'suitescript' error at the end. Is there any way to do this?
User Events are server-side, so there is no UI in which to display a message. You cannot validate date on beforeSubmit and display a message. If you want to validate as the user saves and show them feedback, you need to use the saveRecord entry point on a Client Script.
You can do this via the beforeLoad entry point because it receives a reference to the Form in context, which has an addPageInitMessage entry. Check out the Help docs for this method to see if it will work for your case.
As #erictgrubaugh suggested you cannot use User Event for validation.
If you want to perform validation and stop form submission, you need to use ClientScript with saveRecord and you can perform all of your validations here. If current record does not passes your validation you show user error using N/ui/message with some description and if everything is correct return true.
To stop current record from being saved, return false from saveRecord.
Check this out to see how to use N/ui/message and this for further reading on saveRecord.
You can use "throw" to display error message on before submit.
I'm creating a workflow that does the following, and I'm looking for guidance on the best practices of splitting up a workflow into conditions and/or steps.
For the Projects list, each time a list item is created or modified, the workflow should run and do the following:
If Status = New, create a couple variables AND send specific email
If Status = Open, send specific email
If Status = Estimated, send specific email
If Status = Approved, send specific email
If Status = Ready, send specific email
If Assigned To is modified, send specific email to the Assigned To person or group.
If Status = Ready, and has been ready for more than 5 days, send specific email.
So for the first 5 items above, it seems to me they could all be separate conditions/actions within a single step.
For the Assigned To item, I think I'll need to have the primary workflow create a record in a new list, which would then trigger a secondary workflow to send the notification email to the Assigned To designee.
And for the Status over 5 days item, should this just be another condition/action under the primary workflow's step 1 or should it be a separate step?
In this scenario, I'm just not seeing any need for separate steps within the primary workflow. Am I missing something? What's the general thinking for when you should use additional steps in workflows, as opposed to just adding conditions?
Thanks!
I think I finally stumbled on the answer to my own question.
From what I can tell, in any step, the workflow will stop once a condition branch evaluates to true. So if more than one action needs to occur before the workflow is started again, then each of those conditions must be in it's own step. You can have a single step with multiple conditions of course, but only one of those conditions can evaluate to true.
Does this sound accurate?