首页 > 其他分享 >Approval action add link to model driven record

Approval action add link to model driven record

时间:2023-04-07 15:24:02浏览次数:49  
标签:will Item driven record add link action Approval

Shows an animated gif where inside the MS Teams approval center we click the record URL and the Model-driven App is opened for us.

When you are deciding if you want to approve an action, you probably want more information then a description. Luckily we can add a link to our Approval request! This is a follow up on my previous post where I showed how to trigger an Approval inside a Business Process Flow. In this blogpost I will show you how to generate a link to the record we are working on.

This blog is part of a series about guiding users and teams through their work. This post is about Approval Flows inside Business Process Flows. Click here for an overview of all related post regarding Approvals inside your Business Process Flow. I also added a sample solution you can import in your own development environment so you can see the entire concept in action!

Keeping people in their flow of work by utilizing Asynchronous work or asynchronous processes is one of the key benefits for Business Process Flows. I have written down my thoughts on this subject here. Find out what asynchronous work is, how Business Process Flow can help and more advanced scenario’s.

The Item link property

As mentioned in the introduction, it is very convenient to be able to navigate to a record when you want to give approval. As a manager you can view all related information and see if everything is in place.

Shows the Power Automate Action Start and Wait an Approval. With a highlight on the properties Item Link and Item Link Description to show what we need to fill in for a link to appear in the Approval.Item Link in Approval Action

To do so we can fill in the Item link and item link description of the Approval action “Start and wait for an approval”. The Item link property is for the URL and the description is the text that will be shown for the hyperlink.

Shows an extract of an Approval e-mail where we can see the Link the item link property generatesEmail with an Approval Link

However we do not know the record link inside the Approval flow. We will need a few tricks to generate the link to the Model-driven App record. It is also important to keep in mind that this Flow needs to work across multiple environments as we are currently working in a development environment. When I transfer our solution to the test or production environment I do not want to manually change the URL

Examine the Record Url

Let us first take a look at the URL of a model-driven app record as we want to replicate this in our Item Link.

Highlights the URL in a browser which has a record opened in the Model-driven AppRecord URL in the Model-driven App
https://orgff248fa5.crm4.dynamics.com/main.aspx?appid=30bf5a45-388e-ec11-b400-000d3a448670&pagetype=entityrecord&etn=bdenb_case&id=ee2b65f2-b4d8-4b23-ae8f-4138bf0f6fe9

There are a couple of properties which are dynamic and which we need to change:

  1. “orgff248fa5”. The environment name of your Power Platform. If you are not working on a developer environment you probably have set this to a more readable name 
  2. “appid”. The Model-drive application Id which we want to open. If there is only 1 application in the environment you could skip this. However I recommend to set this as well, it’s only 1 extra step in your flow.
  3. “id”. The Id of the record.

Grab the current URL from a Dataverse action

To get the environment name we are working in, we can use a little trick. This trick will also give us the base part of the link to the model-driven app we eventually need. In the outputs of the update action we get a few URLs we can use. For example the OData ID we see below. This is actually the direct API link to the record we just updated.

Shows the OData Id Outputs property of the update action.OData Id property

To use this URL in the Link we build op later we have to put it in the Compose action. This will change it from an object to a string.

Shows the Power Automate Compose action where we add the OData Id property to use in the Uri Host in a later step.Compose OData Id

When we build up the Link we will use the function function “uriHost”. This function will give us the base part of the URL. In our example this will give us: “orgff248fa5.crm4.dynamics.com” and thus gives us the Environment name too!

Retrieve the App Id stored in Dataverse

Nowadays we build multiple Apps on the same environment. Apps specific for a certain use case or role. This however makes it required to add the AppId in the Link we want to build up. Luckily all the Model-driven Apps are stored in Dataverse in the table Model-driven Apps. So we can retrieve them using a List Item action:

Shows the Power Automate Dataverse Action List Records. This is used to retrieve the AppModuleId from the table Model-driven Apps. Filtered on the "uniquename eq 'bdenb_CaseManagement'".Get Model-driven App Id using the list action

We only need the appmoduleid as this contains the Id we need. So we only select that column. I actually found out about this table by a blogpost from Sara Lagerquist. It contains the following quote:

“The List Record action is not a buffet, it’s an a la carte menu. You do not order the whole menu of food and then pick an choose what to eat. That would be too expensive. You decide before hand what to order and make sure you consume it all.”

Sara Lagerquist

Which of course is good practice for performance of your flow. The filter uses the “Name” and not the “Display Name” of the app:

uniquename eq 'bdenb_CaseManagement'

Building the Url for the Item Link

Now that we have all the necessary properties we can build up the Url for the Item Link. For readability I like to use a specific Compose action for the URL. We start of the url with “Https://”

After which we use the function uriHost with the parameter the OData Id we put in a compose. This will give us the base part of the url. We follow up with the string “/main.aspx?appid=”. Main.aspx is the default page the Model-driven apps live in. After the question mark of the Url we can build up the parameters. This first one is the AppId.

Shows the Power Automate Compose action where the record URL is created.Create the record URL

We add the AppId dynamically from the List Items action. This will of course return only 1 record. Thus we can safely use the First function.

first(outputs('Get_Model-Driven_App_Id')?['body/value'])?['appmoduleid']

Now we add “&pagetype=entityrecord&etn=bdenb_case&id=”. This will tell the App that we want to navigate to a specific record of the table “bdenb_case”, which is my own case table. After the id we will use the record id from the “Update record” action.

This will now give us the following code in the component action:

https://@{uriHost(outputs('Compose_the_Odata_link_to_grab_the_uri_host_later'))}/main.aspx?appid=@{first(outputs('Get_Model-Driven_App_Id')?['body/value'])?['appmoduleid']}&pagetype=entityrecord&etn=bdenb_case&id=@{outputs('Update_the_case_status_and_approver_comment')?['body/bdenb_caseid']}

Now for the final result

We are now nearly done! Add the output of the compose action to the “Item link” property of the Approval action. And we add a “Item link description” for the text of the Url. I added the “Name” of the record of the approval for clarification.

Shows the Power Automate Approval Action with all the properties filled in.Complete Approval Action

Now that we are done let me show you the result in the Microsoft Teams Approval center:

Shows an animated gif where inside the MS Teams approval center we click the record URL and the Model-driven App is opened for us.Approval Link in action

Adding the Item link puts the finishing touch on our Approval request. This ensures easy access of the information required by the Approver. With the technique I described in this post we can ensure this works in ALM scenario’s as well.

标签:will,Item,driven,record,add,link,action,Approval
From: https://www.cnblogs.com/Javi/p/17296275.html

相关文章

  • Addressable卸载AssetBundle失效的疑惑
    1)Addressable卸载AssetBundle失效的疑惑​2)模型Meta中的hasExtraRoot参数的作用及其历史原因3)TMP为什么有多次Delegate.Combine()的GC4)准备在海外发行游戏,比较常用的身份认证类SDK这是第331篇UWA技术知识分享的推送,精选了UWA社区的热门话题,涵盖了UWA问答、社区帖子等技术知识点,......
  • MediaRecorder录音,MediaPlayer播放
    直接看代码importjava.io.DataOutputStream;importjava.io.File;importjava.io.FileInputStream;importjava.io.FilenameFilter;importjava.io.IOException;importjava.io.InputStream;importjava.net.HttpURLConnection;importjava.net.Mal......
  • 【SQL Server】DateAdd
    定义和用法DATEADD()函数在日期中添加或减去指定的时间间隔。语法DATEADD(datepart,number,date)date参数是合法的日期表达式。number是您希望添加的间隔数;对于未来的时间,此数是正数,对于过去的时间,此数是负数。datepart参数可以是下列的值:datepart缩写年yy,yy......
  • 【paddlespeech】win执行sh脚本
    paddlespeech1.环境配置按照:https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/docs/source/install_cn.md问题condacreate-p在桌面目录执行了condacreate-ppaddlespeech2python=3.7,结果创建了一个没有名字的环境,如下:激活:要移除这个环境,不能使用condare......
  • 赋值Record之间的File column 文件。
     参数说明: rb_pleasant_ID目标实体的recordID entity需要赋值文件的接受实体;privatevoidcopyFileColumnPro(IOrganizationServiceservice,Entityentity,Guidrb_pleasant_ID){//DownloadfilevarinitializeFile=newInitializeF......
  • Unable to handle kernel NULL pointer dereference at virtual address 分析
    引用:https://blog.csdn.net/agave7/article/details/119875023虽然问题不一样,但是分析问题的方法是一致的。UnabletohandlekernelNULLpointerdereferenceatvirtualaddress分析现象[136.847780]br-lan:receivedpacketoneth0.1withownaddressassourceadd......
  • PhpStorm、PyCharm、WebStorm恢复代码(附:git撤销commit、add操作)
    由于同时管理多个项目,多种开发语言同步开发,开了好多个Git窗口。今天在提交python某项目的时候不小心在vue的项目中执行了gitadd、gitcommit操作,在push的时候悬崖勒马,于是故事开始了:我先回滚了commit,接着想把add也回滚一下,结果直接回滚到了上次提交的那个节点上,哦豁,新写的代码........
  • 8.1 js addEventListener js给div添加事件
    <!DOCTYPEhtml><html><head><metacharset="utf-8"><title>testaddEventListener</title></head><body><buttonid="myBtn">clickme</button><pid="demo">&......
  • Linux: useradd groupadd
        groupadd&useraddTheyallhave--rootCHROOT_DIRAND--prefixPREFIX_DIR    ......
  • __sync_fetch_and_add函数
    (一)背景实现多线程环境下的计数器操作,统计相关事件的次数.当然我们知道,count++这种操作不是原子的。一个自加操作,本质是分成三步的:1从缓存取到寄存器2在寄存器加13存入缓存。由于时序的因素,多个线程操作同一个全局变量,会出现问题。这也是并发编程的难点。在目前多核条件下......