{Power 2021} Clear and Update Custom queue field on Case based on Queue items related to the case

Pre-requisites:

  • Should have “Customer Service Hub” app installed in your tenant
  • Add out of box “Case” entity in your solution
  • Create a custom lookup field (Lookup to Queue) titled as “Queue” under Case entity and place it on “Case for interactive experience” form

Requirement:

  1. The Queue to which Case is assigned should get displayed under Queue lookup field
  2. If we are closing the Case as “Resolved” or “Cancel” – Queue lookup field should be set to null

Implementation:

Now, we are creating an “Automated Cloud flow” to implement above 2 requirements mentioned above:

  • Open Solution >> Select Cloud flow from left navigation (Make sure you have selected the correct environment)
  • Click on drop-down arrow next to “New” button >> Select “Automation” >> then select “Cloud Flow” >> then select “Automated Cloud flow
  • Now, give name to your Cloud flow and select the trigger action of Microsoft Dataverse i.e., “When a row is added, modified or deleted”. In our scenario, we are triggering our flow if a Case is added to Queue which means whenever a Queue Item has been created under respective Queue. Then, click on Create.
  • Rename the trigger action as “Whenever a Queue Item record is created or modified.
  • Select “Added or Modified or Deleted” under Change type
  • Select “Queue Items” under Table Name
  • Select “Organization” under Scope
  • Enter “statuscode” (which is logical name of Status field of Queue Item table) under Select Columns

Then click on “New Step”

  • Now, select “Get a row by ID” to get Case details and select “Cases” under Table Name and “Object (Value)” under Row ID. Select “New Step”.
  • Now, select “Get a row by ID” to get Queue Item details and select “Queue Item” under Table Name and “Queue Item” (unique identifier) under Row ID. Select “New Step”.
  • Now, select “Get a row by ID” to get Queue details and select “Queue” under Table Name and “Queue (Value)” under Row ID. Select “New Step”.
  • Select the “Condition” and add the condition where if Status (Queue Item) is equal to “0” i.e., Active. If the condition will be true, “Yes” part of the condition will be continued else it will go under “No” part
  • Click on “Add an action” under “Yes” part and select “Update a record” action.
    • Select “Cases” under Table Name
    • Select “Case” (Unique Identifier) under Row ID
    • Add “queue(QueueValue)” under Queue field

Scroll down a little and see the option of Queue.

  • Click on “Add an action” under “No” part and select “Update a record” action.
    • Select “Cases” under Table Name
    • Select “Case” (Unique Identifier) under Row ID
    • Add null expression under Queue field

Scroll down a little and see the option of Queue.

  • You may now save and test the flow.

Testing:

  • Create a case record by clicking on “New Case” button.
  • Add a Case to Queue by clicking on “Add to Queue” button from ribbon. Here I have a “Test” Queue, so I am using that
  • Now, Queue field which is placed under Case form should be auto populated with respective Queue.
  • Now, click on “Resolve” or “Cancel” option from ribbon
  • Now, check record becomes read-only, and the Queue field is automatically be set to null.

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image009

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to assist, Please fill the following form for your business needs: Click here

clip_image011

{Power Integration}Email notification to all Queue Members on assigning a Case to Queue

Business requirement:

Email notification to be sent to all the Queue Members on assigning a Case to Queue.

Solution:

1. Add a step “When a row is added, modified or deleted” then rename it to “Trigger when a Queue item is created” and enter the following details:

Change Type: Added

Table Name: Queue Items

Scope: Organization

clip_image001

2. Add an action “Get a row by ID” and rename it as “GetCaseDetails” – This step is used to get a case record details:

Table Name: Cases

Row ID: Object (Value)

clip_image002

3. Add an action “Initialize Variable” and rename it to “Get all the emails of Queue Members” – This is used to store emails of all the queue members

Name: Queue Members Email

Type: String

clip_image004

4. Add an action “Initialize Variable” and rename it to “Record URL” – This is used to store the URL of Case record

Name: Case Record URL

Type: String

clip_image005

clip_image006

5. Add a condition to ensure when the type of record is case or not.

clip_image007

6. Under “Yes” part of a condition, add an action “List all records” and rename it to “List all members and their emails” – This is used to get all the users (Members) and their emails which we’ll use later. We may first need to fetch XML query.

Table Name: Users

Fetch XML Query:

<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”true”>

<entity name=”systemuser”>

<attribute name=”fullname” />

<attribute name=”systemuserid” />

<attribute name=”internalemailaddress” />

<order attribute=”fullname” descending=”false” />

<link-entity name=”queuemembership” from=”systemuserid” to=”systemuserid” visible=”false” intersect=”true”>

<link-entity name=”queue” from=”queueid” to=”queueid” alias=”ad”>

<filter type=”and”>

<condition attribute=”queueid” operator=”eq” uiname=”Queue Name” uitype=”queue” value=”{@{triggerOutputs()?[‘body/_queueid_value’]}}” />

</filter>

</link-entity>

</link-entity>

</entity>

</fetch>

clip_image009

7. Add an action “Apply to each” and select the “Value” which we are getting from previous step (List all Records) then add an action “Append to String Variable”

under Apply to each and enter following details:

Name: Select “Queue Member Email” variable

Value: Add following expression

concat(items(‘Apply_to_each’)?[‘internalemailaddress’],’;’)

clip_image011

8. Add an action “Send an email (V2)” and enter the required details:

To: Queue Members Email

clip_image013

9. Save the flow and test it.

clip_image015

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

image

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

{Power Integration} Create Teams meeting based on D365 CE Appointment

Business Requirement: Whenever Appointment is created in D365 CE, send Teams meeting invite to everyone and also update Team meeting URL back to the appointment.

Note: Server side sync is not enabled at the client tenant for Appointments.

Solution:

Step 1: Create an Automated cloud flow and set trigger as follows:

clip_image002

Step 2: Set the trigger condition as follows:

clip_image004

Step 3: Next step is very important; we need to route through all activity pointers to get email addressed of the attendees.

Filter to be used is _activityid_value eq

clip_image006

Step 4: Now we need to initialise variable to Append all List of Attendees:

clip_image008

Step 5: Loop through all returned Activity pointers and keep appending email address of the attendees into the string variable:

clip_image010

Step 6: Create Teams meeting as below. Note the formulas will need to be used to map start and end time.

formatDateTime(triggerOutputs()?[‘body/scheduledstart’],’yyyy-MM-dd HH:mm:ss’)

formatDateTime(triggerOutputs()?[‘body/scheduledend’],’yyyy-MM-dd HH:mm:ss’)

clip_image012

Step 7: update the appointment back with the Team meeting url by Updating the description:

concat(triggerOutputs()?[‘body/description’],’Click here for Team meeting url: ‘,outputs(‘Create_a_Teams_meeting’)?[‘body/onlineMeeting/joinUrl’])

clip_image013

Final Flow should look like this:

clip_image015

Result:

Now let us go and create appointment in D365:

clip_image017

Let us see the Teams calendar now:

clip_image019

Let us see Appointment description below in D365:

clip_image021

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

{Power Milestone}Half a million views and a Thank you note!

Thank you note for all the readers of CRM community and Microsoft, I crossed half a million views on my blog and was read in 191 countries in its journey so far.

image

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

{Power 2021} Trigger on save notification only when certain fields change in Model driven App

Business Requirement: Show notification in model driven form on save of table only when particular field/attribute has changed.

clip_image002

Solution: In Dynamics 365 , we can achieve this requirement using following script:

// function to show notitification on save
function onSave(executionContext) {
var formContext = executionContext.getFormContext();
var field = formContext.getAttribute(“fieldname”);
if (field.getValue() == VALUETOMATCH && field.getIsDirty())
{
var message = “Field name has changed”;
var messageString =
{
confirmButtonLabel: “Ok”,
text: message
};

var messageAlertOption =
{
height: 120,
width: 260
};

Xrm.Navigation.openAlertDialog(messageString, messageAlertOption);
}
}

Register this on save and show alerts based on field changed.

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

{Power 2021} Prevent auto save on specific entities in Dynamics 365 CE

Business Requirement: Client wanted to disable auto save on certain Sales entities such as Leads and Opportunities so that it is sure that user has completed all the information. On all other entities, client requirement was to keep auto save.

Solution: We have to write a small client-side script and register it on save event of Lead and Opportunity record to achieve this requirement.

Here is the script:

function preventAutoSaveOperation(executionContext)

{

var eventArguments = executionContext.getEventArgs();

if (eventArguments.getSaveMode() == 70 || eventArguments.getSaveMode() == 2) {

eventArguments.preventDefault();

}

}

In case you are looking for different types that getSaveMode returns here is the complete list:

Value Save mode Table
1 Save All
2 Save and Close All
5 Deactivate All
6 Reactivate All
7 Send Email
15 Disqualify Lead
16 Qualify Lead
47 Assign User or Team owned tables
58 Save as Completed Activities
59 Save and New All
70 Auto Save All

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image002[4]

{Power 2021} Get current App details in Model Driven App and D365 client-side scripts

In a recent project there was a need to know Model driven App name in client side script.

We can achieve the requirement using following script.

In this example I have alerted App details on Load of a custom entity titled “Visit” under a Model driven App called “Visitor management”.

Here is the output:

clip_image002

Here is the script:

function onLoadApp()

{
var globalContext = Xrm.Utility.getGlobalContext();
globalContext.getCurrentAppProperties().
then(

function successCallback(app)

{
var message = “App Display name: ” + app.displayName + “\nApp name: ” + app.uniqueName + “\nApp Id: ” + app.appId;
var messageString =
{
confirmButtonLabel: “Ok”,
text: message
};

var messageAlertOption =
{
height: 120,
width: 260
};

Xrm.Navigation.openAlertDialog(messageString, messageAlertOption);

},

function errorCallback()

{ console.log(“Error”);

}

);

}

Other details that are accessible in the app object are mentioned below:

· appId

· displayName

· uniqueName

· url

· webResourceId

· webResourceName

· welcomePageId

· welcomePageName

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image004

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image006