As the error message suggests “An application user’s access mode cannot be changed “, it is not possible to change the Access mode of an application user from Non-interactive to either administrative or Read-write.
While trying to change the Application User’s Access Mode to Read-Write, the error message –
Get all the details about different type of users –
At times we may have a requirement to update the format of the Auto Number dynamically / programmatically so that the new set of records take up the new format.
Let us understand through a simple example.
Right now for the below field, we have the auto-number format set as
{SEQNUM:4}
Below is the sample code to update the auto-number format programmatically.
It makes use of our RetrieveAttribute and UpdateAttribute requests.
While trying to delete a data source we might below error if we have already used it for Match and Merge for defining the customer profile.
“Couldn’t delete data source. To process, remove its entities from: Match, Merge.”
Click on Enrichment
Navigate to Match.
Here also we cannot remove the entities in Unify as we have already used them in Merge.
So let us navigate to Merge.
Select all the fields from the DataSource (CRMDataSource in our case) which we want to delete, and click on Exclude.
Save the changes.
Now navigate back to Match and we will get the option to remove the CRMDataSource.
However, we will still not see the option to save the change as we just have 2 entities there.
Here we can add a different data source’s entity, e.g. we added the contact from our test data source.
And saved the changes.
Now as the last step we need to remove the entity from the Map also.
Click on Edit fields and unselect the entity, followed by Apply.
Navigating back to Data Sources, we were able to delete the Data Source successfully now.
So in short, if we need to delete a data source, which we have configured for customer profile, we need to first remove its references from Merge, Match and than Map.
We can use RetrieveAttributeChangeHistoryRequest to get the change history of a particular field / attribute of a record.
We need to set the Target and the AttributeLogicalName property of the request.
AuditDetails records of the RetrieveAttributeChangeHistoryResponse contains the detail of the audit records.
The Audit History records in CRM-
AttributeAuditDetail contains the details of the changes made on the field’s value. It contains property like – objectid, userid, operation etc. as well as new value and the old value as shown below.
Sample Code (C#)
string ConnectionString = "AuthType = OAuth; " +
"AppId=51f81489-12ee-4a9e-aaae-a2591f45987d; " +
"Username=User1@xxxx.onmicrosoft.com; " +
"Password=*******; " +
"RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;" +
"Url = https://xxx.crm.dynamics.com//;";
CrmServiceClient svc = new CrmServiceClient(ConnectionString);
if (svc.IsReady)
{
var attributeChangeHistoryReq = new RetrieveAttributeChangeHistoryRequest();
attributeChangeHistoryReq.Target =
new EntityReference("incident", new Guid("0a9f62a8-90df-e311-9565-a45d36fc5fe8"));
attributeChangeHistoryReq.AttributeLogicalName = "prioritycode";
var attrChangeResponse = (RetrieveAttributeChangeHistoryResponse)svc.Execute(attributeChangeHistoryReq);
var auditDetailCollection = attrChangeResponse.AuditDetailCollection;
foreach (var auditDetails in auditDetailCollection.AuditDetails)
{
// Type = AttributeAuditDetail, AuditDetail,
var type = auditDetails.GetType();
if (type == typeof(AttributeAuditDetail))
{
var attributeDetail = (AttributeAuditDetail)auditDetails;
var userName = attributeDetail.AuditRecord.GetAttributeValue<EntityReference>("userid").Name;
var operation = attributeDetail.AuditRecord.FormattedValues["operation"];
var action = attributeDetail.AuditRecord.FormattedValues["action"];
var createdOn = attributeDetail.AuditRecord.GetAttributeValue<DateTime>("createdon");
var newValue = attributeDetail.NewValue.FormattedValues["prioritycode"];
var oldValue = attributeDetail.OldValue?.FormattedValues["prioritycode"];
}
}
}