3 Minute Features : Episode 7 : Forms Pt2

This is the second part of the Forms feature, highlighting some useful tips & where to start when Business rules is not enough.

Episode 7: Forms Pt2

Transcript

With forms, if business rules don’t meet your requirements, you may have to resort to Javascript. These little code snippets allow you to do pretty much anything on a form that is not possible in business rules, but be warned, Javascript nowadays is frowned upon. It is code for a start, so you need a skilled professional to create and maintain it. Use it as a last resort.

Each form has a library of files you can upload to it, each file containing one or more functions. Each function needs to be associated with an event, such as the load event of the form or a change event for a field.

You can also establish form parameters, which can be used by your scripts. Say you want to ensure only if the user comes from another form, you can use this to pass history from the other form.

Non-event dependencies are a list of fields that are required by scripts. Adding a field to the list locks it to the form.

Back in the maker experience, there are few nice functions to make your life as a designer easier.

In the bottom left is a selection which allows you to visualise how your form will look at certain aspect ratios. As this is the new world of unified interface, this form will be rendered on a phone or tablet as well as a desktop. Here, as the form size is changed, the header section is displayed as the first section. Phone is also the size used for the outlook client.

Header can also be altered, fields added. As you add more than 4 fields, you get a prompt, letting you know that this new field won’t be directly visible on the form, but part of the flyout only. Opening the app, you can see this.

The default option is high density, as we just saw, but you can also choose to untick this to go back to the previous way. This means the fields are editable in the header, but take up more space. Depends on what you want to achieve in your layout. As you can see, as I was in responsive mode, the header gets shifted to the first section of the first tab

In the user experience, now that we are not in high density mode, the fields in the header are editable directly, with the 5th field being available and editable in the drop down

There are 4 types of form you can create. We have mostly been working with Main forms, the default wide forms which we are used to.

Quick view forms are those to show data from a parent entity.

We can also have Card forms, which appear when the user is displaying a list as a series of cards. Generally, if there is not enough space to render a list properly, the UI will shift to display it as a card view.

To show this, on the account form, I add a quick view form to the form, choose the related entity and the form to display.

Also, we can add a new grid to show off the card view. This, as there is little space in the thin column, uses the card view form.

Quick Create is a form which you first have to enable on the entity by editing the properties of the entity.

Once enabled, you can create a quick create form, add some fields to it and save.

When you select quick create on a grid now, it will display a form to the right of the main form, allowing you to quickly add information, and automatically link the new record to the main entity

3 Minute Features : Episode 5 : Views

In the fifth installment of this series, I look at views. How to design them and where they are used.

Episode 5: Views

Transcript

Starting on the entity, go to Views

This lists all the system views that are associated with our entity. These are generated when you create an entity. Some of them are normal, views that represent data to the user when they view lists. Some have special uses, which I will go through at the end

Lets start with a new view

Give your view a name, meaningful for what it will be doing, hit create

As you can see, it now displays the defualt field of your entity, name. It is also showing you data from your live system, so you can tell if you need to adjust layout to fit your data

Some fields, the ones that are added by the system, are hidden, so change the selection to All. Then, it is as simple as drag and drop to add a field to the view.

You can use the drop down on each field to change the width, or drag the handles. You can also drag and drop to change the order. Delete the column by the drop down.

On the right or on the field, you can define the sorting. This changes the sorting by first ascending then descending if you repeat the action. The sorting is only by fields visible in the view. You can add further sort criteria as well.

Filtering of the view is fundamental. Select Edit Filters. I want to show only my approvals, then add row. This is a simple field chosen on the entity at the moment. Select the field, then the condition. There are some special ones when working with user records to define it as the current user

Hit Ok. Notice that the displayed list is filtered straight away, helping you to quickly visualise what it will look like. Back in filters, we can do lots of more advanced filtering, such as filtering on a parent or child entity. We can also group conditions to allow for complicated expressions using Or and And parts.

Once we are happy, hit save, then publish so we can check it out in our app

When we got to My Things now, in the view drop down, there is a new selection

I can chose this and get my filtered list. The end user can add additional filtering as needed or resize columns, but the fundamental filter is kept.

Back to our maker experience, to add a field from a parent entity, by selecting related. Here I add the primary email of the approver to the view, which allows me to see parent information on the child record. Just that, no child information or many to many information is available.

Just to show you the lookup view, I connected account to My thing via a relationship. On the account form, the list of fields displayed when selecting my thing is defined as the lookup view.

Quick view and advanced find are the views used for those particularly capabilities in the app. Feel free, and you should, update these to your business needs.

Users can also make their own views (subject to permission), by selecting Create View in any view. Their interface is not as pretty as the maker experience, but would assume this is coming.

They can base the view on an existing view. Then ammend a filter. Hit save, give it a name and close.

This new view is available under the drop down under My Views.

If you go back to Create Views, under saved views, select the view you just created and you can hit Share, which allows you to share the view with a colleague or team of colleagues. You can also allow them to edit this view.

3 Minute Features : Episode 4 : Business Rules

Wearing ties is a rule that is just bonkers, and not allowing working from home. Thankfully those in CDS are a little more understandable.

Welcome to the 4th video in the 3 minute feature series, on Business Rules

Episode 4 : Business Rules

Transcript

Starting from the Entity, select Business Rules, Add Business Rule

At the top is some tools which we will use later

The first part is a condition, what combination of fields will make the rule trigger. This can be a combination of fields, either both values or one or more of the values

In my scenario, I am going to worry about the status reason for my thing, mimicking an approval process. So, firstly, is the status reason waiting approval?

Then our first action. I want to make the Approver field business required, forcing the user to enter a value.

Next, make the default value of the log field Waiting for approval. Setting values is very limited, you might want a timestamp here, but this is not possible in a rule.

Next, the 2 approval fields need to be visible, allowing my user to enter the values

Now I have achieved everything I wanted on this condition, lets move to th e next condition. If it is not “waiting approval”, check to see if it is approved

Add a condition to the negative side of the first condition, select eh status reason & a different value

This time, we want to still ensure the approver and the log are visible, but lock them both, stopping once it is approved anyone changing the value

But what would happen if the status reason was switched back to waiting approval from approved? The first condition path does not unlock the fields, assumes they are already unlocked. This should be fixed. The business rule editor allows you to copy actions and conditions. Click on the action, select copy.

The select paste. The rule editor then asks you where to paste it to. Select the + where you want it.

We want an unlock rather than a lock, so swap over the action.

Repeat for the log as well.

We can use this techique to cover all the basis, or the default condition, where it isnt Awaiting approval or approved. Copy the Set Business Required, past on the negative condition. Rename it to show we care about maintenance. Same for the show approver and log actions, with the value set to hide.

Once we are done, hit save. This runs a validate as well, proving that there are no missing parts to the actions or conditions. You can rename the rule by dropping down the top option.

This rule is not active yet, we need to activate it, but first the scope has to be considered. Do you want this rule to apply to any time a record is added or updated anywhere in your system, such as imports etc or just when using a form, or just one specific form.

Finaly, Activate. Once activated, the rule can not be edited, only deactivated.

This is then ready to be tested.

I create a new Thing. The default negative path is running now, hiding both the approver & log fields.

As I change the status reason to Waiting approval, the first postive branch kicks in, showing the 2 fields and making the approver mandatory.

If I move it to Approved, the approver is locked, but the field remain visible.

There are a few more options for you in actions, around the suggestions and warnings, so lets edit the rule by deactivating first.

Lets show an error message to enforce that the approver is required. Against the field and a custom tesxt.

Also, we can recommend a value in this condition for multiple fields.

Under details, you can add one ore more defaults for fields, I will just recommend a title for now

Hit Save, then Activate again and lets see it in action

Where the status reason is waiting approval now, we get an error on the approver field, alerting us we need to fill that in. Also, there is a little light bulb that appears against Name, if you click on it, there is a button for you to fill in the form with the fields that we set up

Back to the business rule, there is a snapshot button. This creates a picture of your full business rule to share with others.

3 Minute Features : Episode 3: Relationships

Relationships are difficult, will she go out with you? Are you good enough? Does he want to propose?

Those in CDS are a little less complicated, but only just.

My next 3 minute feature tries to give you an understanding of relationships

Episode 3: Relationships

Transcript

First, lets explain a relationship

The simpliest relationship there is in the Common data service is account to contact An account can have 0, 1 or more contacts. You could infer properties of the contact to be the same as the account. This relationship in CDS is called a 1 to many relationship if you take the relationship from the prospective of the account.

From the contact, this is a many to one relationship, as many contacts will be associated with the same account. The same relationship, looking at the contact, would be a many to one relationship

If, and this is pretty standard, a contact may have a relationship to many accounts, you can create a many-to-many relationship. This way, a intermediary table holds two relationships between the two entities in question.

Going back to my solution, select my entity I have been creating and then relationships.

As you can see, there are already a lot of relationships. These are created for you as you created the entity and selected some options. Connected From and To for example is because we ticked the box to Enable connections on the entity.

Select Add relationship, then start with a Many-to-one. On the right hand side, you firstly need to select the related entity. As we are creating a many-to-one, where MyThing entity is the child, CDS will create a new lookup field on the child entity and give it a name and label both of which you are welcome to change

In the general section, this is the name of your relationship itself. The default is very long winded, so I would advise to shorten to something more useful.

Advanced options are where the relationship behaviour is defined. This is a set of options to automatically control the relationship. Parental is the default, but to understand what this means, lets look at all the options available in Custom

The first is Delete. If the parent entity is deleted, what do you want to happen to the child? Delete the child as well when the business logic does not need orphaned records (for opporunity and opportunity lines for example) . Remove link will just make the child link to the parent null. Restrict will prevent the parent from being deleted if there are active child records present.

The second is Share. The options here either share the child record with the same as who has just had the parent record shared with them (would work with account and opportunities for example), share only active records with them, share only those records owned by the owner of the parent record. None ensure that the share doesn’t get cascaded.

Reparent is next, this works exactly the same as share, either changing the owner on all, active or user owned or none of the child records.

Assignment works the same as share, if the parent record is assigned, do you want to assign all / active / user owned or none of the child records. This could work with tasks associated with cases.

Finally unshare, which is the opposite of share.

There are 2 standard options available to you as well, namely Referential and Parental.

Referential has Cascade None for each of the Assign, Share, Unshare and reparent but with Delete as remove link or restrict

Parental has Cascade All for all options, including delete.

A word of caution here, a child entity can have only 1 parental entity, where you can cascade sharing or assigning. If there are 2 relationships, you will have to decide which one is the one you would like to use to cascade logic.

Relationship configured, I will hit Done. The new relationship is highlighted in bold.

I will quickly create a many to many relationship. Here after selected the related entity, you get to enter a relationship name as normal (noting the physical table name) and the new entity name you would like to create to serve as your intermediary table. Not there are no behaviour options here.

Finally through the one to many relationship. This behaves the same as the many to one, but you are creating the lookup field on the child entity, which is the entity you select. You have the option to select behaviour type here as well.

Hit Save entity to commit your changes to your environment.

Going back to the solution, you can see it has automatically included the three entities I chose as related entities to my solution, as we are configuring them as well.

3 Minute Features : Episode 2 : Fields

This is the 2nd installment of my 3 minute feature videos, going into detail about the different field types, how they appear on the interface and some other useful stuff.

Episode 2: Fields

Transcript

Starting with the new entity I created last time, select new then field.

This pops up a form to the right, which has a display name and field name for you to enter the detail. The Name can not be changed once you hit save.

Next is the type, as you ca n see there is a lot of them. To demonstrate each type, I added one of each to a modal form and display on the right how the default for each type behaves.

There are certain properties for fields that are always present.

Required ensures that there must be data in this field when saving

Searchable means that this field is visible for all users who have entity access in views and advanced find. Usually this will be ticked

Calculated or Rollup Fields allow you to summarise other fields to suit your business needs. This is only the tip of the iceberg and I will do a video on this soon

Under Advanced options, give your field a description. The other options available depend on the field type you enter.

Here, a simple text field has a maximum length. Be conservative over your field sizes as a best practice. Text has a max size of 4000 characters.

 On the form this is rendered with only 1 line.

The Text Area has the same restrictions as Text The designer can decide how many lines to display.

Email is still a text field in the backend database, but is rendered with a control allowing the user click and email from the page

The same for URL, popping open the website.

Ticker Field links directly to the MSN Money website to give a quick view of the stock

Phone allows interaction with your telephony provider or Teams etc to direct dial the number

Autonumber effectively gives each record a more user friendly or quotable reference to the record. This is great for case management type activities. You can establish what the prefix is and the number range. It gives you a preview of the format. On the form this “number” only appears when you save the record.

The first number format is Whole Number. This does not allow decimal places to be entered and you can also establish a minimum and maximum value which helps with data entry. A warning to the user when the entry doesn’t match is given.

Duration is a sppecial field which allows the user to select a duration from a drop down, the result is stored as a number in the database.

Timezone presents the user with a list of international time codes and the database stores just a numeric representation of it.

Language is similar, with only organisation enabled languages listed

Date and time presents the user with 3 controls. A date picker and hour and minute drop downs. The Behavaiour option means that the data is stored as a Coordinated Universal Time and translates it to the user current time zone or you can say it is independent of the timezone, recorded and displayed as entered.

IME Mode is applicable for all text fields, and it allows asian characters sets to be visible or rendered. Very advanced and if it effects you, you will probably already know how to configure it.

The next type only renders a date picker, but still has the behaviour for time zones

Currency is a numeric data type, but also creates a couple of extra fields when you hit save.. As the user enters the data, it is saved in the currency selected and also calculated and stored in the base currency of your system. This allows you to rollup opportunities etc in a common currency

Customer is a special field that can either have a lookup to Contact or Account. The user can choose either. This field is useful for opportunities or other activities where sometimes you may link to one then the other.

Decimal number allows you to define min & max again, but also how many decimal places These number types are limited to + or – one hundred thousand million, with upto 10 decimal places.

File is next. File is only used, currently, in Canvas apps and flows, so not on my model driven form. It stores binary data and has a max file size of128Mb. Useful for capturing images, pdfs etc in a Power App.

Floating point number is very similar to Decimal having the same restrictions, but is only stored as an approximation to your real number. This is done for performance reasons, normally there will be no difference to the end user. On rare occasions when you are dealing with large numbers that this may be of concern

Lookup field link records together. This creates a parental relationship to the entity you select,This is a simple way of working with relationships, again a topic for a future video.

Multi-option set is a great tool for data entry. The customiser decides on the options that they want to display and it is presented as a list where they can chose one or more of them. The options are stored globally across your orgainisation, allowing reuse

Multi line text is for large paragraphs of text. You are limited to a million characters in this.

Option set is identical to the Multi version, but restricts the user to only one choice.

And finally two options is a specific option set for yes / no or on / off options. You can establish how these values are displayed, the user toggles between the two.

Now that we have gone through the options, I’ll hit save. At this point, the field is not created. It is highlighted in bold to show those that have not been saved yet. You can go back and tweak the properties before you hit Save Entity