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: ""}})
I figured it out. I need to use thisitem.Title
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
Go to View > Variables and have a look what is in varTaskRecord.Task
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.
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?
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.
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.
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"
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.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional