Dynamics CRM - Register a plug-in when the user logs in - plugins

I would like to fire an event when the user logs in to his account on Dynamics CRM ? Such as opening a Web App beside the CRM... Is This possible ?
I know that I can write plug-in that allows to augment some business process such as account creation. Any advice will be appreciated !

CRM does not expose a plugin message for "UserLogon/UserAccess" on which you can register a plugin.
What you could do though is enable Audit User Access and register your plugin on Create of an audit entity and filter on the value in AuditAction (operation) and User Access Via Web (64) is the value you are looking for.
var entity = ((Entity)pluginExecutionContext.InputParameters["Target"]).ToEntity<Audit>();
if (entity.Operation.GetValueOrDefault() == 64)
{
//logic here
}

I think dynamicallyCRM gives a good idea, but if you are trying to open some website, plugin is not the option; it's meant to execute server side logic.
If all end users use the same homepage when login to CRM (let's say they are asked not to change it), you can set up a custom page as the homepage, and there you are able to add scripts to do whatever you want.

Related

Keycloak: how to send email to admin upon user registration / how to create a custom execution for sending email

I want to alter the User Registration flow to allow for emailing someone when there is a user registration. For altering the flow, this question provides an example.
However, in my case, there is no execution I could add out of the box to email someone other than the user. How can I go on to create a custom execution for sending email in order to send email to admin upon user registration?
Alternatively, I could start continuously polling the list of all users and diff it. This solution using the python-keycloak would be similar to what is described here but for my case, it seems both inefficient and cumbersome, the cron job would have to run all the time.
Any other way to solve this problem also welcome!
Unfortunately, I suppose this feature is not (yet?) supported
If i get your question correctly, you want to be notified by mail when someone creates an account? if so you can implement that in your code by checking for the keycloak response(200 or 201) after account creation and then you notify the necessary email. You can integrate with sendgrid.

Can I make a plugin to navigate the Web UI in Dynamics CRM

I am following the tutorial in:
https://msdn.microsoft.com/en-us/library/gg594416.aspx
to make a plugin for Dynamics CRM. It run on server side.
The plug-in creates a task activity after a new account is created. The activity reminds the user to follow-up with the new account customer one week after the account was created.
How can I extend this plugin to force the Web page to programmingly open the task that have just created?
You can't, the plugin runs server side and cannot interact with the user interface.
You would need to do something like add JavaScript that recognises when the plugin has completed and redirects the user.

Where to save user setting in an Office365 app

I am developing an app for Office365 (to be specific for Outlook) and I am having a question about where to keep the user settings.
This app is targeted for web version of Office365 as a result I hosted on a server. A user of Office365 can go to the store and install the app. However before s/he can use the app, s/he has to set a few fields to be able to use the add-on.
I am not sure if there is a way to keep the settings for a user.
You can use the RoamingSetting object API to save private data for your Addin for each user.
// Get the current value of the 'myKey' setting
var value = Office.context.roamingSettings.get('myKey');
// Update the value of the 'myKey' setting
Office.context.roamingSettings.set('myKey', 'Hello World!');
// Persist the change
Office.context.roamingSettings.saveAsync();
For more information, look at the documentation link provided above.
If you instead want to save data for your Addin for an email/calendar item (instead of for an entire mailbox), look at the CustomProperties object API.
Well, I guess since the app is hosted on my own server, and on the other hand, the user is already authenticated, I can keep the settings per some unique feature of user, e.g. username, by conventional methods in the server.

Why is CRM 2013 Online Plugin running under SYSTEM user all the time

I've built a plugin for Microsoft Dynamics CRM 2013 Online platform. The plugin is registered at Delete of my_custom_entity. It is synchronous and post-operational. Impersonation is set to Calling user. As far as I know the plugin should be fired with the calling user's privileges etc. with these settings.
I can't figure out why, but my the plugin is always run under "SYSTEM" user. I've tried to use two different system users with no luck whatsoever. It's kind of a problem because my plugin is calling a workflow and the workflow is sending an email. SYSTEM user can't send emails though.
Is this something new in CRM 2013? I tried to Google but couldn't find anything relevant. I already tried to unregister and register my plugin assembly again. No difference.
How can I change my plugin registration so that it would run on behalf of a user who fires the plugin (who deletes an entity).
Thank you
How are you obtaining your service reference?
If you do it like this you should get all the actions performed as the user who triggered the plugin.
// Obtain the organization service reference.
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
If you are passing a null value you will get the system user, e.g. serviceFactory.CreateOrganizationService()
IOrganizationServiceFactory.CreateOrganizationService
Specifies the system user that calls to the service are made for. A
null value indicates the SYSTEM user. When called in a plug-in, a
Guid.Empty value indicates the same user as IPluginExecutionContext.
UserId. When called in a custom workflow activity, a Guid.Empty value
indicates the same user as IWorkflowExecutionContext.UserId. Any other
value indicates a specific system user.
YOu should use context.InitiatingUserId rather.
IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
The InitiatingUserId will be the user who triggers the delete action. In Delete context, UserId will be System where the platform is using.

How to get all the users list in Kaleo Workflow on Assign to Combo box?

I am working in Liferay Portal. I have created my custom work flow and created the portlet to start the work flow. I am done successfully with this but I am facing one problem, when the user clicks on Assign to button from Workflow Tasks to assign the task to some other user the combo box which display available users, it only display the users who has the Administrator or Owner Roles.
As i have developed custom work flow in which i have defined my own roles, i wish to display the users with that roles in the combo box. I have searched a lot but not able to get the proper solution for this.
If anyone has any idea please kindly help.
For this you have to create a hook and you have to write the code in file named "workflow_task_action.jsp" within Workflow_task.....
In this file code for that combobox which you require is available.