Sample Code – Enable / Disable Plugin Step (sdkmessageprocessingstep) Dynamics 365 / Dataverse


Recently we had to disable plugin steps as part of data migration, below is the sample code we can use, either specify the name of the assembly, plugin, or plugin step as we are using the “begins with” condition or make changes as required.

 class Program
    {
        static void Main(string[] args)
        {

            const string ConnectionString = "AuthType = OAuth; " +
                                            "Username = Nishant.Rana@xyz.com; " +
                                            "Password = testxyz; " +
                                            "Url = https://orgname.crm6.dynamics.com;" +
                                            "AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;" +
                                            "RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;" +
                                            "LoginPrompt=Auto";


            CrmServiceClient svc = new CrmServiceClient(ConnectionString);

            if (svc.IsReady)
            {
                try
                {
                    // we can specify step / plugin / assembly name
                    var pluginStepAssemblyName = "MyD365.Plugins.Core.Plugin.AssignOwner";
                    // 0 for active and 1 for inactive
                    var pluginStateCode = 0;                   

                    var query = new QueryExpression("sdkmessageprocessingstep");
                    query.ColumnSet = new ColumnSet("name", "sdkmessageprocessingstepid");
                    query.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.BeginsWith, pluginStepAssemblyName));
                    var sdkMsgProcessStepCollection = svc.RetrieveMultiple(query);

                    foreach (var sdkMsgProcessStep in sdkMsgProcessStepCollection.Entities)
                    {
                        var setStateRequest = new SetStateRequest();
                        setStateRequest.EntityMoniker = new EntityReference("sdkmessageprocessingstep", sdkMsgProcessStep.Id);
                        setStateRequest.State = new OptionSetValue(pluginStateCode);
                        setStateRequest.Status = new OptionSetValue(-1);
                        svc.Execute(setStateRequest);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception Messainge : {0} ", ex.Message);
                }

            }
        }
    }

Hope it helps..

Advertisements

Fixed – 0x90000010 Can not retrieve view’s metadata (Dynamics 365)


We were recently getting the below error in one of the views in the Dashboard.

0x90000010 Can not retrieve view’s metadata

The issue occurred because we had converted that Dashboard from a personal to System / Public Dashboard using the below wonderful XrmToolbox Plugin, https://www.xrmtoolbox.com/plugins/Carfup.XTBPlugins.PersonalViewsMigration/, which converted it to System Dashboard successfully, however, this was one of the personal views inside that dashboard.

So we converted that personal view to the system view (using the same tool) and then updated the Dashboard to refer to the converted system view, which fixed the issue.

Hope it helps..

Advertisements

Set DefaultSelectedItems of Combobox on App OnStart – Custom Page -Power Apps (Dataverse)


Recently in one of our custom pages, we had to set the default value (DefaultSelectedItems) of the combo box based on one of the lookup fields on the record. We were opening the custom page from the ribbon button on the form.

Below is our function to pass the record’s GUID to the custom page from the button.


    openSearchCustomPage: function (primaryControl, firstPrimaryItemId) {
        var pageInputCustom = {
            pageType: 'custom',
            name: 'custom_searchproduct_570ed',
            entityName: 'lead',
            recordId: firstPrimaryItemId
        };

        var navigationOptions = {
            target: 2,
            position: 1,
            width: 1350
        };

        Xrm.Navigation.navigateTo(pageInputCustom, navigationOptions).then(
            function success(result) {
                console.log(result);
            },
            function error(error) {
                console.log(error);
            }
        );
    }

Next in App’s OnStart, we are setting the GUID of the record to a variable first, and than setting another variable to store the GUID of the Region lookup field on that record.

// text variable passed by the form / webresource/ ribbon
Set(varEnquiryIdWithoutCurlyBraces,GUID(Substitute(Substitute(Param("recordId"),"{",""),"}","")));

// get the Region Of Interest from the Lead / Enquiry ID
// If value present use it for prefiltering the Gallery Items
Set(varRegionOfInterest,LookUp(Enquiries,Lead=varEnquiryIdWithoutCurlyBraces, 'Region of Interest'));

And lastly, for the combo box (Items = Region (custom table)), we are setting the DefaultSelectedItems as follows

LookUp(Regions,Region=varRegionOfInterest.Region)

We also tried using the Filter option, but it was giving incorrect values.

The value on the form –

The value in the Custom Page –

Correct value populated for combo box Region, and incorrect for the one using Filter formula

Hope it helps..

Advertisements

Fixed – View Name as Blank in Dynamics 365 / Model-driven app


Recently we faced an issue where one of the views was not showing its Name in the app.

On selecting the View Selector, we were not getting the option to select that view.

Checking in a Vanilla CRM instance, we can see it is OOB My Activities view.

To fix it, we had to edit the App, Add Page >> Dataverse Table >> Select exiting table >> Activity


And add that view to that app and publish the changes.

The result –

Hope it helps..

Advertisements

My CRM is Automatically Sending E-mails to Regarded Appointments


CRMSmith's avatarAtrio Systems Provides Value, Tips & Lessons Learned

Problem

A common problem that many users report in CRM is that the system is automatically sending out e-mail notifications to recipients for CRM Appointments without the user’s permission. However, you know CRM doesn’t automatically send out Appointment e-mails and there are no background processes or workflows that are sending these notifications. So what are the users referring to?

Since CRM 2013, most users have been creating appointments through the Social Pane. One nice thing about creating appointments from the Social Pane is that CRM automatically populates information onto the Appointment form. A major downside to this though is that one of the fields that gets populated is the “Required” field.

2016-04-11_13-07-28

When an Appointment is saved with values in the “Required” field and it syncs to a user’s e-mail, it has the same effect as inviting attendees to an appointment in Outlook or Office 365. When attendees are on an Appointment, e-mail notifications are sent out…

View original post 204 more words

Fix – Exception in creation of lead (Dynamics 365 Marketing)


We were getting this error in the submission of one of our outbound Marketing forms.

Activity id: e1ede147-efb6-457d-bc19-826c6176a2e4, Request id: jH7xRiEzGFTdZQTbE2fkh9_Z_WtjumCqJERuYZbGSL0_0, Exception: Entity ‘Contact’ With Id = 896b960d-c5d7-4c4d-95c7-a9e226afbf8e Does Not Exist

The form had only the Lead form matching defined and Only leads for Update contacts / leads.

So here because of some earlier multiple/different form submissions, a contact got created and stored in the browser’s cookie, which CRM was referring to, and trying to set a Parent Contact for the lead record even though we were having Only leads set for update contact/leads option.

This is the behavior of the product.

https://learn.microsoft.com/en-us/dynamics365/marketing/marketing-forms#createupdate-leads-only

The solution is to delete the cookie or try in incognito or in-private mode or a different browser, and it would work.

This would probably arise because while setting up marketing forms we would do multiple submissions with test data for testing.

Hope it helps..

Advertisements

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓