Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

While working with BPF fields using JavaScript, there can be instances where you might want to keep the field locked in a certain stage but unlocked in another stage. And using Xrm.Page.getControl(controlName) or for v9 – getFormContext.getControl(controlName) should differentiate between the 2 fields?

Let’s see what we need to do here.

Scenario

  1. Let’s say I want the users to enter Customer Need data in Develop Stage.
    unlockedField
  2. But, just view what data is present in Propose Stage shown below, not modify it. (I’ve just renamed the field to Summarize Customer Need instead)
    lockedFields

JavaScript Usage to access the Control

  1. Now, since the Summarize Customer Need field is the second time, using getFormContext.getControl(“header_process_customerneed”) will be fetched to disable the first field only i.e. Customer Need in Develop stage.
    unlockedField
  2. To access Summarize Customer Need, you need to append “_1” to the control name for the second occurrence. And _2 and so on for further occurrences.
    Here’s the sample code which I used to access Summarize Customer Need to access the second occurrence of the field and use setDisabled(true) to lock it –
    code3. And that way, you’ll be able to access Summarize Customer Need control and do your desired operation (like even make it hidden or visible depending on your scenario) –
    lockedFields
    Hope this helps!
Advertisements

D365 Quick Tip – Why should you Reassign Records to another user?

An underrated feature of Dynamics 365 sitting since a long time is the Reassign Records. This is a particularly important feature that if a key person stayed with the organization for quite some time and worked deeper in Dynamics like written plugins or have workflows owned by them, it is imperative that the records they owned need to be reassigned to someone else when that employee leaves.

Given the scenario – An employee, Somesh, left the company but has several records under his ownership. Even some workflows (we’ll get to that a little further.) Sample Original Records owned by the user –
originalRecords

And when the user leaves the company, in general practice, we revoke the D365 license for reuse. In that case, the user is Disabled in the system –

disabledUser

Important: Before you proceed further, please make a list of all Active workflows which are owned by the Disabled user before Reassigning Records. You can use Advanced Find to find such workflows.

Why should you Reassign Records

Workflows

Since the user who left was owner of any workflows having Scope of Organization level, they’d fail and if them being background workflows, you wouldn’t know what happened in the background. On investigating, you’d see error like –

errorInWorkflow

I noticed that workflows which are set to User scope will behave like they didn’t trigger.

Reassign Records

Use this feature to reassign records of the Disabled User to the new Administrator/User who should carry forward the smooth processing of day to day operations of Dynamics.

  1. Go to the user by going to Settings > Security > Users. Find the user and open the record.
    reassignRecords

  2. On clicking on Reassign Records as shown above, you’ll be asked whether you want to assign the records to yourself or some other user.
    reAssignToOtherUser
  3. The loading will complete and once you check, all the records that were previously with Somesh will be assigned to Vishal. See below –

    assignedToNewUser

  4. The workflows get assigned too. But, you have to do some activity before you say you’re done.

Reactive the Workflows

So, the records got swiftly got assigned to the new user. However, the workflow which Somesh owned were Deactivated, assigned to Vishal but were left Deactivated!
deactivatedWorkflows

And with that, you’ve saved some hours trying to find out why certain things went wrong. Hope this helped!

D365 Quick Tip: Higher version of D365 For Outlook won’t work older D365 Online

Most clients are now upgrading their D365 Online from 8.2 version to the newer 9.0 / 9.1 versions. Now, I know D365 App For Outlook is the way to go. However, some clients want to stick their classic flow of Set Regarding from the Outlook client (even though D365 App For Outlook seamlessly provide all of this)

If you’re planning that you start upgrading users’ D365 For Outlook version to v9 so that you can set them up already even before D365 goes to v9, then this won’t work.

Here’s the link to download the version 9 of the Dynamics 365 For Outlook – https://www.microsoft.com/en-us/download/details.aspx?id=56972

actualVersion

But, if you update the existing version to the one above and expect it to connect to your 8.2 D365, it won’t work and give you the following error –

shortError

And you can the details which mentions that the current version is too high

expandedError

Conclusion

Plan your upgrade for D365 to v9 such that you get ample time to upgrade the v9 version of your D365 For Outlook too.

Enable Dynamics 365 AI for Sales in v9.1.x

One of the recent offerings by Microsoft is D365 AI For Sales. I saw this available on my D365 Trial instance which is 9.1.x.

I will quickly summarize on how you can enable D365 AI For Sales on your D365 environment having any of the Sales subscriptions.

d365Version

It has features like –

  1. Relationship Analytics
  2. Predictive Lead Scoring
  3. Predictive Opportunity Scoring
  4. Connecting Insights

More about which, you can read from the Microsoft Documentation – https://docs.microsoft.com/en-us/dynamics365/ai/sales/help-hub

Before we begin

  1. D365 AI For Sales is only available in the (NAM) North America region.
  2. You’ll need a D365 AI For Sales license for the same.

Check if Sales AI is available

Quickly, you can check your Settings area if you already see the Sales AI appears or not.
settingsArea

Or you can simply go to the below link to setup a trial for yourself –

https://dynamics.microsoft.com/en-us/ai/sales/

Or even from the Applications screen in the Dynamics 365 Admin Center –

adminCenterOption

Setup

  1. Let’s assume you’re on this page after you go to Settings > Sales AI. You can accept the terms to enable the Embedded Intelligence or even chose to do so later.
    embeddedIntelligence
  2. Moving further, I chose to directly enable the D365 AI for Sales by scrolling further and clicking on Get it now as shown below.
    aiGetItNow
  3. Then, I provided consent and Accepted.
    acceptConsent
  4. Agree to terms and click on Continue.
    clickContinue
  5. While it’s installing, you’ll see this –
    installing
  6. It took about a few hours until it was being setup in the background. Finally, once successfully done, D365 AI For Sales is now available for you to setup and you’ll see multiple tabs where you can configure each of the functionalities separately.
    aiEnabledYou can then choose to configure each of them separately. Hope this quick initial setup info helps!

D365 Admin Center: Instance Picker Link

Navigating to the D365 Instance Picker from the O365 or missing D365 Admin Center still a hassle?

Use the below link to directly navigate to the instance picker. Or maybe bookmark the link, perhaps.

https://port.crm.dynamics.com/G/Instances/InstancePicker.aspx?Redirect=True

instancePickerShortcut

Remember: You’ll need to have D365 Admin Role to be able to access this page.

D365 Quick Tip: Assign your records but keep control

At times, you are asked to assign certain CRM records to other users and you just have to do it as a part of the process.

But let’s face it, you still wonder what might have happened to the record after you assigned it to them but your security roles won’t let you access those.

There’s a general D365 setting for this too! You can share your D365 records with other but still retain rights to yourself so keep track of what happened with those later on

Setting

  1. Navigate to Settings > Administration > System Settings
    settingLocation
  2. In General tab, look for the Setting where it reads as ‘Set whether reassigned records are shared with the original owner’ (quite self-explanatory)
    settingChanged

Assign Record and check Share Rights

  1. Now, assigning a records from Priyesh to John as shown below –
    assignToJohn.png
  2. Priyesh would still have rights to the record. Check the Share status of the same. The record will be owner by John but will be shared with Priyesh too.
    assignedToJohn

Hope this is helpful! 😊

Customize Time Entry form on Calendar View for D365 PSA

Many times, users come back requesting that they need to be able to add types of time entries of their own. Sure, you can modify the Time Entry Type OptionSet that comes with D365 PSA by default. But that will only reflect on D365 Form Level and not where users go to Calendar View to enter time.

Microsoft has provided to be able to customize the Time Entry form on Calendar View too. This feature was released in the PSA release v1.2.1.51
msRelease

Check here – https://blogs.msdn.microsoft.com/crm/2017/07/14/dynamics-365-for-field-service-and-project-services-automation-update-3/

Customization

I’ve added an option called as Comp-Off for the available types of Time Entries OptionSet.
timeEntryOS

But, this is only reflected on the Form level of Time Entry entity and not on the Calendar View. On the Calendar View, it continues to show as below –

defaultTypes

Hence, you’ll need to make changes to the TimeEntryType.js file provided by Microsoft out-of-the-box.

Here’s the script that comes out-of-the-box which Microsoft says you can change to customize –

  1. To make changes, look for this file – “msdyn_/Common/Models/OptionSets/TimeEntryType.js
    jsInSolution
    jsWebRes
  2. Modify this file. By default, it will have this script as shown below –
    defaultScript
  3. So, I added just this one line and mapped it to the OptionSet I created. The value should match the OptionSet value entered in the Time Entry Type OptionSet.
    lineAdded
  4. Save and Publish changes. Check if your new option appears as shown below –
    modifiedCalendarView

Remember: The Calendar View to enter time entries has been deprecated in v3 of PSA. So this customization will not be needed in versions 3.x onward.

I hope this was helpful.

Also,