Hi,
My customizations are like this.
I use PhoneCall, when PhoneCall is Succeeded a new record in the Custom Entity gets created.
At the same time if any attachments attached to PhoneCall has to get attached to the new record which got created.
For this i found that if we update the ObjectId in Annotation Entity with the Created recordId attachments gets attached to the record.
My code to Update ObjectId in Annotation Entity throws an error "server was unable to process request"
Please find the code below:
// Create the annotation object.annotation an = new annotation(); // Set the annotation ObjectId to created recordIdLookup objectID = new Lookup();objectID.Value =
new Guid("213F6990-9770-DF11-8983-00155D01D806");an.objectid = objectID;
// The aannotationId is a key that reference Id of the annotation to be updated.an.annotationid = new Key(); // The annotationid.Value is the GUID of the record to be changed.an.annotationid.Value = new Guid(Anotationid); // Update the annotation. try{
service.Update(an);
}
catch (System.Web.Services.Protocols.SoapException ex){
Suggest me where i am missing.
Regards
Prashanth Y
*This post is locked for comments
Thanks For Suggestion
EntityReference entref = (EntityReference)item.Attributes[attributeName];
var LookupId = entref.Id;
var logicalName = entref.LogicalName;
newAccount[attributeName] = new EntityReference(logicalName, LookupId);
newAccount[attributeName] = Null;
Hi Sam,
I have an Custom Entity "new_Leadlist"
When i update Phone call status as "Call Succeeded" a new Leadlist record gets created. I used javascript to create this record.
In this new_leadlist entity Create event i registered Plugin which checks for any attachments for PhoneCall, if attachments are present those attachments will get attached to Leadlist record which got created.
For moving attachments from Phonecall to Leadlist i am updating objectId column in annotationbase table.
This objectid contains Phonecall Guid now i am updating with Leadlist GUID
Plugin is getting triggered but showing Eror "The object Cannot be Updated because it is readonly"
The same i tried with Javascript to update the column faced the same error.
Regards,
Prashanth Y.
Hi Prashant,
On which event of which entity are you writing the code...
Is there any other code that you have written in the plugin apart from moving the note? Is the entity to which you are moving the note, an inactive record or disabled?
Sam
Hi Sam,
The above was working in Visual Studio , but wen i register the plugin and execute it an error is thrown.
Error Msg: "The object cannot be updated because it is readonly"
Is there any workaround method to resolve this issue.
Regards,
Prasghanth Y.
Hi Sam,
Thanx,
It got worked. Thanx for your help.
Regards
Prashanth Y
As you said you are trying this in a plug-in, we gave you the solution that works with sdk dll's
But you are using web reference in plugin and here this can be set as follows:
Thanks!
Sam
Hi Sam,
I get Error at this line
an.objecttypecode = new EntityNameReference(EntityName.account.ToString());
Error: 'CrmSdk.EntityNameReference' does not contain a constructor that takes '1' arguments C:\Users\crmvendor\Documents\Visual Studio 2008
Regards
Prashanth Y
Hi Prashanth,
You need to set the objectid and object type using the following code.
Replace the entity name "account" in the below snippet to the name of your custom entity.
//set the type of entity to which the note is to be associated //here we selected accountHTH
Sam
Hi Sam,
The ObjectId column in the annotationbase table is not a referenced column. thats the problem i am unable to set the value to it. Do you have any input for me how to the find the ObjectType for it or how to set the value to lookup for the column ObjectID.
Regards
Prashanth Y
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156