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

MSCRM (plugin)

0
0

Hello friend ,, I write a plugin code for stop creating activity on case form after change in endorsement section for those customer  who dn't have email id.

but still activity created , please see the code and give me your suggestion. please 

using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;

namespace EndorsementEmail
{
    public class CaseEndorsement : IPlugin
    {
        public ITracingService iTracingService;

        #region Variable Declaration
        private string TempName = string.Empty;
        Guid _TemplateId;
        Guid _ObjectId;
        Guid _customerId;
        int _Endstatus;
        #endregion Variable Declaration

        public void Execute(IServiceProvider serviceProvider)
        {
            try
            {
                #region Initilization of required plugin objects.
                iTracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
                IPluginExecutionContext iPluginExecutionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
                IOrganizationServiceFactory iOrganizationServiceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                IOrganizationService iOrganizationService = iOrganizationServiceFactory.CreateOrganizationService(iPluginExecutionContext.UserId);
                #endregion

                if (iPluginExecutionContext.Depth > 1) return;
                if (iPluginExecutionContext.PrimaryEntityName != "incident") return;


                #region Business Logic
                //Retrieve Case record with other attributes.
                ColumnSet cols = new ColumnSet(new string[] { "customerid", "adkv_endorsementstatus" });
                Entity _CaseRecord = iOrganizationService.Retrieve("incident", iPluginExecutionContext.PrimaryEntityId, cols);
                if (_CaseRecord.Contains("customerid"))
                {

                    iTracingService.Trace("CaseEndorsement plugin end on finally block");
                    EntityReference _customerId = _CaseRecord.GetAttributeValue<EntityReference>("customerid");
                    Entity customerRetreive = iOrganizationService.Retrieve("contact", _customerId.Id, new ColumnSet("emailaddress2"));
                    if (customerRetreive.GetAttributeValue<EntityReference>("emailaddress2") != null)
                    {

                        //Set Email Template based on Endorsement Status
                        if (_CaseRecord.Contains("adkv_endorsementstatus"))
                        {

                            iTracingService.Trace("CaseEndorsement plugin end on finally block");
                            _Endstatus = _CaseRecord.GetAttributeValue<OptionSetValue>("adkv_endorsementstatus").Value;
                            if (_Endstatus == 100000000)
                            {
                                TempName = "Endorsement Accepted Email Template";
                            }
                            else if (_Endstatus == 100000001)
                            {
                                TempName = "Endorsement Rejected Email Template";
                            }

                        }

                        _ObjectId = _CaseRecord.Id;

                        //code to retrieve emailtemplateid
                        string sFetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
                                     "<entity name='template'>" +
                                     "<attribute name='title' />" +
                                     "<attribute name='templatetypecode' />" +
                                     "<attribute name='ispersonal' />" +
                                     "<attribute name='languagecode' /> " +
                                     "<attribute name='templateid' /> " +
                                     " <order attribute='title' descending='false' /> " +
                                     "<filter type='and'> " +
                                     "<condition attribute='title' operator='eq' value='" + TempName.ToString() + "' /> " +
                                     "</filter> " +
                                     "</entity> " +
                                     "</fetch>";

                        EntityCollection enCollEmailTemp = iOrganizationService.RetrieveMultiple(new FetchExpression(sFetchXml));


                        if (enCollEmailTemp != null && enCollEmailTemp.Entities != null && enCollEmailTemp.Entities.Count > 0)
                        {
                            _TemplateId = enCollEmailTemp.Entities[0].GetAttributeValue<Guid>("templateid");
                        }

                        #region Initialte Email Template
                        InstantiateTemplateRequest instTemplateReq = new InstantiateTemplateRequest();
                        {
                            instTemplateReq["TemplateId"] = _TemplateId;
                            instTemplateReq["ObjectId"] = _ObjectId;
                            instTemplateReq["ObjectType"] = _CaseRecord.LogicalName.ToString();
                        };

                        InstantiateTemplateResponse instTemplateResp = (InstantiateTemplateResponse)iOrganizationService.Execute(instTemplateReq);
                        EntityCollection templatecollection = new EntityCollection();
                        templatecollection = (EntityCollection)instTemplateResp["EntityCollection"];
                        if (templatecollection.Entities.Count > 0)
                        {
                            Entity EmailCreate = new Entity("email");
                            EmailCreate["subject"] = templatecollection.Entities[0].GetAttributeValue<string>("subject");
                            EmailCreate["description"] = templatecollection.Entities[0].GetAttributeValue<string>("description");
                            EmailCreate["regardingobjectid"] = new EntityReference("incident", _CaseRecord.Id);

                            // Set from Field Start
                            Entity ap2 = new Entity();
                            ap2 = new Entity("activityparty");
                            iTracingService.Trace("1");
                            ap2["partyid"] = new EntityReference("systemuser", new Guid("F166DC3C-98B4-DD11-A7F2-001A6435D028"));
                            Entity[] aryFrom = { ap2 };
                            EmailCreate["from"] = aryFrom;
                            // Set From Field End

                            // Set To Fiel to email activity
                            Entity ap1 = new Entity();
                            ap1 = new Entity("activityparty");
                            iTracingService.Trace("2");
                            ap1["partyid"] = new EntityReference("contact", _customerId.Id);
                            Entity[] aryTo = { ap1 };
                            EmailCreate["to"] = aryTo;
                            // Set To field on email activity

                            iOrganizationService.Create(EmailCreate);

                        }
                        #endregion Initiate Email Template
                    }
                #endregion Business Logic


                }
            }
            catch (Exception e)
            {
                iTracingService.Trace("CaseEndorsement Plugin is on catch block");
                throw e;
            }
            finally
            {
                iTracingService.Trace("CaseEndorsement plugin end on finally block");
            }
        }

    }
}


D365 SDK connection issue

0
0

Hi, we are having two different CRM server for D365 version 8.2.1.176. I am having custom application to run some background process developed using CRM SDK version 6.0.0.0. one CRM server is connecting the application without any issue, but another one CRM is not working, but this working using the latest version of SDK.

Anyone faced this kind of issue?.

ExecutMultipleRequest limitations

0
0

What are the limitations with regards to the ExecutMultipleRequest?

How to Merge Duplicate Contacts in MS Onpremise CRM ?

0
0

as we have more than 2328 duplicate contacts so how would i need to merge the duplicate contacts??? in MSCRM

As in manually merging it takes forever

Error when creating the Task or Appointment in mobile version Dynamics CRM 365

0
0

When I'm trying to create the task in mobile version Dynamics CRM 365 (android or ios) page onloads very long time with no end and I can't create a task.
When I'm trying to create the appointment in mobile CRM 365 (android or ios) I encountering with script errors popping up on form load only on the app and not on the web form.
The error does not show what field is causing the error. On forms we have 20 fields and 1 tabs without grids. If I open old task or appointment the pages open normal and I can create a new task or appointment.

need to add subgrid in CRM

0
0

Hi,

I am facing a strange problem when I tried to add sub grid in a form it does not show any error but not adding sub grid in form. Looking for help.

Thanks,

Sandeep

Custom Entities with Outlook Addin

0
0

Hi,

I know that everyone is moving to the new App for Outlook however, most of my clients are still using the add-in. Are there any requirements to sync custom entities to Outlook? Also, is this a straight forward process or is there something special that needs to be done?

Regards,

John

 

Dynamics CRM Web API POST Products 'Internal Server Error'

0
0

Hi,

I've working on a C#.net desktop application to create a products in CRM but when I post my request my response message IsSuccessStatusCode returns false and ReasonPhrase value is "Internal Server Error".

requestUri = https://xxxxxx.xxxxxx.com/api/data/v8.2/products

Content = { "description": "Desc12345", "productnumber": "12345", "name": "Name12345" }

This is for an on-prem. version of CRM and my code to patch/update existing product values all works fine, so I have to assume the Uri isn't the issue.

I've tried including other fields in my content on the assumption that there could be a mandatory value I need to populate but even when I set values to match other products the error still appears.

Can anyone give me suggestions on how I can dig deeper to find details of the error?

Thanks


PartyList lookup Field on USD open in a new tab

0
0

I have a partylist customer field on case entity ( account,contact).

I want to open in a new tab when clicking on it.

On USD , i have created a window naviguation rules :

FROM : CASE

TO : Contact

Action :  Route Window.

It doesn't work the record is opened is the same window.

How can do this ?

can we hide sorting field on report display

0
0

hello,

          i am trying to make report where i need to generate report by companies 

but report should nt display sorting field 

data is at one place for all the companies and if ii make a drop down in sorting feild than can i hide that in display

Problem with add new Button in Subgrid

0
0

Dear all,

i have the following Issue:

I have some Custom Entities in CRM 365 v8.2.1.411 and there are Subgrids for them in the Contact Entity. Some of them have the "+"- Add New" Button, with the Quick Create View, others are in the same way configured but the Button is not visible, and also if you click on the View, there is neither new, or add, nor delete.

I´m the Sys Admin, so this is more than strange for me, does anybody has an idea?

Thank you

Richard

Connect an entity with another entity to show as an option in Advance find

0
0

Good afternoon, 

I have 2 custom entities that were created before I started with my current employee. 1 called vendor and the other called application. Applications plays the role of opportunity and vendor just company info (not accounts). I was trying to add a sub-grid to the form to show all the application that a vendor was associated with, but I am not able to do that. When I look in advance find under vendor, it does not even give me an option to search for Applications and when I search in Application, Vendors do not show up either. What am I missing?? 

Thank you, 

Posts showing in social center but not in analytics

0
0

I was using the social engagement trial with my online crm 365 instance. Now i added my twitter account in social profiles. I created a stream in social center which shows all the post from that twitter account. But in analytics it does not show them all. Before it was showing 11 post now it shows 7 post. And also it is not showing any new post in analytics.

Business process flow security role access level

0
0

From some reason on the security role BPF tab, one can only set up "None" or "Organization" access level. This is very problematic. 

The process entity is always related to another entity, Contact in our case, and a user with no organization access level on the Contact records can now see other users contacts through the process entity views (as columns on the list).

What am i missing?

custom hotkey help

0
0

I'm trying to make it so when alt+a is pushed it activates the search contact field. I haven't written js in a couple years, and am really rusty. Any help appreciated.

This is what I've written, it works in jsFiddle, but not in CRM.

document.onkeyup = function(e) {
var e = e || window.event; 
if (e.altKey && e.which == 65) {
alert ('keyboard shortcut working!');
return false;
}
}

This test code works for an alert in CRM:

function AlertPrimaryValue() {

var primaryValue = Xrm.Page.data.entity.getPrimaryAttributeValue();

alert(primaryValue);

}


Unable to change manager in "Manager hierarchy"

0
0

Hi,

   i am trying to work on "manager hierarchy" i have two user(u1,u2 -same bu & role) are first assigned to the manager Test2. when i tried to change the manager of these two user as "Test1" the record created by u1,u2 aren't reflected in Test1  queue(all record view).

Both manager share the same security role.So based on the hierarchy rule the records should reflect.what am i doing wrong?

is there any technical reason behind this? please help

thanks & regards,

Some emails don't enter Queue

0
0

We have several queues setup in CRM 2016 (8.1.0359).  One of our queues handles most of the incoming emails.  It appears that if I send an e-mail directly to that email address setup on the queue, it works just fine.  There are a few scenarios for us that aren't working however.  For my example, sales@help.com is what the queue is setup to use.

1. If an email is sent to an email address with an automatic forwarder setup to the email address the queue is using.  For example, info@help.com is autoforwarding to sales@help.com.  The email is received in the inbox of sales@help.com, but it never appears in the queue.

2.  If an email is sent to a group such as USOffice@help.com that the sales@help.com account is a part of, the email shows up in the inbox, but never goes to queue.

3.  If an email is sent to someone else and sales@help.com is either in the CC or BCC line, the email never shows up in the queue, but we see it in the inbox.

Info from our setup.

- We are using "Server Side Synchronization or Email Router" for the Incoming and Outgoing email.

- The "Track emails sent between CRM users as two activities" is marked.

- We are using Office 365 for Exchange/Outlook.

I am not sure what to check at this point, so any assistance would be greatly appreciated.

Nicole

Business Process Flow - multiple quotes and one opportunity

0
0

Hello!

I have a Business Process Flow starting from lead, opportunity then 3 stages on quote. there are few cases where i am not sure how to configure:

1. user starts process from opportunity/quote - it cannot connect to process

2. user create multiple quotes from opportunity

how is it possible to handle this situations? please help

Event ID 3: System.ServiceModel 4.0.0.0

0
0

Hi:

Over the past couple of days we are seeing this error in our event logs for a couple of the organizations hosted within our CRM 2016 8.1 environment (We have two CRM servers that are load balanced via Azures public LB "Both Port 80 and 443").   Can anyone shed some light on what could be happening and/or steps we can take to troubleshoot?

WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/38881621
Exception: System.Web.HttpException (0x80004005): The service '/orgname/XRMServices/2011/Organization.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/orgname/XRMServices/2011/Organization.svc' does not exist.
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: w3wp
Process ID: 11988

Thank you,

Stangride

Can't connect with user using alternate UPN Suffix

0
0

We have a hosted environment with multiple clients running on it. The domain is "host"

However, there are multiple clients that have users with the same first and last name, so we can't set them all up in our AD as host\firstname.lastname and so we set up alternate UPN Suffixes for them so they can log into CRM as firstname.lastname@companyname.com (basically, their email address)

We have custom code that allows users to log in using their CRM credentials and while this worked fine using CrmConnection but we've now switched to Xrm Tooling and this does not work.

They can log in as host\firstname.lastname but this is problematic for whoever is the second John Smith and would have to remember to sign in as host\john.smith2 or something.

Thanks

Viewing all 87499 articles
Browse latest View live




Latest Images