CRM 2011: Plugin to update Incident on new activity added - dynamics-crm-2011

I have a requirement to create a Task when a new activity as added to an Incident (Case). I Think can be achieved by triggering a workflow on Activity Creating and check the regarding field. If regarding entity is a Case then run a custom workflow activity to create task.
I think running workflow on each activity creating might be bit overkill. Is there any way to create a plugin to trigger on activity added to Case?
Thanks

You can create plugin that will be triggered after activity is created. But you will have to validate that activity was created related to case in the body of the plugin.

Related

Set custom Workflow to run daily in CRM 2013

I have written a custom work flow which is registered on account entity . I want this workflow to run daily to create tasks. the workflow works fine when i register it on record created . but it does not trigger when i schedule it for every day. like after 24 hours it should trigger automatically by itself
any one can help plz
Two workflows:
Parent who runs on creation and triggers child.
Recursive child who triggers the custom workflow activity.
Parent workflow definition.
Child workflow definition. Extra validation step added to stop scheduled process on condition. Needs to be updated to your needs, of course. Status can be set to Cancelled for clarity.
Notice that the timeout is after the initial execution. This is by design to allow the custom activity workflow to run as soon as the child workflow is triggered by the parent workflow.
As an alternate answer to what #denious is offering, you can use the CRM Workflow Automation Tool. It works on both CRM 2011 and 2013.
This works different in the sense that it does not use Workflow timeouts to accomplish a daily run, rather you set it up as a Windows Scheduled Task (likely on your CRM server) and have it run everyday at a set time.
Setup is minimal and the tool allows you to specify a FetchXML query to retrieve the appropriate records and then a Workflow to execute against the returned records.
A few nice things about this approach:
You can schedule all the tasks to run at the same time (for example 6 AM daily) as opposed to it being run based on whatever time the workflow was originally initiated.
Once the workflow is run there are no lingering workflow instances just running a timeout.
No need for a parent/child workflow setup. You just need a single workflow which does the respective action.
Because it runs on the Windows Task Scheduler you can do things like omit running on weekends where you cannot do this on CRM (without additional tools/rules).
Ultimately, both will accomplish the same thing but this is just another option to consider.
Solved it after spending a week in it...
you should first start it manually by going in a record of the primary entity on which you have added your custom workflow
follow the steps below.
1) Register required steps
2) select record of the entity
3) click on the three ellipses button shown on the ribbon of CRM.
4) click on run workflow
Example
let' say my primary entity is account on which my workflow runs.
1)go to account entity
2)select a record
3)click on the three ellipses button on shown above on ribbon for every selected record
4)click run workflow
5)done

Workflow on "Activity"?

I'm trying to have CRM 2011 share activities to a Team if the user that created the record is part of another team.
Firstly, is it possible to create either a custom or basic workflow on "Activities" instead of having to create a workflow on each type of activity (Appointement, Phone Call, E-mail, etc.) that does the same thing on each of them ?
Secondly, I see the basic workflows wizard allows you to Assign activities to another team, but I don't see the Share action anywhere. Is this a job for a custom, .NET assembly, workflow ?
Thank you!
You need to select the exact entity when you create a workflow, this means you need to create a worklow for each activity entity-type (1 for Appointment, 1 for Phone Call, ...)
There isn't a built-in share functionality inside the standard Workflow designer, you need to use a custom activity (create one using .NET or install one already compiled)
Check these two:
http://crm2011workflowutils.codeplex.com/
http://crm2011sharestep.codeplex.com/

How to edit Workflow steps via API?

In my solution I have a workflow where one step contains a reference to Queue. After importing this solution on another CRM instance this workflow could not be activated because it contains an invalid reference - Queue can not be resolved. Queue with same name is created on new CRM but resolving is probably based on record Guid.
Now, I'm wondering, is there a way to edit workflow steps using CRM SDK? Whole process of CRM solution deployment is automated. And I want to remove all manual work. Some example would be great :)
Thanx in advance!
There are 2 things you can do if you are having issues with the Guids not matching in a workflow lookup when deploying from one environment to another.
Use the API to create those records referenced in the WF. When you create a record you can actually specify the Guid that it uses as the id. So write a tool or see if one exists already that will create some default data for your environment.
Use a configuration entity with references to all the EntityRefrences needed in your WFs. Then you can create a custom workflow activity to retrieve the configuration entity record (there should only ever really be one) that contains all the references in that environment.

Dynamics CRM 2011 Online - How to total the duration for activities

I have a requirement to total the durations of all activities related to a custom entity. I have created a custom entity that allows the user to add activities for that instance of the custom entity. Every time an activity is added to the custom entity I need to total the duration and update the custom entity. I started by creating a plugin for an activity. The problem is the only messages you can create the plugin for is retrieve and retrivemultiple. I then went to service activity to create the plugin and I cold create it using the create message.
My question is, is every activity a service activity? Has anyone done this and do you have any tips on the best way to go about it?
Thanks,
Gary
It sounds like you are looking for a plugin or custom workflow that operates on the “parent” entity (the entity the activities are related to.) You would write your code to use the RetrieveMultiple method and then loop through the result totaling the value as you go.
IOrganizationService.RetrieveMultiple Method
http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.iorganizationservice.retrievemultiple.aspx
Rolling Up Custom Entities in Microsoft CRM 2011 and CRM Online
http://www.catapulterp.com/rolling-up-custom-entities-in-microsoftcrm-2011-and-crm-online/

Plugin on Create of Phone Call not firing for Distribute Campaign Activity

We have a plugin registered on Create for Phonecall which triggers fine when I create via the UI or from within another plugin. However, it never fires when Phonecall records are created as part of a Campaign Activity (bulk operation).
I've found an MSDN forum post that discussed registering in the child pipeline but this is no use for CRM 2011.
Can anyone confirm if this is expected behaviour and if possible what messages I could register for as a workaround. Minimising changes to the existing plugin code would be a bonus.
Plugin was registered in Stage 10 Pre-Validation. Registering in Pre-Operation or Post-Operation and it fires correctly on create and importantly for us distribute campaign activity.

Resources