Possible to filter audit log by recently changed field - dynamics-crm-online

Morning-
I have an entity with auditing enabled, and would like to be able to search that entity based on whether or not a field value has been changed in the past week.
In the audit summary view in Dynamics online, it does not appear that I can achieve that. Is there any other way I can get the functionality short of coding?

You can't do this exactly, but you have a number of options to approximate this:
1) Only turn on auditing for that particular field
2) Filter for Update Event and you can filter down to that particular entity
3) Set up a workflow that runs on the update of that field only - then look for those records where that workflow is a related record

Related

Is there a way to disable the audit for stageid field on a CRM entity that's enabled for auditing?

Got a custom entity which has auditing enabled. Every time an user changes the stage on the Business process flow (BPF) on that entity, it's generating an audit log record with the change in the stageid which is irrelevant for the business and i cannot use the modifiedon field since the stage change is changing the modifiedon field data as well, which makes the data irrelevant for the business.
One idea would be to create a field called Business Data Modified On. Then, create a workflow that runs on change of the fields you consider to be business data and have the workflow set the new field to the current time.
It does not appear that Auditing can be disabled on the managed field StageId.

How to show records related to upper records too in a subgrid?

How can I build a subgrid that displays related records both of the current record and records above it, and can it contain complex conditions ?
One of my requirements is this:
I want to put a subgrid in Account form showing the related Contacts of the current Account, and also include the Contacts related to Accounts above the current one if a Two Options attribute of the contact is set to Yes.
Specifically, I'm looking at the Company Name on Contact to establish it's related to an Account.
I'm at a loss and start to doubt it's doable.
Not an out of the box solution but if you don’t mind losing the sub grid command bar functionality you can use the following concept that displays a fetchxml inside a sub-grid.
Step 1 - would be to get all related accounts ids using a fetch or odata
Step 2 - construct a fetchxml with OR filter to get all contacts

advanced duplication detection & actions in dynamics CRM

I'm new to dynamics CRM, and I'm wondering if, and how, the following scenario can be supported:
When a record is created / updated, I want to be able to define how to find duplicate records.
If a duplicate is found, I want to be able to define automatic actions based on the new record's properties.
(for example- when a case is created, check for duplicate cases based on 'customer' and 'owner' fields. If a duplicate is found, then: if the duplicate case's status is not 'active' then go ahead and create a new record. otherwise- update some of the existing record's fields based on the new record).
The first part can easily be accomplished using duplication detection settings, but I don't think they allow for any complex logic when a duplicate is discovered.
The second part can easily be accomplished using workflows. however, I don't think that they offer conditions that check other records. I've looked into customizing workflows, but all I could find was how to customize actions, and not conditions.
Does dynamics CRM offer any solution to this type of scenario?
Yes, it does. You can accomplish this using CRM plugin. It should be Pre execution plug ins registered on Create and on Update events.

How can I tell if an entity is disabled in Dynamics CRM 4.0?

In Microsoft Dynamics CRM 4.0, I want to be able to check if a record of any entity type is disabled. I think I can check the statecode. From the information I have seen, a value of zero means that the entity is enabled (editable in CRM) and any other value means disabled (for editing in CRM).
Is this assumption correct for all entities?
EDIT
If my assumption is correct, is it possible to create a QueryExpression for dynamic entities that does such a comparison, rather than using the text, "Active", which would be incorrect for quotes?
From what I've read, StateCode is not necessarily the same for every entity. It varies per entity.
I'm not aware of a way to disable an entity. I double checked our install, but don't see any option to disable. Google also yields no results to this end.
Do you mean perhaps individual entity records? If so, you'll have to check the StateCode for the entity you're looking at. I think most entities use StateCode as you describe, but for some entities, such as Activities, it seems to vary a little.
Here is some SQL I found to pull back the StateCode/StatusCode details of a particular entity:
select
AttributeName,
AttributeValue,
Value
from dbo.StringMap
where
(dbo.StringMap.AttributeName = 'statuscode'
or
dbo.StringMap.AttributeName = 'statecode')
and
dbo.StringMap.ObjectTypeCode = 1
ObjectTypeCode 1 maps to the Account entity.
Hope this helps.
EDIT: Just saw your addition. I think you'll be safe using StateCode in most instances. I personally use it in one of my projects to exclude disabled records on the Lead and Contact entities. Just double check the value mapping as I've described and then implement.

MS CRM 4 - Custom entity with "regardingobjectid" functionality

I've made a custom entity that will work as an data modification audit (any entity modified will trigger creating an instance of this entity). So far I have the plugin working fine (tracking old and new versions of properties changed).
I'd like to also keep track of what entity this is related to. At first I added a N:1 from DataHistory to Task (eg.) and I can indeed link back to the original task (via a "new_tasksid" attribute I added to DataHistory).
The problem is every entity I want to log will need a separate attribute id (and an additional entry in the form!)
Looking at how phone, task, etc utilize a "regardingobjectid", this is what I should do. Unfortunately, when I try to add a "dataobjectid" and map it to eg Task and PhoneCall, it complains (on the second save), that the reference needs to be unique. How does the CRM get around this and can I emulate it?
You could create your generic "dataobjectid" field, but make it a text field and store the guid of the object there. You would lose the native grids for looking at the audit records, and you wouldn't be able to join these entities through advanced find, fetch or query expressions, but if that's not important, then you can whip up an ASPX page that displays the audit logs for that record in whatever format you choose and avoid making new relationships for every entity you want to audit.
CRM has a special lookup type that can lookup to many entity types. That functionality isn't available to us customizers, unfortunately. Your best bet is to add each relationship that could be regarding and hide the lookups that aren't in use for this particular entity.

Resources