CRM 2011: How to call Workflow activity on relationship entity - dynamics-crm-2011

I have a relationship entity Fixture_In_Series which holds a relationship between FIXTURE and SERIES entity. Whenever any new fixture is associated/linked to a series a new record is generated in fixture_in_series.
I want my custom built Workflow Activity to fire whenever a new Fixture is associated to a Series and then it will do a job.
I can see Fixture and Series entity in the list when creating a new process but obviously Fixture_In_Series is not there as it is a relationship only.
Thanks for any suggestions.

I believe associate event is not possible to attach.
So i suggest you to use the OnUpdate\OnCreate Entity event and check if the lookup field Fixture has been filled.

From what you are saying it sounds like you are using a native many to many relationship between Fixture and Series. These entities cannot trigger workflows.
Two options that I see. Change your workflow to a plug-in and trigger it on the associate event.
Or, re-create your relationship as a custom many to many relationship. This involves you creating the intersection entity yourself, then you can trigger workflows on the update/create of the records in the intersection entity.

Related

DDD: It's correct to use Domain Events to guarantee invariants consistency? Do I have alternatives?

In my domain model I have the project entity (which is also aggregate root) which has products entity as child. One of the invariants of my domain model is that I can't have two products with the same code children of the same project (but is ok if the project is different).
My products are composed by parts which also has a similar rule (every part must have unique code within the same product) so parts are child of products because I need to ensure that rule. Children of product are also the activities that I need to do to create it because I'm describing a production tracking system.
Now, activities can have subactivities which can be assigned to factory area and so on.
Substantially what I have is that all entities starts from project just because I need to ensure one invariant(=business rule) but is not the best solution because every time I need to retrieve an entity I need to fill all the project (which can have 2000+ products).
What can I do to split that preserving my invariant but also freeing me to load a specific activity (or product) without retrieving all products of my project every time I need a child entity?
Should I need to split the Entities in several AggregateRoots, maintaining in the project a list of ProjectProductValueObject(string code) and use Domain Events in Aggregate's constructor to fire something like ProductCreatedEvent which try to create and add a new ProjectProductValueObject in my project using the AddProduct(ProjectProductValueObject product) method which contain my business rule and throws an exception if that's not satisfied? Is that ok and compliant to DDD principles?
Do I have other alternatives?
I have the feeling that you're overcomplicating the model.
From your description I've understood that:
Projects are root entities that can contain a list of
AssignedProduct, that is another root entity that contains a binding between the project (its id, see as a value object) and the product (I see it also as a value object)
So on with object and assigned object
In this way you've several Products that could be assigned to several Projects, but only the ones stored in AssignedProduct are valid. To avoid multiple assignments is just a matter of checking if the same couple of objects are already bound together.
If this doesn't match your model, ignore it.

How to add columns to ListMember table in Microsoft CRM?

For the n:m list membership, Microsoft CRM uses an intersect table called ListMember. With a solution/plugin I need to attach new columns to this table. I know that I could create a new entity with this and keep it in sync with ListMember, i.e. creating one whenever a member is added to a list and modifying it when a member is moved to a different list, etc. But that's quite a lot of overhead I think.
Is there a way to attach new fields to to the ListMember entity in CRM 2011?
Source: How to integrate with Dynamics CRM Marketing Lists with a plug-in
If you need to have additional fields for a many-to-many relationship you must create a manual relationship (by creating an intermediate entity.) This is not an oversight, it is in the Dynamics CRM training material.
As for Marketing Lists, you shouldn't be trying to add more information to this relationship - it is a flaw in the solution design/architecture.
You wouldn't need to keep anything in sync. Use Dynamic Marketing Lists and they will be kept in sync. The only purpose of a Marketing List is to create the activities for a Campaign/Quick Campaign. If Marketing List membership is being used for another purpose that is a solution design issue that needs to be resolved.

Analyse IncidentResolution in Incident

I would like to analyse the data from the entity IncidentResolution with the data from the entity Incident. So I just went on analysing the entity Incident and tried to make a new view, so I could add the field from IncidentResolution, but it is not possible. I think the IncidentResolution entity is somewhat linked to the entity Incident, but I can't say for sure.
So my question is: how do I access the data from one entity in another entity?
What do I need to configure to be able to see the data from the entity Incident with the data from IncidentResolution together in one line?
btw: sorry if my english is bad, it's not my native language.
An IncidentResolution is a type of Activity.
You can query it via Advanced Find by looking for Activities and then setting a condition for Activity Type = Incident Resolution. From here you can pull in Case information (for display or filtering) from Regarding (Case) in the "Related" section of the field chooser.

DDD entity VS service

I have a class called TicketIssue, it has the properties:
idPrimary
idGroup
idModel
weight
briefDescription
The logic behind calculating weight is quite complicated and requires querying other entities. Do I:
Inject those other entities into this one (yuck)
Query a repository for those entities in this entity (not much better than injection?)
Implement a service which calculates the weight and then sets it on the entity before being persisted
Implement an event
To add to this question, this entity also requires some robust logic when a ticket is created... notifying intended parties via email etc.
Implementing an addNew() in this entity doesn't feel right, should I have a service (or factory?) that persists the entity and fires off emails, and kick starts the workflow???
I think, you can use an event, on creating the record.
On the event, you can call a service to calculate weight.
So the event will act as a trigger, that will do a bunch of automatic things.
Inside the event (or "code-trigger"), you can use a service to calculate or process several things.
Thank you,

BCS association of external entity to self

I have a BCS model in SharePoint. This model has a single entity that should have multiple child entities of the same kind. I tried to associate the entity to self but the association does not appear on the entities' forms in the list. I expect to have a user experience that is similar to having a lookup field in a generic list that looks up to the same list.
How can I implement this?
Thanks.
The best solution I found so far is to create 2 different entities, create an association between them and make these two entities return data from the same source (in my case a .Net class).

Resources