Posts

Showing posts from March, 2015

Send Email Report Workflow Activity

using System; using System.Activities; using System.Text; using SendEmailPDFReport.ReportService; // Add Reporting Service as Web Reference using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Workflow; using Microsoft.Xrm.Sdk.Messages; using Microsoft.Crm.Sdk.Messages; using Microsoft.Crm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Client; using System.Collections.Generic; namespace SendEmailPDFReport {     public class SendEmailPDF : CodeActivity     {         #region Input Parameters         [Input("Report ID")]         [ReferenceTarget("report")]         public InArgument<EntityReference> ReportID { get; set; }         [RequiredArgument]         [Input("From")]         [ReferenceTarget("queue")]         public InArgument<EntityReference> From { get; set; }         [RequiredArgument]         [Input("To")]         [ReferenceTarget("contact")]         public InArgument&

Retrieve Metadata of a Boolean (Two Options) Attribute in Microsoft Dynamics CRM 2011/2013

Code to retrieve the boolean (Two Options) attribute metadata in CRM 2011. You need to pass the boolean value to get the Text. public static string GetBoolText(IOrganizationService service, string entitySchemaName, string attributeSchemaName, bool value)         {             RetrieveAttributeRequest retrieveAttributeRequest = new RetrieveAttributeRequest             {                 EntityLogicalName = entitySchemaName,                 LogicalName = attributeSchemaName,                 RetrieveAsIfPublished = true             };             RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)service.Execute(retrieveAttributeRequest);             BooleanAttributeMetadata retrievedBooleanAttributeMetadata = (BooleanAttributeMetadata)retrieveAttributeResponse.AttributeMetadata;             string boolText = string.Empty;             if (value)             {                 boolText = retrievedBooleanAttributeMetadata.OptionSet.TrueOption.La

Set Option Set by OptionSet Text

function SetValue(optionsetAttribute, optionText) {  var options = Xrm.Page.getAttribute(optionsetAttribute).getOptions();  for(i = 0; i < options.length; i++)  {   if (options[i].text == optionText)    Xrm.Page.getAttribute(optionsetAttribute).setValue(options[i].value);  } } Calling of the function SetValue("new_country", "India")

Multi Pick List in CRM 2011/2013

Image
I have a one req. in one of the CRM Projects where user want multiple selection option in Option Set we can create a Multiple Pick List for Dynamic CRM 2011/2013 form too. User can enter multiple data from Pick List by Checkbox. This will also work on in major browsers (IE, Firefox, Chrome). See the below screen shot. Below is the js code: // var_sc_optionset >>  Provide schema-name for Option Set field // var_sc_optionsetvalue >> Provide schema-name for field which will //                          store the multi selected values for Option Set // OS >> Provide Option Set field object //       (Ex:- document.getElementById("Option Set field schema-name")) // OSV >> Provide text field object which will store the //        multi selected values for Option Set //       (Ex:- document.getElementById("text field schema-name")) //Method to convert an optionset to multi select Option Set function ConvertTo