Using a Workflow to auto-populate a form field upon creation in CRM 2011 - dynamics-crm

I would like to have a field automatically be populated with something I define in a workflow. Currently I have the workflow running upon record creation, however the field is only populated AFTER the user saves the record for the first time.
How can I use a workflow to populate that field before the user saves the form?

You can't. Workflows function on the server-side, but you're asking about populating a client-side field before the server is contacted. Moreover, workflows are triggered asynchronously, which by definition means the record has to be created in advance.
You'll need to either attach a JavaScript function to the OnSave event, or trigger the population of the field in a pre-validation or pre-operation .NET plugin. I suppose you could use a Dialog as well, but that would require user input. See the below links for more detail on the differences between plugins, workflows, and dialogs.
Options: Plugin, Workflow or Dialog
Automate Business Processes in Microsoft Dynamics CRM

Related

Passing description from browser in elsa

In document workflow, after I reject/approve the document in the mail, I want it to take to the browser where I can add a comment in the comment box and then pass that comment back to the employee through email. How can it be done?
I have tried adding comments in console and pass it through mail.How can it be done in UI designer?
#vahidnaderi is spot-on:
In the workflow from where you send the email containing the approve/reject link(s), have these links point to a custom webpage you create.
This webpage contains 3 fields and a submit button:
A radiolist with an "approve" and "reject" radiobuttons
A "comments" textarea.
A "workflowinstanceid" hidden field that stores the workflow instance ID.
When the form is submitted to your backend application, you trigger a signal ("approve" or "reject") for the appropriate workflow instance ID and provide the comment as input.
Your workflow will resume and the received comment will be available as input to the first activity that comes after the "signal received" activity.
That activity should either be the "send email" activity or a "set variable" activity in case you want access to the received comment later in the workflow.
From the "send email" activity, you can now access the comment you wish to include with the email.
Obviously, you're completely free to do things differently. For example, perhaps you want a separate page for "approve" and another page for "reject".
The key takeaway here is that you provide your own web UI. This web UI then interacts with your application backend (i.e. by submitting a form to a controller), which then interacts with Elsa services to e.g. trigger workflows.

How to create a custom notification in Dynamics

I am looking in to creating a notification function in Dynamics 365, and to find the best solution, I have began with searching for the possibilities (Javascript/C#/All others). Example: Sending a user a notification that a new lead is created.
Edit:It should be generic and easy to add a new notification. So maybe it should be a workflow step, or connected to an entity.
Email notification is already integrated in Dynamics 365
Microsoft Graph has a Notification possibility (Only in Beta)
https://developer.microsoft.com/en-us/graph/graph-explorer#
Create a custom entity which. And on dashboard add a Web Resource (Javascript) that looks through the entity to find if there are any Records on the current user. If so make a popup.
Use Chrome extension to notify user.
(Example: https://community.dynamics.com/crm/b/bruce365usingdynamics/archive/2017/11/02/announcing-365-notify)
Is there any other possibility you know of?
Or do you have any experience with any of these. What one should go for or not.
Your best bet is Dashboard with Posts in Timeline/social pane. This just need couple of configurations like Post rule, Timeline embedding in Dashboard & user training.
Activity feeds
Activity Timeline
If not, timely workflow or MS Flow to send a digest notification.
I would say if you wish to go code less solution then use Workflow
and place trigger as you wish. Send an Email to Either team or
particular user from this workflow. Just set regarding in Email as
Account or Contact or any entity from which you have an Trigger. By
this way You can see all these notification in your Social pane
timeline as well.
If you need some custom logic, Use plugin but in turn call a
workflow which will be onDemand workflow and this will only be used
to send Email.
There can be different Ideas as well. But we have this in place on one of our productive system and it fulfilles requirement of Notification very well.
Since you specifically want to interact with users within the CRM system, there are a number of simple approaches:
Task Queue (Passive) -
Create task records within CRM (these can also sync to Outlook if you want to get fancy). Users review a queue containing all of their tasks. You can similarly assign tasks to teams of users. I recommend this approach for CRM oriented users who have a number of different tasks.
View/Report/Dashboard (Passive) -
Create views of records requiring action. Users then review these views on a regular basis. I recommend this approach for non-time sensitive tasks, and tasks executed in bulk across many records.
Email (Active) -
Create a workflow with a Send Email step. This is easy to do but could generate a lot of emails which the users may then ignore. I only recommend this approach for rare notifications, or those requiring urgent action.
Emailed Reports (Active) -
A hybrid of the second and third approaches, there are third party solutions that will email view results to users on a scheduled basis. This would be my recommendation if you want an active approach without spamming users constantly. These are easy to install and configure and entail a small cost.
In addition to the many viable options offered above (a few of which I was unaware), if the user's daily responsibilities include working with Leads, you might want to keep it super simple - create a My New Leads view and instruct them to check it throughout the day. You could even place this view on a dashboard, making your option 3 redundant.
If the user rarely needs to concern themselves with Leads, the need for a notification strengthens. Assuming that the Lead volume will not flood their inbox, in the interest of simplicity you could start with a workflow email notification.

Plugin is not triggering on User Enable/Disable

I am using Dynamics 365 Online Trial. I have a requirement to trigger a plugin when the user is disabled/enabled in CRM. So I have created the plugin and registered the same in User entity SetState and SetStateDynamicEntity messages but the plugin is not triggered.
Plugin Registration Steps:
Message: SetState & SetStateDynamicsEntity
Entity: systemuser
Event: Post-Operation
User records have been Enabled/Disabled in CRM (through O365) but the plugin is not triggered.
Also tried with update message plugin for the same requirement, but that is also not triggering the plugin.
Updated Plugin Registration Steps:
Message: Update
Entity: systemuser
Event: Post-Operation
Filtering Attribute: All Fields
Image: Pre Image
Any help would much be appreciated.
You are on the right track to be using the Update message, as the use of SetState is deprecated (as far as I know).
You might find this article interesting. It states:
When update requests are processed that include both state/status
fields plus other standard fields, workflows registered for the Update
message execute once for all non-state/status fields, and then once
for the state/status fields. Workflows registered for the Change
Status step continue to be triggered by updates to state/status
fields.
However, users may be a little different as they have the isDisabled field. Maybe try filtering the trigger to just that field. And if that doesn't work, try triggering on a "regular" field just to make sure that you plugin can fire on the Update message.
Full disclosure: I have never had to write a plugin that fires on disable of a user.
However, since it does not seem to be firing when filtered down to isDisabled, I checked to see if an OOB workflow could trigger on that field. It is missing from the selection dialog, so apparently not:
You might want to get a Microsoft support ticket going to see what they say, but in the meantime, perhaps register it to trigger on ModifiedOn, with a pre-image and check for yourself whether isDisabled changed.
We also experienced this issue, we were unable to achieve the plugin route.
Then we did a workaround scheduled job (to run every 24 hours) with SSIS + Kingswaysoft package to query the disabled users.
This system user status change is not getting trapped in Dynamics platform as we are not sure how the O365 changes like license removal or AD changes like account removal is getting replicated into Dynamics platform.
You can try registering a plugin on Update of userlicensetype is SystemUser entity

Where is the Update Event step in Dynamics CRM 365 process workflow editor?

Goal:
Show total sum of Activity entities related to Project entity in a form field named Total Activities in Dynamics CRM 365
Following these guys, for our Project entity's form edtior, we've created a normal Whole Number field named Total Activities.
As suggested in the blog, we've Created a workflow process to run on Activity entry entity:
with a name Activity counter:
which will be activated as a process when
Record is created
Record status changes
Record is deleted
We've reached to Step Properties:
The blog says the following:
In the Update Event step, increment the attendee count by 1, and the Total Revenue (Event) field by the Fee field from the Registration record.
We're not able to see that Event step thing anywhere in the process editor.
How to get to the following screen?
Use rollup fields
In Microsoft Dynamics 365, rollup fields are designed to help users obtain insights into data by monitoring key business metrics. A rollup field contains an aggregate value computed over the records related to a specified record, such as open opportunities of an account. Also, you’ll be able to aggregate data from the activities directly related to a record, such as emails and appointments, and activities indirectly related to a record via the Activity Party entity. In more complex scenarios, you can aggregate data over the hierarchy of records. As an administrator or customizer, you can define rollup fields by using the customization tools in the Dynamics 365 Web application, without needing a developer to write code.
The steps you are following are for Real-Time Workflows. You should UNCHECK the "Run this workflow in the background (recommended)" checkbox in order to see the the Update Event Steps. The items in the red square box are the Update Event Steps

Addressing the customer by their first name in CRM 2011 email templates triggered by Service Activity workflows

If a customer schedules a service activity using my web application and I want to send them an automated confirmation email, it seems I have two options:
Have the workflow create and send a new email message. On this view (see below), you can use fields from related entities on the service activity (e.g. the customer's first name).
Have the workflow use an email template. It seems that email templates do not allow you to access fields from a related entity, like first name, so the only option here is to address the customer by their FULL name.
Are there any solutions that I missed, or am I stuck with the first option if I want to address the customer in a personal, natural way on this automated email?
Unfortunatly, the CRM is pretty limited on that aspect. The best workaround is to add the firstname to the Service Activity entity. May suit you or not. Otherwise, it is achievable through a the SDK, but that's much more complicated if you don't already use it.

Resources