Featured

Updating Entity Reference Power Automate vs Plugin- Owner

In my last blog, I was getting OwnerType as blank. With help of Microsoft community, I understood that we won’t get the OwnerType from the triggering event output. Ideally it should have directly provided, but since it is not provided, let us use the other way around.

Our requirement is to check the Owner type of the Case record and set the same for the task

After the triggering event, I am using “Get a record” step in my flow and the OwnerType value from this step’s output as shown in below snippet

Again here is a tricky thing to remember. If I directly get the OwnerType field from its output in my next step’s expression, again it would be blank. (Not sure why it can’t be used from output in the expression of next step- I may get the reason and some way around and post it)

Hence after getting the record, I need to get that value in a variable as shown in below snippet

Once I have this value in a variable, I can then use it in any expression in next step

if(equals(variables('Ownertype'),'team'),'teams','systemusers')

I thought multiple times if I should use the if else condition which comes in steps Condition, however when I just need to replace the string based on the if condition and rest of the actions are exactly same, then I won’t recommend to use Condition and use branching with same steps. Instead we can use If condition in the expression

Once I use this condition, automatically, it would pick up the OwnerType based on the Case Owner and accordingly assign the same Owner to the Task, be it Team or User, does not matter. For examples, below the owner is Team , hence its setting as Team.

Now another example is a Case where Owner is User.

Task is getting created with same Owner

Lets also check the flow how its executed

In the post we have seen how we can get the Owner from one record and update the same in another record. Let us continue our Power Automate learning in my further posts

Till that time, happy power automating 🙂 Enjoy new learning!

Business Rules Key Notes

Business Rules, always had love and hate relationship for this feature as a typical developer. mindset, instead of creating step by step business rule using the UI, it would be quick to write a javascript 😊 Having said that from architectural perspective, Microsoft recommends to use the business rules as a first preference for any validation or conditional logic.

When we think about business rules, actually there is no trigger which we can select, It gets triggered based on the change of the field on the form. Visually we can think that business rule is running on the save of the form, but it actually gets triggered on the change of the field used in the condition.

As I wrote above about the trigger, when we want to trigger the business rule on Save of the form, we can not select the trigger, but we can select the scope of the business rule as Entity which would run the business rule on server side and on the save of the form. Lets talk about the scope of the business rule. Scope can be either single form, all forms or entity.

Let us check the below scenarios.:

You create a business rule for the Account entity.

The business rule must run when you import account records. Then the Scope should be set to Entity and business rule should be active

You create a business rule for the Case entity and set the scope to Case. The business rule will run when the form will get loaded and at the change of the field as well

In Business rules , we can perform these actions : Subtract $5.00 from a currency field, Concatenate two text fields, Add six days to a date field. However we can not directly clear a two options field(this is by design as a binary field, either one value should be defaulted to two option field. On another note we can definitely clear the optionset field in the business rule

You can add max 10 number of If-Else conditions to a business rule?

When we need to create a business rule for the account entity that runs both client and server side. Then the business rule scope should be Entity

Hide a section, Show an error message when a rule fails to run ,Hide a tab are not valid business rule use cases , however Show an error message when a condition is met is a valid business rule scenario.

If we create a business rule for the Account entity. The business rule must run when we import account records. Then below are correct conditions The scope was set to Entity and A business rule is active. Snapshot is just pictorial representation of the business rule flow

Which three statements regarding form design or behavior for the mobile phone or tablet application are true? Here are the steps presenting a complete solution. Activities can be modified, tabs do not have the expand and collapse capability, If business rules are changed while the mobile app is open, the app must be closed and reopened for those changes to apply.

You are creating a business rule for the account records. The business rule will perform an acton if the record has country set to the United States and City set to either Redmond or San Francisco. You need to identity the minimum 2 number of condition sets required to implement this logic. We can add multiple rules in a condition, but all can be And or OR, we can not And for country and Or or both cities , hence we have to add minimum 2 conditions for above said conditions

You create a business rule that has a Set business required action for a field. The action has a Status of Business Required when a condition is met. Users report that when that change the value so that the condition is false the Feld is still required. You need to ensure that the field is required only if the condition is true. Then we have to create an Else statement that has no conditions and a Set business required Acton. Configure the action to have a Status to Not Business Required.

You need to implement a process. The process must perform the following:

  • Run when a new account is created.
  • Make changes to the account as the user who created the account
  • Send an email message to the account as the owner of the account. This must be a different user than the user who created the account.

Again this is not a business rule use case . This should be implemented by workflow

You have a business rule that has a scope of All Forms. You discover that the business rule does not execute on forms when users access the forms. You need to ensure that the business rule executes on the forms when accessed bt the users. We need to make sure that the business rule is activated

On the contact entity you are creating a business rule that has the Set visibility action. You need to identify which form elements you can control by using the Set visibility action. We can set visibility only for the form fields in the business rule

You have a custom entity named Event Registration. Event Registration has a relationship with the contact entity. You plan to add a field named Contact Phone to Event Registration. You need to ensure that when a contact is added to an Event Registration record, the phone number of the contact is displayed in the Contact Phone field of the record. If the contact changes the Contact Phone field must display the new phone number of the contact. This is not a Business rule use case. This can be achieved by a calculated field

Business Process Flow Key Notes

When we talk about Business Process flow (BPF) , there are lot of questions :

  1. How does it operate, how is it stored in D365? Does it create a a background entity which can be modified? A BPF creates a background entity when the BPF is actually validated. This entity would have everything same as any normal entity. Only difference is we can not create custom forms this entity and also if we try to open BPF record from advanced find, it will open the primary entity of that BPF.
  2. Can it span across multiple entities? Yes it can span across multiple entities(tables), OOB or custom in data verse. Only caveat is each stage can refer to different entities , and first stage would consist of Primary entity.
  3. Can one entity have multiple BPFs? and if yes can I select specific BPF ? or automate the selection based on some condition? Yes one entity can have multiple BPF, based on security role, the correct BPF(s) would be shown to the user. In case the security role has access to two BPFs on the same entity, user can use the switch process and select the wished BPF for this transaction.
  4. How to apply security to BPFs? In earlier versions of D365, BPFs can be assigned security roles exactly the same we apply security roles to entity forms. However in recent versions, this does not work. This has to be done in the individual security roles under Business process flows. Here the business process flows should be given access same as any normal entity. I have not tried giving the lover level access, it would be mostly the top level (org level) access
  5. Can one BPF have multiple branches based on conditions ? Yes there can be branching in BPFs based on the different conditions
  6. Can it store data out side of data verse ? Nope. BPFs can store data only in data verse OOB or custom entities(tables) but not outside of data verse.
  7. What is concept of immersive BPF in data verse ? If we want to implement independent Business Process for any of the functionality, immersive BPF can be created, which can be added to a separate solution and can be deployed using this solution to higher environments . This would not be added to any form, but BPF itself would have all the required fields added . It can also have custom controls on it.
  8. What is Traversed Path for the BPF ? Traversed path is the comma-delimited string of process stage ids that represent visited stages of the business process flow instance. For example if the opportunity is closed won, then traversed path would contain all the stage Ids stating of Identify and then up to Closed Won. This is very interesting to know about this traversed path as it plays important role in data migration and need to create the BFP automatically for migrated data. In case the migrated opportunity record is Closed won, we have to set the traversed path, otherwise BPF creation would error out

Let us check some scenarios and corresponding solutions

  • To add any field on BPF, field is not needed to be present on form,, it will automatically add in the DOM but will be hidden on the form
  • What can not be done with Business process flow entity can not do?  Only custom forms can not be created , rest all can be done. Also you can not access the form of the BPF in D365 from any App. Its only in design. If you open any BPF record from advanced find, it will open the primary entity form of that BPF instead of the BPF form. For ex, if opportunity BPF is opened, it will open opportunity form
  • If you have been hired to configure a new Microsoft Dynamics 365 implementation for a company. You need to create a business process flow that accommodates multiple work flows, in that case adding multiple BPFs , you can add multiple steps to the BPF and call workflows instead of adding additional multiple linear business process flows. or adding stages to the linear business process flow or adding branches to the business process flow
  • You have a custom entity named entity1 that has three activated BPFs named BPF1. BPF2. and BPF3. You need to ensure that BPF2 in visible only to customer service representatives from the web client. In this case you need to configure the security roles of customer service to have access to BPF2 and rest of the security roles should not have this BPFs selected. Now this is the only way we can secure BPF visibility in D365. Earlier like the entity forms , BPFs were also allowed to select specific roles , however this feature does not work as of today and the changes are to be done only at security role level
  • You have a business process named Know Your Customer. Employees use this business process to capture key information about customers. You must implement a business process flow (BPF) in Microsoft Dynamics 365 that represents this business process. You specify the name for the BPF as well as the stage names, entities, and stage category that the BPF will use. You need to complete the BPF implementation. Following are the three additional components you can configure Step Required, Step Display Names, Data Fields
  • You are implementing a new business process flow (BPF) in Microsoft Dynamics 365. You specify a name and the primary intent for the BPF, and define the stages and conditions.
  • You need to configure the composition so you can configure Workflows and Steps as well as Actions
  • When a business process flow (BPF) enters a specific stage, you need to run a workflow. Then below two actions you have to perform, Select an on-demand workflow to run and add a stage specific workflow composition component.
  • You need to provide users that have the Sales manager security role access to multiple business process flows (BPFs). Here Users can select a default BPF for all records and If a user does not have access to the current process that is applied to a record, options will be disabled. You are a subject matter expert for an insurance company. You have a complex business method that is used for settling and releasing claims. You need to create a process in Microsoft Dynamics 365 to assist team members with the claims settlement process. You must limit this process to team members that have a specific security role. This is perfect use case for Business Process Flow (BPF)
  • You are implementing a Lead to Quote business process. The process will update the Lead. Account Contact, and Quote entities. You need to create a business process flow (BPF) that spans the entities. then you have to add a stage and specify the properties for each entity.
  • You need to create a business process flow (BPF) that spans multiple entities. In this case, you can include a maximum of five entities and there is no limit to use same entity multiple times .
  • The system must send a notification to the manager 24 hours after an opportunity Is created based on the date of the next best action. This not BPF use case, instead its async workflow

Reference links

https://coderscollection.wordpress.com/2019/01/26/some-important-facts-about-bpf/#:~:text=No%20Max%20limit%20of%20Draft,multiple%20stage%20for%20Same%20Entity

https://community.dynamics.com/enterprise/b/365teamblog/archive/2016/11/14/get-started-with-designing-dynamics-365-business-apps-by-using-app-designer