Solving ‘The record could not be deleted because of an association’ error in D365 CE

Restricting Delete for child records is something customizers should start paying special attention towards defining 1:N relationships for entity records.

System Customizers often design this on purpose so that you are aware that the record you are deleting has child records associated with it and cannot be deleted.

Let’s consider this scenario  – Account is a parent of Subscription (which is a custom entity)

relationship

 

Error

Assume, Subscription 1 record has Account lookup to record A. Datum Corporation. When you attempt to Delete the Account, you get this error message.

actualError

And when you download the Log File from the button on the error message, you can see at the very bottom on the Log that Cascade Delete failed due to the restriction.

It also mentions what child entity is causing it
highlightError

Reason

The reason being 1:N relationship on the Account entity to Subscription entity.

deleteRestrictionInRelationship

Workaround

Now, since this is a Restriction on Delete, you can either change it if you are allowed to modify the behavior and it should be fine
changeableBehavior
However, some system relationships can’t be changed. Example – Opportunity to Quote relationships
systemRestricted.png

To overcome this, you can remove the Opportunity Lookup value on the Quote entity and save the record.

Then, the parent Opportunity can be deleted.

Hope this helps!

Advertisements

Date and Time field’s Time-Zone behavior in D365

In most cases, customizers/administrators leave the Date & Time field as Local without paying much attention to detail.

types

With involvement of time, there are 2 behaviors while creating the field (or changing them, but there’s a catch)

You can change from Local to Time-Zone Independent any time, but can’t change from Time-Zone Independent to User Local once saved this way.
cantChangeBehavior

User Local

The Date & Time displayed in this field will be converted to the time-zone you are situated in.

localTime

Let’s say, the Date & Time is stored in UTC behind the scenes was 25th June 2019 6.30 PM, so whatever was stored, it will be converted to your System User’s local time according to the Settings. See below –

myTimeZone.png

Time-Zone Independent

This type of Date & Time of field, the time is stored in UTC, regardless of where you are located in the world.

timeZoneInd

If it is 6.30 PM on 25th June in UTC, it will be 12 AM in India on 26th June

 

It’s pretty basic, but needs to be done carefully!

Hope this helps.

Execute an Action from a Business Process Flow

One of the easiest and useful feature of a Business Process Flow is being able to Implement and Action right from a Business Process Flow just with a click of a button.

Here’s how you do it.

Let’s say you have an Action that you want to trigger that the Account was Approved for some sort and you want to alert the Stakeholders. You can have this functionality in your Action and call the Action from the BPF itself.

Action

  1. Let’s say your Action has some logic as below which you want to execute when you trigger Action on BPF
    actionLogic
  2. Make sure your Action is marked as below for it to be enabled for adding in a BPF
    enableForBPF

Once this is set, let’s move to the BPF part.

Business Process Flow

  1. In a BPF, since you have enabled your Action to be added to BPF, you’ll be able to add it as below.
    addActionStep
  2. In the Properties, look for your Action Process and select it and click Apply.
    actionFound
  3. Make sure you’ve clicked on Apply.
    apply

Now, you’re all set. Let’s see how it works.

Execution

Now, this is how you’ll see your Action on the BPF on the record,

executeButton

When you click on Execute, it will mention (if you don’t have any Input parameters) that there are not parameters and ask for Confirmation
noInputParameters

Once you confirm, this is how it will show while executing –
executing

 

If there’s any failure, it will show as below
executionFailure

 

And success like this
success

Simply click and the Action will execute!

Hope this helps!!

Curious Case of the locked fields in D365 – Quote ID example

So, I struggled some time in trying to make something just work as it was supposed to work. And for no conscious reason, I was able to figure out why.

As to why my Quote wouldn’t save and auto generate the usual Quote ID? It kept asking me to enter it!

Problem

OOB, Quote ID is locked and is auto-generated when you save the record.
newForm

Instead, I got this
cantSave

And asks me to enter Quote in the field again.
enterQuote

Ideally, if you have a required field locked, you can save it and the form won’t force you.
fieldIsLocked

But, nothing would work.

After much hassle, I finally noticed the culprit lying in plain sight. Let’s look at why this was happening.

Culprit

This happened because the same field was on the Business Process Flow and was unlocked
quoteOnProcess

That was the issue. As a part of the requirement, I had put it there, but either didn’t lock it or shouldn’t be there.

I just removed it since it wasn’t a big deal and things were fine now.
savedQuote

Hope this helps you! 🙂

Import Time Entries in PSA from your Bookings in D365 PSA v3

Often, one of the real-life scenarios is making time entries by either remembering what you did the whole week or looking at the Schedule Board and based on what you were booked, making each Time Entry in PSA manually.

Tiresome and inefficient, right? Not any more, a cool feature let’s you just create Time Entries in PSA v3 by a single click.

Now, let’s say your Bookings look like the below. I’m booked on 2 projects across the week.

scheduleBoard

And now let’s see how we import these.

Import Time Entries

  1. Let’s see you want to make time entries now based on you Bookings in D365. On the Time Entries scree, drop down to the arrow besides Import.
    dropDown
  2. Select Resource Bookings. (Obviously, like this method – you can import from Resource Assignments and Outlook Sync too! But we will keep that for some other day)
    importFromBookings
  3. Then, you can select what all Time Entries should actually make it to the records. So you can select the ones you need and leave the rest.
    summaryOfImport
  4. Once you click on Import, it’s done! Time Entries are created.
    imported

Works like a breeze!

Geo Coding addresses in D365 v9.1 with Unified Interface

Very straight-forward and useful feature is Geo Coding addresses on Sales, PSA & Field Service entities. Like, on Account, Work Order etc. entity. Let’s take an example of Account in this article.

button

Enable Geo Coding

Geo Coding first, needs to be enabled in D365. If you try to access the Geo Coding feature, you’ll be treated with this error –

error

So, let’s do the following –

  1. Navigate to the Resource Scheduling app –
    resScheduling
  2. If you are in the Unified Interface, make sure you switch the Area to Settings and then select Administration
    settingsSwitch
  3. Then, Scheduling Parameters
    schedulingParameters
  4. In Resource Scheduling, flick the Connect To Maps to Yes, read the warning specified and confirm if you are ok
    connect.png
    warning
    That’s it.

Using Geo Code

  1. Once enabled, you can click on the Geo Code ribbon button on the Account record.
    button
  2. And, it will pick the address you entered and show the Latitude and Longitude for the same. You can simply click OK once the details look correct to you
    latLong
  3. The same will show on the fields on the Account entity
    actualFields

Hope this helps!

D365 Quick Tip: Hide Dashboards in D365

This being an obvious approach to how Dashboards are by default seen by all. And how you can disable/hide for users. Even for D365 System Administrators!

Unlike usual forms, view or other records,

ribbon.png

And Deleting the Dashboard isn’t an option.

Enable Security Roles way

So a simple trick is to remove entire access from Enable Security Roles

enableSecurityRoles

Make sure Display only to these selected security roles
selected

And then just untick if you want to provide no access to anyone

removed

Hope this works!