cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akbarmahfuzalam
Post Prodigy
Post Prodigy

Patch from Form

Hey Team,

 

Trying to Patch the form into Sharepoint with Approved value.

 

Challenge is that I am not able to patch the Approved By field and Date & Time field to Sharepoint List.

 

Patch(ScoreCardExceptionHours,'Approver ScoreCardException_HoursGallery'.Selected,{Status:{Value:"Approved",'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}});Refresh(ScoreCardExceptionHours);

 

 

Approved By = Approved by_DataCard2

Date & Time = Date & time_DataCard2

 

How do I add this field into a patch and get the info into SharePoint list Named ScoreCardExceptionHours

 

akbarmahfuzalam_0-1595250095045.png

 

Please!

1 ACCEPTED SOLUTION

Accepted Solutions

No Error! I resolved it with id.text

View solution in original post

11 REPLIES 11
PVosEska
Resolver IV
Resolver IV

Hi @akbarmahfuzalam,

 

Are the 'date & time' and 'approved by' fields made by you? Or are these created by sharePoint. if the second, there is no way to manually fill them.

 

In that case, i would create a dateTime and ApprovedBy column in sharepoint and patch to those columns.

 

If these are already created by you, can you share more details about the error you receive?

 

Hope to help! 

 

Regards,

@PVosEska ,

 

The field name is there in the SharePoint List

 

akbarmahfuzalam_0-1595255301429.png

akbarmahfuzalam_1-1595255602430.png

 

akbarmahfuzalam_2-1595255663948.png

 

Do you get any errors? Right now, it's hard to see what is going wrong.

 

Judging by the screenshots, i don't see why you use the Patch() function though. If it is all in one form, and you selected the fields in that Form (so you don't have any custom field), wouldn't SubmitForm(Form3) work?

 

I will respond again in the morning.

 

regards,

Hi @akbarmahfuzalam ,

 

I just want to know, who is the Approver? when is the Date time?

Do you mean the current login user and the date time of clicking the approve button? 

If so, please try with this code.

Patch(ScoreCardExceptionHours,
'Approver ScoreCardException_HoursGallery'.Selected,
{
Status:{Value:"Approved"},
'Approved by': User().FullName,
'Date & Time': Now()
});
Refresh(ScoreCardExceptionHours);

Hope this helps.

Sik 

Hi,

It's not capturing the Approved By

 

ForAll(SelectedRequest,Patch(AHTException,LookUp(AHTException,ID=id),{Status:{Value:"Approved",'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"}}));Refresh(AHTException)

akbarmahfuzalam_0-1595834705705.png

 

 

 

How do I capture the information which is there in the Gallery5 and stored in SharePoint?

 

 

Hi @akbarmahfuzalam ,

 

You seem to only patch the status and not the approver. Is the Approver a person column, or a text column?

 

For person, you could use the following:

ForAll(SelectedRequest,Patch(AHTException,LookUp(AHTException,ID=id),{Status:{Value:"Approved",'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},
'Approved By':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|"&<Approver Email>,
    Department:"",
   DisplayName:<Approver Displayname>,
         Email:<Approver Email>,
      JobTitle:"",
       Picture:""
   }}));Refresh(AHTException)

change the <Approver Email>& <Approver DisplayName> and displayname for the values from SelectedRequest.

 

For Text, you can use this instead:

ForAll(SelectedRequest,Patch(AHTException,LookUp(AHTException,ID=id),{Status:{Value:"Approved",'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},
'Approved By':<Approver DisplayName>}));Refresh(AHTException)

Let me know if you need more help.

 

Regards

Thanks for the quick solution.

 

My SharePoint List

akbarmahfuzalam_0-1595848422043.png

 

 

akbarmahfuzalam_1-1595848465189.png

 

akbarmahfuzalam_2-1595848488194.png

akbarmahfuzalam_0-1595849102569.png

 

If selectedRequest is a Collection, you can use the following

 

'Approved By': selectedRequest.'Approved By'

 

But it fully depends on the datatype that the 'approved by' is in the collection. If it's a record type (person) you need to specify the property you want to use. Would look something like:

'Approved By': selectedRequest.'Approved By'.DisplayName

If it's just a text datatype, you can use the first formula

 

 

Collect(SelectedRequest, {Pressed: ButtonSubmit.Pressed})

 

akbarmahfuzalam_0-1595849353230.png

 

akbarmahfuzalam_0-1595850348686.png

 When I use it as ID then it's capturing the ID no.

 

akbarmahfuzalam_1-1595850414865.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,389)