hi all am trying to create note when account Creates using Plugin
i dont want to attach any files in Notes
just i want to trying a adding a text File.
when account Create Note Text File also Create
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters["Target"];
// Verify that the target entity represents an account.
// If not, this plug-in was not registered correctly.
if (entity.LogicalName != "account")
return;
try
{
Entity _annotation = new Entity("annotation");
_annotation.Attributes["objectid"] = new EntityReference("account", new Guid("9ed7e828-fa70-e411-ba71-5453ed23c515"));
_annotation.Attributes["objecttypecode"] = "account";
_annotation.Attributes["mimetype"] = @"text/plain";
_annotation.Attributes["notetext"] = "Note is Created From Lead";
service.Create(_annotation);
}
Please Give me some Suggestion
*This post is locked for comments
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName == "account")
{
try
{
string strMessage = "this is a demo";
byte[] filename = Encoding.ASCII.GetBytes(strMessage);
string encodedData = System.Convert.ToBase64String(filename);
Entity Annotation = new Entity("annotation");
Annotation.Attributes["objectid"] = new EntityReference("account", new Guid("9ed7e828-fa70-e411-ba71-5453ed23c515"));
Annotation.Attributes["objecttypecode"] = 1;
Annotation.Attributes["subject"] = "account Demo File";
Annotation.Attributes["documentbody"] = Convert.ToBase64String(new UnicodeEncoding().GetBytes("Sample Annotation Text"));
Annotation.Attributes["mimetype"] = @"text/plain";
Annotation.Attributes["notetext"] = "Sample attachment.";
// Annotation.Attributes["filename"] = "Demo.txt";
service.Create(Annotation);
}
hi Guido Preite it is Not working am just Trying add Only a " Note text"
thanks u so much Guido Preite
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,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156