माला हवे की तुम्ही ला कही तरी लक्षात यावे
Monday, October 16, 2017
Monday, January 28, 2013
Disable Form Controls
function DisableFields() {
Xrm.Page.ui.controls.forEach( function (control) {
control.setDisabled(true);
}
);
}
function DisableSingleField() {
// for future
Xrm.Page.ui.controls.get(" name").setDisabled(true)
}
Xrm.Page.ui.controls.forEach(
control.setDisabled(true);
}
);
}
function DisableSingleField() {
// for future
Xrm.Page.ui.controls.get("
}
Friday, July 8, 2011
Thursday, May 19, 2011
Thursday, May 5, 2011
Thursday, April 21, 2011
Wednesday, April 20, 2011
Send Email in CRM using a Template
var xrm = new DataContext("xrm");
Guid SalesOrderId = new Guid("AF6485A7-EA7D-DF11-A99F-001438C3D4F5");
var xrmOrder = xrm.salesorders.Where(so => so.salesorderid == SalesOrderId).FirstOrDefault();
var xrmCustomer = xrm.contacts.Where(co => co.contactid == xrmOrder.customerid.Value).FirstOrDefault();
var template = (from v in xrm.templates
where v.title == "OrderConfirmation" && v.templatetypecode == "salesorder"
select v).FirstOrDefault();
if (template != null)
{
using (Microsoft.Xrm.Client.Services.IOrganizationService service1 = xrm.CreateService())
{
Microsoft.Crm.SdkTypeProxy.InstantiateTemplateRequest request1 = new Microsoft.Crm.SdkTypeProxy.InstantiateTemplateRequest();
request1.TemplateId = template.templateid;
request1.ObjectId = SalesOrderId;
request1.ObjectType = "salesorder";
request1.ReturnDynamicEntities = true;
var response1 = service1.Execute(request1) as Microsoft.Crm.SdkTypeProxy.InstantiateTemplateResponse;
var emailEntity = response1.BusinessEntityCollection.BusinessEntities[0] as Microsoft.Crm.Sdk.DynamicEntity;
var emailid = Guid.NewGuid();
var xrmEmail = new Entities.email(new Microsoft.Xrm.Client.CrmEntity(emailEntity,xrm));
xrmEmail.activityid = emailid;
xrmEmail.regardingobjectid = new Microsoft.Xrm.Client.CrmEntityReference("salesorder", SalesOrderId);
xrmEmail.to = new activityparty[] { new activityparty() { partyid = new Microsoft.Xrm.Client.CrmEntityReference("contact", xrmCustomer.contactid) } };
xrmEmail.from = new activityparty[] { new activityparty() { partyid = new Microsoft.Xrm.Client.CrmEntityReference("systemuser", new Guid("C4D554FE-3A5C-E011-873A-00155DF93E16")) } };
xrmEmail.directioncode = true;
xrm.AddToemails(xrmEmail);
xrm.SaveChanges();
Microsoft.Crm.SdkTypeProxy.SendEmailRequest req = new Microsoft.Crm.SdkTypeProxy.SendEmailRequest();
req.EmailId = emailid;//ID of created mail
req.TrackingToken = "";
req.IssueSend = true;
Microsoft.Crm.SdkTypeProxy.SendEmailResponse res = (Microsoft.Crm.SdkTypeProxy.SendEmailResponse)service1.Execute(req);
}
}
Subscribe to:
Posts (Atom)