Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

patch record variable field from gallery as new item in SharePoint list

(0) ShareShare
ReportReport
Posted on by

I have a SharePoint list that I use as a audit table. It captures all creations, updates, deletions, etc. It is not dependent on any IDs or lookups. When an action occurs it just captures title, date, person, action.

 

In my PowerApp I have a gallery that lists all of the tasks assigned to the person using the app. There are two buttons in the gallery a detail and delete. The detail button opens up a form on the same screen with the details of the task and a editable status drop down and save button. The other fields are read only including task title. I want to pull the task title from the form into my patch so it automatically displays the task title, so we know what task was deleted.

 

The details button in the gallery is : Set(varTaskRecord,ThisItem)

 

The trash button in the gallery is: RemoveIf(PMSolution,ID=varTaskRecord.ID And varTaskRecord.'Task Assigned'.DisplayName = User().FullName);Patch(PM_Audit, Defaults(PM_Audit),{'Type of Action':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:6,
Value:"Task Deleted"},Title:"Need to make dynamic to display task title from varTaskRecord",Comments:"Decision by and Requested by is the person who deleted the task.",'Decision ':"Task Deleted",
'Decision By':{
Claims: Concatenate(
"i:0#.f|membership|",
User().Email
),
Department: "",
DisplayName: User().FullName,
Email: varUserEmail,
JobTitle: "",
Picture: ""},
'Decision Date':Today(),'Date Created':Today(),
'Requested By':{
Claims: Concatenate(
"i:0#.f|membership|",
User().Email
),
Department: "",
DisplayName: User().FullName,
Email: varUserEmail,
JobTitle: "",
Picture: ""}})

  • Verified answer
    mjackson122 Profile Picture
    on at
    Re: patch record variable field from gallery as new item in SharePoint list

    I figured it out. I need to use thisitem.Title

  • Community Power Platform Member Profile Picture
    on at
    Re: patch record variable field from gallery as new item in SharePoint list

    Just realized its varTaskRecord.Title that I need. Under variables varTaskRecord shows:

     

    Definitions: home.galtaskhome.ic_tskdetails.OnSelect   Set(varTaskRecord.ThisItem);Navigate(TaskUpdate)

     

    Uses: TaskUpdate.frmtasks_home.Item      varTaskRecord

    Home.galtaskhome.tsktrash.OnSelect then it shows all the code I have listed above beginning with Remove

     

    Indirect uses: None listed

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: patch record variable field from gallery as new item in SharePoint list

    @mjackson122 ,

    Go to View > Variables and have a look what is in varTaskRecord.Task 

  • mjackson122 Profile Picture
    on at
    Re: patch record variable field from gallery as new item in SharePoint list

    The only field I cannot get to patch correctly is the title field. The title field needs to look at varTaskRecord.Task but it does not like the scope when I use that. Task is a field in the form which is read-only.

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: patch record variable field from gallery as new item in SharePoint list

    @mjackson122 ,

    Title will be a text field, so requires no special code - what exactly are you wanting to patch in it and what (if anything) is patching currently?

  • mjackson122 Profile Picture
    on at
    Re: patch record variable field from gallery as new item in SharePoint list

    Yes I do need that info as it patches the other fields. The only field I cannot get to patch correctly is the title field. The type of action is not a lookup field it is a choice field in a SharePoint list.

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: patch record variable field from gallery as new item in SharePoint list

    Hi @mjackson122 ,

    You are pasting text in there at the moment - do you need this?

    Patch(
     PM_Audit, 
     Defaults(PM_Audit),
     {
     'Type of Action':{Value:"Task Deleted"},
     Title: varTaskRecord.Title
     Comments:"Decision by and Requested by is the person who deleted the task.",
     'Decision ':"Task Deleted",
     'Decision By':
    		 {
     Claims: 
     Concatenate(
     "i:0#.f|membership|",
     User().Email
     ),
     Department: "",
     DisplayName: User().FullName,
     Email: varUserEmail,
     JobTitle: "",
     Picture: ""
     },
     'Decision Date':Today(),'Date Created':Today(),
     'Requested By':
     {
     Claims: 
     Concatenate(
     "i:0#.f|membership|",
     User().Email
     ),
     Department: "",
     DisplayName: User().FullName,
     Email: varUserEmail,
     JobTitle: "",
     Picture: ""
     }
     }
     )
    )

    I assume by Choice you do not mean Lookup.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • mjackson122 Profile Picture
    on at
    Re: patch record variable field from gallery as new item in SharePoint list

    Type of action is a choice field. The only field I cannot get to pre-populate is Title. It should pull in the Task Title from the form which items = varTaskRecord

     

    Title:"Need to make dynamic to display task title from varTaskRecord" 

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: patch record variable field from gallery as new item in SharePoint list

    Hi @mjackson122 ,

    Apart from missing a closing bracket, what else in there is not working?

    Patch(
     PM_Audit, 
     Defaults(PM_Audit),
     {
     'Type of Action':
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id:6,
     Value:"Task Deleted"
     },
     Title: "Need to make dynamic to display task title from varTaskRecord",
     Comments:"Decision by and Requested by is the person who deleted the task.",
     'Decision ':"Task Deleted",
     'Decision By':
    		 {
     Claims: 
     Concatenate(
     "i:0#.f|membership|",
     User().Email
     ),
     Department: "",
     DisplayName: User().FullName,
     Email: varUserEmail,
     JobTitle: "",
     Picture: ""
     },
     'Decision Date':Today(),'Date Created':Today(),
     'Requested By':
     {
     Claims: 
     Concatenate(
     "i:0#.f|membership|",
     User().Email
     ),
     Department: "",
     DisplayName: User().FullName,
     Email: varUserEmail,
     JobTitle: "",
     Picture: ""
     }
     }
     )
    )

    You also no longer need the "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference" and what type of field is 'Type of Action'?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard