Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all 46379 articles
Browse latest View live

Retrieve record with date filter Using RestAPI Call

$
0
0

Hi Community Team,

I have the custom dateofbirth field in Lead form which I need to used to filter leads  in  CRM Onlinewhich are having the same dateofbirth when creating the new leads.

https://community.dynamics.com/crm/f/117/t/216135

As per referring the above link, I built my javascript code as below get the Date as per OData filter.   

function getODataUTCDateFilter(date) {
 var monthString;
 var rawMonth = (date.getUTCMonth() + 1).toString();
 if (rawMonth.length == 1) {
 monthString = "0" + rawMonth;
 }
 else { monthString = rawMonth; }

var dateString;
 var rawDate = date.getUTCDate().toString();
 if (rawDate.length == 1) {
 dateString = "0" + rawDate;
 }
 else { dateString = rawDate; }

var hourString = date.getUTCHours().toString();
 if (hourString.length == 1)
 hourString = "0" + hourString;

var minuteString = date.getUTCMinutes().toString();
 if (minuteString.length == 1)
 minuteString = "0" + minuteString;

var secondString = date.getUTCSeconds().toString();
 if (secondString.length == 1)
 secondString = "0" + secondString;

var DateFilter = new String();
 DateFilter += date.getUTCFullYear() + "-";
DateFilter += monthString + "-";
DateFilter += dateString;
 DateFilter += "T" + hourString + ":";
 DateFilter += minuteString + ":";
 DateFilter += secondString;
 return DateFilter;
}

var dateofbirth = Xrm.Page.getAttribute("dateofbirth");

var odataDateFormat =getODataUTCDateFilter(dateofbirth.getValue());

alert(odataDateFormat);

When I was alerting the odataDateFormat, I do not get the same value which is entered on the form. see the screenshot below.

The API call is as below

var context = Xrm.Page.context;

       var serverUrl = context.getClientUrl();

       var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";

       var retrieveResult = new XMLHttpRequest();         
      
       retrieveResult.open("GET", ODataPath +"/LeadSet?$select=FullName,LeadId&$filter=(tht_DateOfBirth eq datetime'" + odataDateFormat +"')",false);

 


I do not what I'm doing wrong here. Could anybody help me with data odata data filter issue ?


How to calculate Individual Product Sales Targets?

$
0
0

I wanted to calculate individual products Sales Target. Target can be calculated on Opportunity/order products, which does not show sales of a particular product. Is this possible using goals? or have to go for some customization?

How to display Sharepoint document grid in Dynamics 365 iFrame

$
0
0

Requirement is to display Sharepoint Document grid in Dynamics 365 iFrame. Any updates from Sharepoint folder must be reflected and should allow user to upload document from Dynamics 365 iFrame.

Install Field Service in Dynamics 365 on premise Environment

$
0
0

I have recently migrated from Microsoft CRM 2016 to the latest version  "8.2.2.112" of Dynamics 365 on premise.

I need to install the Field Service module in my latest version. Can anybody guide me.

Thanks

Word document from plugin

$
0
0

Hi Experts,

Can we create word document from plugin for MSD 365? is it possible? If so how? Done anyone have sample code? 

Thanks. 

ChartMaps (2.1.0.1)

$
0
0

Hi, 

I just wanted to know if ChartMaps (2.1.0.1) works with Bing Map V7 or V8 ? 
If ChartMaps is based on V7, is there a way to keep it usable after June 30 2017? 

Thanks

Regarding the password decryption adx_identity_passwordhash in the CRM 365

$
0
0

Is there a way to decrypt the adx_identity_passwordhash using the C# 

Add fields to Sharepoint List using Workflow Activity


How to set lookup field using flow

$
0
0

Hi all,

I am integration Microsoft Dynamics 365 with Microsoft Dynamics 365 CRM. I used common data service between. I am copying data from CDS to CRM after every some minutes. I have name field in CDS which is a lookup in CRM. How can can I get ID from this name and set it to look field? If anyone has any example of similar scenario or suggestion. Kindly let me know.

Thanks and Regards,

AW

IPluginExecutionContext throws KeyNotFoundException exception

$
0
0

I have a plugin and attached to a development instance. And it working fine. But if I attached the same plugin on production then I am getting KeyNotFoundException on the IPluginExecutionContext line.

Code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization.Json;
using System.ServiceModel;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Net;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query;
using System.Xml.Serialization;


namespace ContactDocument
{
    public class Class1 : IPlugin
    {

        public static string data;
        
        IOrganizationService _iOrgService = null;
        Entity entityWhichHasAttachment = null;
        EntityCollection dependentCollection = null;
        Entity dependentRecord = null;
        EntityCollection dataCollection = null;
        Entity dataRecord = null;        
        public static string supportType;

        string KeyNotFoundException = "";
        public void Execute(IServiceProvider serviceProvider)
        {

            String response = "";

            try
            {
                ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
                tracingService.Trace("Execute method call...");
                KeyNotFoundException = "IServiceProvider";
                
                tracingService.Trace("before check serviceProvider...");
                if (serviceProvider == null)
                    throw new ArgumentNullException("serviceProvider");
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
                IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                _iOrgService = factory.CreateOrganizationService(context.UserId);
                if (!(context.InputParameters != null && context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity))
                    return;

                tracingService.Trace("After check serviceProvider...");
                entityWhichHasAttachment = (Entity)context.InputParameters["Target"];
               
                tracingService.Trace("Target Entity...");

                QueryExpression dataQuery = new QueryExpression("tal_data");
                tracingService.Trace("tal_data Entity QueryExpression...");

                dataQuery.ColumnSet = new ColumnSet(true);
                ConditionExpression dataCondition = new ConditionExpression();
                dataCondition.AttributeName = "tal_dataid";
                dataCondition.Operator = ConditionOperator.Equal;
                dataCondition.Values.Add(entityWhichHasAttachment.Id);
                dataQuery.Criteria.Conditions.Add(dataCondition);
                OrderExpression dataOrder = new OrderExpression("createdon", OrderType.Ascending);
                dataQuery.Orders.Add(dataOrder);
                dataCollection = (EntityCollection)_iOrgService.RetrieveMultiple(dataQuery);
                foreach (Entity i in dataCollection.Entities)
                {                    
                }
            }
            catch (KeyNotFoundException KeyNotException)
            {

                throw new InvalidPluginExecutionException(KeyNotFoundException + "\n");
            }
            catch (Exception serviceExp)
            {                
                string response1 = "";
                if (serviceExp.Message.ToString().Contains("ProviderUniqueReference"))
                {
                    var str = serviceExp.Message.ToString();
                    var n = str.IndexOf("ProviderUniqueReference") + 27;
                    //var m = str.LastIndexOf("ProviderUniqueReference") - 5;
                    var m = str.LastIndexOf("ProviderUniqueReference") - 13;
                    var diff = m - n;
                    response1 += "Server Error : \n" + ",";
                    response1 += str.Substring(n, diff) + ",";

                }

                if (serviceExp.Message.ToString().Contains("StatusDescription"))
                {
                    var n = serviceExp.Message.ToString().IndexOf("StatusDescription") + 21;
                    var m = serviceExp.Message.ToString().LastIndexOf("StatusDescription") - 5;
                    var diff = m - n;
                    response1 += "\n      " + serviceExp.Message.ToString().Substring(n, diff) + "\n\n\n";
                    throw new InvalidPluginExecutionException(response1);
                }
                else
                {
                    throw new InvalidPluginExecutionException(serviceExp.Message.ToString() + "\n");
                }
            }
        }





    }
}

Case Type and Activity types issues

$
0
0

Hi,all

I have CASE Type with Values

a),b),c)

Under a) i have activity type a1,a2

under b) i have activity type b1,b2,b3

under c) i have activity type c1,c2,c3,c4

so when i click on a) i can select a1 or a2

similarly for b and c

but the issue is here

I have case type: new item request 

activity type:is showing New account qualification

but there is no New Account Qualification acitivity type under case type new Item request. How is that getting created?

Custom JScript on Entity Form and Web Page at the Same Time

$
0
0

I have a custom JScript on entity form, simple as

$(document).ready(function () {
 // Enable or disable fields
});


Then I have some additional logic on a Web page,

$(document).ready(function () {
 // Do some additional stuff
});

The problem is that when I have pieces of the logic in Web form , then the logic from Entity form is not working (I cannot just find the Jscript when debugging the page). Once I put all the logic on the web form -- it all works fine.

Can someone let me know if having the code

$(document).ready(function () {});

is legal on both Entity form and Web pages? Thank you in advance

Creating a Web Form that will integrate with CRM

$
0
0

As GDPR is coming along, we need a way for all our customers to 'opt in' to our communications and agree that we can hold data on them.

In an ideal world, we would like to send an email to our customers with a link to a web form where they will fill in their email address and then choose their preferred settings (i.e. "Yes, happy to be contacted").

However, I don't know how I would be able to link all our current contacts that we hold in the CRM with the new data we receive from people filling in the web form and submitting it. Is there a way that we can match up the email addresses somehow? 

Any ideas/advice would be much appreciated. Thanks! 

How to lock the editable grid

$
0
0

Hi, We have 2 views 

1) All opportunities

2) My open opportunities

In All opportunites all the fields are locked

In My open opportunities 

some fields are not locked

how to lock all the fields in both the views

Sync email preferences from CRM to Outlook

$
0
0

Hi,

If a contact has their email preference set to do not allow in CRM we want to prevent them from also sending emails to that contact in Outlook. Has anyone achieved this? 

Best wishes,

Richard


Custom status and status reason in incident entity

$
0
0

Hi All,

I am currently working on CRM online (D365) and client have a requirement to add status and status reason as 'Inactive'. As Incident is system entity and its not allowing to add status as Inactive.

Can anybody suggest me the requirement is feasible or not and if it feasible then there is any work around for it ?

Thanks in advance

Get option set label from fetchXML aggregate query.

$
0
0

Hi, 

I'm trying to get the option set label from the fetchXML query with no luck. 

I've read many posts and tried different ways to retrieve the option set values that are aggregated (group by) in the fetchXML. 

Below is my query. 

var strQuery = $@"
                <fetch aggregate='true'>
                  <entity name='custasset'>
                    <attribute name='name' alias='totalCount' aggregate='count' />
                    <attribute name='field1' alias='sv' groupby='true' />
                    <attribute name='field2' alias='shv' groupby='true' />
                    <attribute name='field3' alias='rg' groupby='true' />
                    <filter type='and'>
                      <condition attribute='field1' operator='not-null' />
                      <condition attribute='field2' operator='not-null' />
                      <condition attribute='field3' operator='not-null' />                    
                    </filter>
                  </entity>
                </fetch>";

Here is the casting that I tried to get the label. It doesn't even give the option set value. 

1. String optValue = (String)((AliasedValue)c["shv"]).Value; 
2. String optValue = c.GetAttributeValue<String>("sv");

It would be a great help if anyone suggest/guide on how to do this.
Thanks,
Sandip

Is there a way to set NoLock property using Linq calls in CRM?

$
0
0

Is there a way to set NoLock property using Linq calls in CRM?
Currently, we are doing load testing for our ADX based web portal. In the load test, we are getting very slow performance with some of the custom plugins.
Most of these plugins are doing duplicate check by querying CRM data using Linq calls. Our suspicion is these retrieve calls are putting the lock on fetched records,  which keeping other threads in the wait state.

I know we can put no lock on standard RetrieveMultiple calls, is there way to achieve same with Linq calls?

Closing Unified Service Desk crashes Skype for Business

$
0
0

Hi All,

I am using Unified service desk application with skype conversation docking into it using Lync SDK. When I am closing Unified Service Desk after docking is complete ( Note: especially if Skype is in presenting mode) , My Skype for business is stopped working (crashes) and restarting.. :(

I need some clue why this is happening.

Note: I am also ending the conversation (conversation. End()) like undocking, when closing USD.

Thanks in advance. :)

The Web Service plug-in failed in OrganizationId

$
0
0

The Web Service plug-in failed in OrganizationId: e38846d1-5779-4962-8832-a12957191359; SdkMessageProcessingStepId: df5b3fc1-79db-11e0-a0f5-1cc1de634cfe; EntityName: none; Stage: 30; MessageName: RetrievePersonalWall; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)

   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)

   at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)

   at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)

Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object.

   at Microsoft.Crm.Common.ObjectModel.PostService.PopulatePostCollection(CrmDbConnection sqlconn, ExecutionContext context, Dictionary`2 posts, IDbCommand command, CounterList populatePost, Int32 commentsPerPost)

   at Microsoft.Crm.Common.ObjectModel.PostService.RetrievePosts(Guid entityId, Int32 entityType, Boolean includeFollowing, Int32 pageNumber, Int32 pageSize, Int32 commentsPerPost, DateTime startDate, DateTime endDate, OptionSetValue type, OptionSetValue source, ExecutionContext context, CounterList retrievePostCounterList)

 

at Microsoft.Crm.Common.ObjectModel.PostService.RetrievePersonalWall(Int32 pageNumber, Int32 pageSize, Int32 commentsPerPost, DateTime startDate, DateTime endDate, OptionSetValue type, OptionSetValue source, ExecutionContext context

 

any one can help me

Viewing all 46379 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>