I need to write a plugin where I have to check if a particular record has any file attached.
When I remove any file from a record it gets soft deleted.
I check Annotation table in SQL server, but is there any flag that denotes the entry is soft deleted or not?
Dynamics CRM 2011 does not have a soft-delete. When the record is deleted in CRM there is a DELETE executed on the SQL server, resulting in the record being removed.
In an annotation, which is the entity for Note, an attachment is stored as bas64 encoded text. If you delete an attachment on a Note it results in an UPDATE to the annotation entity setting the fields related to the attachment to null.
If you want to trigger a plugin when an attachment is deleted you need to look at the both the delete and update events on annotation. If you want to know if the annotations related to a particular entity has an attachment you need to query annotation entity where objectid matches the entity and filename is not null.
For emails and appointments attachments are stored in activitymimeattachment instead of annotation.
Related
I'm using KingswaySoft for CRM maintenance. I'm using CRM Destination block for upsert (update or insert) based on non id attributes and need to link this entity in different entity.
When record is created id is returned as CrmRecordId (and IsNew is true) and linking this entity is easy.
How do get entityid in case of IsNew is false (existeing record)? CrmRecordId is empty and I did not found the way to get the entityid.
Make sure you use an alternate key for doing UPSERT operation (I believe you're doing it already), if it still happens you may need to raise a support ticket with KWS support.
CrmRecordId: It will return the GUID of the record irrespective of Update or Create and IsNew will specify whether the record is newly created or updated.
Reference
I have an error log file that contains a GUID of an Entity in Microsoft Dynamics CRM 365 Online, but I do not know the Entity's object type. Is there a way of using FetchXML (or otherwise) to retrieve any Entity with the matching GUID regardless of object type?
A possibility is to retrieve the metadata of all entities (using the RetrieveAllEntitiesRequest message) and after to an IOrganizationService.Retrieve to check if the record exits or not.
You can find a complete example in this blog post:
Retrieve Entity Logical Name from a record GUID
No. Unfortunately, we should always pass the target entity name for the fetchxml or any query in CRM.
But if you're looking for a way to get the entity name (followup to your other question), when you have the GUID in message block/exception details - you can get the "Primary Entity" from the same plugin trace log record as well.
Read more
I'm basically trying to create a primary ID between CRM and QuickBooks. Figured I'd just use the existing PK in CRM for the lookup. I'd like the PK to visible to the user, but not editable in CRM.
This has presented several problems in that you can't do that out of the box. I thought I read somewhere you could either via business rule or calculated field, but I haven't had luck with that.
It sounds like it would require web resources if I were to go this route.
The other option would be to just generate unique values for every record in Accounts and Contacts.
Does this automatically populate existing records or just new records? How do I get it to populate existing records?
You can use Auto number manager for configuring an auto-number attribute in every entity. This seeds a number based on configured format for new records. Uniqueness assured by SQL sequence feature & no need of any extra plugin/workflow.
For existing records - you can design a workflow along with a temp entity to assign auto-number. Read more.
Otherwise you can use SSIS + Kingswaysoft package to generate auto-number & assign for existing records.
I am suggesting you to create a new text field on the entity and create a pre plugin that will get the record primary GUID id from context and will set this GUID into the newly added attribute. You can set this field as read-only of form as well.
OR you can generate new GUID as well into the plugin.
How can I read from AuditBase using sdk 2015? How can I read the data in clear and understandable form?
Check out these SDK functions, Audit entity messages and methods
DeleteAuditDataRequestm Deletes all partitions containing audit data created before a given end date.
RetrieveAttributeChangeHistoryRequest, Retrieves all changes to a specific attribute.
RetrieveAuditDetailsRequest, Retrieves the full audit details of a particular audit record. The record to retrieve is specified in the AuditId property.
RetrieveRequest, Retrieves an audit record. You can also call the IOrganizationService.Retrieve method.
RetrieveMultipleRequest, Retrieves a collection of audit records. You can also call the IOrganizationService.RetrieveMultiple method.
RetrieveRecordChangeHistoryRequest, Retrieves all changes to a specific entity.
I have a workflow that will fire once a form field changes. The workflow checks the value and then sends an email if one particular value is selected. That much I've managed to figure out.
Now I need to pull a field value from a separate entity to populate the "to" field of the email. We have a Configuration entity that stores the value of a distribution list - we want to pull this into the email that the workflow generates.
I've created an N<>1 relationship between the primary entity and the Configuration entity, however I only see the Entity and not the entity's Fields in the email form assistant. Any idea how I can pull that data onto the email form?
If you see the entity populated under "Look for" and then in the drop down under that you see no values? I'm guessing in your configuration entity your email address you want to use for the email recipient is a text field. In order for the form assistant to populate the second drop down, the field types must match up - or in this case for a field to show up as useable for the "To" field, it needs to be an Account, Contact, User, etc... values you can send an email to.
My suggestion is create a Contact record that has the proper email address and either relate that to your base entity in place of your configuration entity (if possible) or relate your configuration entity to Contact and populate the new lookup on the configuration entity accordingly.