将GUID转换为文本值,从电源自动流中的API响应
我正在使用MS Automate来解决我们在项目管理生命周期中使用的两个系统之间的集成挑战。我有一个由系统A的供应商编写的自定义连接器,该连接器使我能够在MS Automate中创建一个流程,该流程在创建或更新记录时会触发。
到目前为止,一切都很好。但是,系统a提供的连接器中的方法返回新的或更新的记录,其中包含许多字段,这些字段包含值GUID,因为字段是“选择”类型字段,例如,状态等。我最终得到的是记录status =“ xxxxxx-000000-00000-00000”等。供应商还提供了一个静止的API端点,我可以查询该端点,该端口返回一个json collection,其中包括此类型的每个字段的“选择”部分标准JSON看起来像:
{
"Id": "156e6c29-24b3-4413-af91-80a62a04d443",
"Order": 110,
"InternalName": "PrjStatus",
"DisplayName": "Status",
"ColumnType": 5,
"ColumnAggregate": 0,
"Choices": {
"69659014-be4d-eb11-bf94-00155df8457c": "(0) Not Set",
"c30c50e5-51cf-ea11-bfd3-00155de84703": "(1) On Track",
"c40c50e5-51cf-ea11-bfd3-00155de84703": "(2) At Risk",
"c50c50e5-51cf-ea11-bfd3-00155de84703": "(3) Off Track",
"6a659014-be4d-eb11-bf94-00155df8457c": "(4) Not Tracked"
},
技术问题:
我拥有的是选择的GUID(不是字段)。我需要使用GUID,在这种情况下,“ 6A659014-BE4D-EB11-BF94-00155DF8457C”,然后将其转换为“(4)未跟踪”,然后将其存储在变量中以写入SharePoint列表。我需要对大约30个字段进行此操作,这些字段在记录中相似。
我创建了流程,连接器为我提供了带有字段列表的记录,其中一些包含值指南。我知道这些字段是哪个字段,并且具有这些字段的显示名称。
我已经在提供的API端点上添加了HTTP调用(我们称其为GetFields),该响应返回了200个响应,该响应的正文包含系统A中的50个左右域的JSON
集合如何解析我对每个字段值的GUID的响应主体,并确保我具有正确的相应文本值,因此我可以将其写入字段变量,然后创建一个SharePoint记录,所有这些记录都包装在一个MS自动化流量。
I'm using MS Automate to solve an integration challenge between two systems we use in our Project Management lifecycle. I have a custom connector written by the vendor of System A which allows me to create a Flow in MS Automate which is triggered when a record is Created or Updated.
So far, so good. However, the method in the connector provided by System A returns the new or updated record containing a number of fields which contain value GUIDs as the fields are 'choice' type fields e.g. Department, Status etc. What I end up with is a record where Status = "XXXXXX-000000-00000-00000" etc. The vendor also provides a restful API endpoint which I can query, which returns a JSON collection of fields, which include a 'Choices' section for each field of this type which is a standard JSON which looks like:
{
"Id": "156e6c29-24b3-4413-af91-80a62a04d443",
"Order": 110,
"InternalName": "PrjStatus",
"DisplayName": "Status",
"ColumnType": 5,
"ColumnAggregate": 0,
"Choices": {
"69659014-be4d-eb11-bf94-00155df8457c": "(0) Not Set",
"c30c50e5-51cf-ea11-bfd3-00155de84703": "(1) On Track",
"c40c50e5-51cf-ea11-bfd3-00155de84703": "(2) At Risk",
"c50c50e5-51cf-ea11-bfd3-00155de84703": "(3) Off Track",
"6a659014-be4d-eb11-bf94-00155df8457c": "(4) Not Tracked"
},
Technical problem:
What I have is the GUID of the choice (not the field). I need to take the GUID, in this case "6a659014-be4d-eb11-bf94-00155df8457c" and translate it into "(4) Not Tracked" and store this in a variable to write to a SharePoint list. I need to do this for about 30 fields which are similar in the record.
I've created the flow and the connector has given me the record with a list of fields, some of which contain value GUIDs. I know which fields these are and I have the Display Names of these fields.
I have added a HTTP call to the provided API endpoint (lets call it GetFields), which has returned a 200 response, the body of the response containing a JSON collection of the 50 or so fields in System A.
I can't work out how to parse the body of the response for the GUID I have for each field value and ensure I have the right corresponding text value, so I can then write it to a field variable, and then create a SharePoint record, all wrapped up in an MS Automate flow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我希望我已经正确理解了您,但是从我的工作中,您想从提供的GUID(无论如何)中动态选择选择的值。
我创建了一个小流程来证明这个概念。首先,这两个步骤设置了场景,第一个是要提取选择值的GUID,第二个是JSON对象本身...
第三步将从第一个变量和在表达式中动态使用它以从JSON提取该键并返回值。
这是表达式...
您看到我只是在JSON对象顶部的路径表达式中使用的变量来提取我想要的密钥。
这是最终结果...
I hope I've understood you correctly but from what I can work out, you want to dynamically select the value of the choice from the GUID you've been provided (by whatever means).
I created a small flow to prove the concept. Firstly, these two steps setup the scenario, the first being the GUID you want to extract the choice value for and the second being the JSON object itself ...
The third step will take the value from the first variable and use it dynamically in an expression to extract that key from the JSON and return the value.
This is the expression ...
You an see I'm just using the variable in the path expression over the top of the JSON object to extract the key I want.
This is the end result ...