使用 Power Apps 中的补丁将项目更新到 SP 列表

问题描述 投票:0回答:1

我正在尝试编辑服务台应用程序的现有模板,但将数据源更改为共享点列表与模板打开时使用的默认表。有人可以帮助我理解如何编码逻辑,它获取现有的票证屏幕(我目前正在从我的 SP 列表中检索“所有票证”页面上的数据)数据并允许您单击/转换到您可以在其中的另一个页面是否可以通过额外的点击来更改参数,从而更新 SP 列表上的值?开箱即用的代码看起来像 -

EditForm(TicketDetailsForm);
Navigate(TicketdetailsPage_1,ScreenTransition.Fade,
    {EditRecord:ThisItem,
    type:ThisItem.task_status,
    assign:ThisItem.assignedto,
    Area:ThisItem.department,
    priority:ThisItem.priority,
    subjectdisabled:true,
    subjectfill:RGBA(0,0,0,0),
    subject_visible:true,
    description_disabled:true,
    description_bordercolor:RGBA(0,0,0,0),
    description_fill:RGBA(0,0,0,0),
    description_visible:true,
    commentdisabled:true,
    commentbordercolor:RGBA(0,0,0,0),
    commentfill:RGBA(0,0,0,0),
    commentvisible:true})

我正在尝试使用

Patch
的语法变体,看起来像

Patch(
    sharepoint_list_name,  
    LookUp(
        sharepoint_list_name,  SharePoint list
        ID = ThisItem.ID  
    ),
    {
        task_status: Text(ThisItem.task_status),
        assignedto: Concatenate(
          "i:0#.f|membership|",
          User().Email // Person email
          ),
          Department: "",
          DisplayName: User().FullName,
          Email: User().Email, // Person email
          JobTitle: "",
          Picture: "",
        department: Text(ThisItem.department),
        priority: Text(ThisItem.priority)
        // Add more fields to update here as needed
    }
);

Navigate(
    TicketdetailsPage_1,
    ScreenTransition.Fade,
    {
        EditRecord: ThisItem,
        type: Text(ThisItem.task_status),
        assign: Concatenate(
          "i:0#.f|membership|",
          User().Email // Person email
          ),
          Department: "",
          DisplayName: User().FullName,
          Email: User().Email, // Person email
          JobTitle: "",
          Picture: "",
        Area: Text(ThisItem.department),
        priority: Text(ThisItem.priority),
        subjectdisabled: true,
        subjectfill: RGBA(0, 0, 0, 0),
        subject_visible: true,
        description_disabled: true,
        description_bordercolor: RGBA(0, 0, 0, 0),
        description_fill: RGBA(0, 0, 0, 0),
        description_visible: true,
        commentdisabled: true,
        commentbordercolor: RGBA(0, 0, 0, 0),
        commentfill: RGBA(0, 0, 0, 0),
        commentvisible: true
    }
)

老实说,我不知道这里的逻辑是什么 - 我不明白默认表数据如何允许用户单击窗口并转换到可以选择项目并更新值的另一个页面。我只是想通过 SP 列表来完成同样的事情。这里的任何东西都将不胜感激。谢谢你。

这些是我的 SP 列名称/类型

assignedto - person/group
priority - choice 
department - choice
task_status - choice
powerapps sharepoint-list
1个回答
0
投票

高级逻辑是这样的:

  1. “所有门票”页面有一个显示所有门票的 DataTable 或 Gallery 控件。 在此页面中,单击具有导航功能的控件。导航语法还将所选工单的详细信息作为参数传递到工单表单屏幕,其中该记录成为显示工单当前值的控件中引用的本地变量。
  2. 编辑票证详细信息后,(我猜)有一个提交按钮来保存更改。这就是 Patch() 函数应该在的地方。在用户单击按钮之前,更改仅在 Power Apps 中进行。当 Patch() 运行时,它们也会保存在 SharePoint 中。请注意,“分配给”字段是“人员”或“组”字段,它要求将用户的数据作为模板应用程序中的记录发送。保存数据后,应用程序中的门票列表也会自动更新。

有 2 件事需要改变:

  • 要将数据源替换为 SharePoint 列表,您需要更改图库/数据表的 Items 属性以及 Patch 功能。注意字段名称,如果只有4个字段,则可以删除原始补丁函数中的大部分代码。
  • 补丁运行后,建议您使用 Notify() 向用户提供一些反馈,并使用 Navigate() 返回“所有票证”屏幕。
© www.soinside.com 2019 - 2024. All rights reserved.