Send an email (using flow) when the text field changes in PowerApps - sharepoint

I have a PowerApps App which is linked to a SharePoint List. When the user makes some changes to the text field in the app; I want the flow to send the user an email regarding the update.
I've been trying to track the SharePoint List entry and see if the entry is modified, then send an email. But so far I'm unable to do so.
I've been able to send an email when a text field changes to a specific text; but I'm looking for something where a particular entry in the list is changed.
When an item is created or modified > Condition (Column is equal to Yes) > Send email based on the condition

You don't need Powerapps for the same, what I mean is you need Flow for this.
Create and Run your flow on SharePoint directly.
In your flow check whatever your field is changed, if changed then you can send the user email.
You do not need to depend on Powerapps, Flow can alone work for this scenario.

Ensure you are using the Sharepoint When an item is created or modified Trigger in Power Automate (the tool formerly known as Flow)
Add a Trigger Condition for the column in question. Something along the lines of #triggerBody()?.Status,'Pending')
Trigger Conditions are not very well documented at the moment, but provide a powerful way to control when a Power Automate runs.

Related

Kentico 10 - Custom action on page update

I am looking to perform a custom action when a content editor in Kentico 10 updates a page and it eventually gets published.
To be more specific we have a custom page type for products which also as an "Updated" checkbox allowing the editor to mark it as updated. When this happens (gets marked as updated) I would like to send an email out to users that have a registered interest in this product that it has been updated.
I was looking through the documentation and came across Global Events here: https://docs.kentico.com/k10/custom-development/handling-global-events/reference-global-system-events#Reference-Globalsystemevents-DocumentEvents
I was wondering if using global events to intercept the save action when the editor updates the product is the way to go here or if there is a better approach.
Kentico does n't have this functionality out of the box, but we can achieve this by writing Custom code for Global Event and a scheduler (if No.of mails is large)
Recommended steps:
Attach custom code to Global event handler while publish specific document publish after event
public override void Init()
{
// Assigns custom handlers to the appropriate events
WorkflowEvents.Publish.After += new EventHandler(DocumentPublishCustomEvent);
}
In the custom code, if required page is published then make entries into custom table for email to be sent [This step is optional you can send mail from custom event handler directly if only few mails to be sent]
3.Implement custom scheduler to pick the user info from custom table and send email to user.
Note: Ideally you can use email Template for send emails
Using Global events is one way of doing this, another way would be to use Kentico's Advanced workflow engine (If you have the EMS license):
https://docs.kentico.com/k10/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows
You could create a custom workflow step and action which the editors would put the page into and which would send emails to interested people - https://docs.kentico.com/k10/managing-website-content/configuring-the-environment-for-content-editors/configuring-workflows/designing-advanced-workflows/creating-custom-action-workflow-steps
If you do not have the EMS License, using Global events seems like the way to go, but I don't see the updated flag field as necessary, you could easily check in the global event handler if the product arrived at the "Published" workflow step in the basic workflow and then send the email to the interested parties.

Plugins for incoming and outgoing emails in CRM 2011

I need to create two plugins for CRM 2011
Whenever an email is incomging or outgoing I need to check if the email has any attachments in it. If yes I need to set one boolean value to true.
When user (user only, not workflow or automatic message etc.) answers some email I need to fire a plugin that checks incident's status (email is regarding to an incident) and depending on the status do some things.
I'm not really familiar with this whole email tracking concept. We have an email router configured, but that's all I can say.
What are the steps that I need to use in order to achieve plugins described?
For the first plugin I think "Create of email" is enough, right? What about the second plugin and how can I make sure that plugin is fired only when a real person sends an email?
For the first plugin:
To check for attachments for an email you will need to create a plugin which executes on create of the ActivityMimeAttachment entity, which is the entity which stores email attachments.
When an inbound email is processed by the Email Router (or tracked in the Outlook Client) the parent Email record is created first, and then an ActivityMimeAttachment record is created for each attachment.
If you try to check for attachments when an Email is created it will be executing before any attachments are created. However, you may also need a plugin to execute when an Email is created to set the 'Has Attachments' field to false.
The plugin on ActivityMimeAttachment will need to get the parent email activity and set the 'Has Attachments' field to true. This will handle both inbound and outbound emails.
Also note that for 100% accuracy you may need to consider the scenario of a user who is writing an email and adds an attachment, and then deletes it. This could be handled by a plugin running when attachments are deleted, but that logic can get complex (what if two attachments were added but only one was deleted?)
There is some useful sample code for dealing with the ActivityMimeAttachment entity here.
For the second plugin:
A plugin which executes on update of an email would then need to validate the following criteria:
The email direction is outbound (a user has answered an email, e.g. sent a reply)
The email status reason is Sent (the email has actually been delivered and is not saved as a draft)
The email sender and/or owner and/or created by is a real user (filter out automatic and workflow sent emails)
The regarding object is an incident
Then you can implement the required custom validation and logic.
The second item could potentially be achieved using a standard workflow, depending on how complex the custom logic is. If the logic is too complex for a standard workflow, a custom workflow activity might also be useful since additional logic or validation could be added without writing additional code.
For the 1. Plugin: Register on email create and on update (maybe users create the mail first and then update some attachments later)
For the 2. Plugin: Check the following:
plugin context depth should be 1 (this makes sure that no mail created by another plugin is processed)
Check the created by and created on behalf by fields on the email entity to be a non technical users and that no one is acting on behalf of another user creating this mail
Check that regarding object points to incident
If this is not sufficient enough and the users sends mails only via CRM Web GUI you can additionally set a special flag on the record via javascript to make sure that the mail was created using the gui. Than check this status flag in the plugin.

How to create action hotspot in UI document

I've got some nice little LotusScript that I can put into the Click event of an Action Hotspot in a rich text field when I'm sending an email manually. Is there a way to programmatically create that in the UI?
My script determines the user's home server and then opens a specific document in the replica of a training database on their home server. I could create these messages with hotspots manually and provide them to the folks who want to email them out. Of course, time being money and the task being boring, I'd rather automate it. I know that I could do this by using a stored form, but am wondering if the greater capability exists, as I can see further applications for it.
One trick I used in the past was to create a profile document in a database, and store some rich text in a field on that profile doc. Then when I needed to programmatically send an email, I could get that rich text field from the profile doc and use AppendRTItem to get it into the body of an email. That should work with any type of rich text, including hotspots.
Note: this won't work in the UI to populate a new email. It does work if you are generating the emails completely in code, though.

What structure should I use for an approval workflow?

This is a common problem that I find when programming a Lotus Notes App.
Use case: An employer fills out a request form in a Request database. A notification gets mailed to the person that may give them OK or REJECT for that request. The authority person visits the Request database and gives OK or REJECT.
Good. But, where would you save the approval status OK or REJECT:
Should the authority person have write access to the original request
and set the status directly (and may alter other data in the form)
Should the aproval action create a response doc to the original (and i cannot show in a view the current status)
Typically you are better off setting an approval status directly on the request. That may not seem initially ideal, but remember Lotus Notes isn't like a relational database where things would be more normalized.
Let's consider the alternative, putting a status in the response document. Now how do you show all the requests with their statuses? You'd probably have to write some code just to do that when with the first option you could just create a view.
You can control the access to the document using reader and writer access fields. See how the built in template does it (the approval workflow template). Essentially as the document changes state (i.e. New, Submitted for Approval, Approved or Denied, etc), you can also change the reader and writer access fields at that point.
Once, I designed a database that mailed that request to the approver with the form stored in the document. As long as the user accessed the document using a Notes client, they could click on a button in the message to approve, which would send a message back to the database with the field data to mark the request as approved. An agent in that request database was set to run when new mail arrived, read those messages and change status on the original requests. That way, the approver never had to leave their inbox and didn't even need rights to edit the request.
You could do it with URLs if the users would be approving via browser client - have the link to an agent and pass in the parameters.
Or, to go back to your scenario, once the requester has submitted the request, don't display the fields that you don't want changed, display the values as computed text instead.
Anyway you look at it, best to have the approval recorded on the original document.
For above, Everything is our concern. In SQL or any other RDMS, we are in need of normalize that. Similarly here we have view categorization, show response document in hierarchy, and a lot of great hide when functionality based on role, ACL, unique person and whatever you need. We can easily manipulate the data render depends on the current user.
For your Q:-
1. We can control the appropriate user[authority person] from editing the request form's item.
2. We can also do by the response document. There we can show the documents in view by using show the Response documents in hierarchy.

How to access the uiserID of the user who initiated a workflow

DUPE: See link below
I have a SharePoint Designer workflow and I need to send an email to the user who initiated the workflow. It is set for manual start only so it should always be running in the context fo a particular user.
I cannot see a SharePoint Designer action to let me do this, only to get the user who created the list item or by accessing the 'Modified By' column on the list. Neother of these is guaranteed to be the user who is calling the workflow.
Found the same question posted before. It appears to not be possible but the code for a custom workflow activity can be found here.

Resources