cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calerof
Advocate II
Advocate II

Attach a Link to Item from a Document Library file to a SP list created with Patch with the same consecutive number

Hello,

I have an app to collect data from the users and I use this code to save it to a SharePoint list:

 

 

 

UpdateContext({varPopUp_Firma:false});
UpdateContext({varPopUpSpinner: true});
Set(varSignature,With({wJSON:JSON(PenInput1.Image,JSONFormat.IncludeBinaryData)},With({wCommaPosition:Find(",",wJSON)},Mid(wJSON,wCommaPosition+1,Len(wJSON)-wCommaPosition-1))));
Patch(ConsumoHerramientasDeCorte, colShoppingCart);
Clear(colShoppingCart);Set(varNombreSolicitante, Blank());Set(varPersonaAutoriza, Blank());Reset(Cmbx_Autoriza);
Navigate(Screen1, ScreenTransition.CoverRight);
UpdateContext({varPopUpSpinner:false});
Notify("Success",NotificationType.Success);

 

 

 

Basically I use Patch with a collection to save in bulk all the records created by the user in a SharePoint list as Datasource = ConsumoHerramientasDeCorte, and the data input is stored in a collection = colShoppingCart.

This works great (thanks to the valuable help from Reza Dorrani), and here is a screenshot of the SP list:

SharePoint ListSharePoint List

I included the field "Folio" (that means consecutive number) to bundle all the records from the same transaction. 

 

The trick is that in the same input the user signs the receipt = PenInput1.

 

I managed (thanks to the great help from Shane Young) to convert the pen input data to JSON format and I stored it in the variable varSignature.

 

After this code I inserted the following code to save the image to a Document Library in the same submit button:

 

 

 

//Run the flow
ToolingReceiptSaveASignature.Run(varSignature)

 

 

 

Following is the screenshot of the Flow to do this.

 

My Problem

Where I need help is on how to update the patched records in the SharePoint list with the link of the signature image saved in the Document Library. I have it already as Link to Item, but I can't figure out how to use Get Items that have the last "Folio" (consecutive number) to select those items and then use Update Item with Link to Item to save this link to the selected records.

Flow.png

If I use this code in the app I get the "Folio" (consecutive number):

 

 

 

First(colShoppingCart).Folio

 

 

 

But I don't know how to use it in the Flow.

In the SharePoint list I have the field "LigaImagenFima" available to insert the signature's image link.

 

Or if there's another easier of better way to include the signature's image link to the SharePoint list, maybe.

 

I really appreciate any help.

Kind regards,

Fernando

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @calerof :

Do you want to update the specified record through flow? (by filtering Folio)

If so,you can use'Filter Query' to get the specified records, and then use'Apply to each' to traverse them.

1.JPG

 

 

 

Best Regards,

Bof

 

View solution in original post

6 REPLIES 6
v-bofeng-msft
Community Support
Community Support

Hi @calerof :

Do you want to get the value of the Folio field of the first record in colShoppingCart?

If so,Please allow me to explain the difference between the syntax of power apps and flow first.

PowerApps uses the function (First\Last) to get the specified record, while Flow uses the subscript.For example:

If you need to get the first item in the specified array, then you can use:

array[0]

I assume that there is an array named colShoppingCart in your flow, the code should be:

variables('colShoppingCart')[0]['Folio']

2.JPG1.JPG

Best Regards,

Bof

@v-bofeng-msft ,

No, I don't want to get the value of the "Folio" (consecutive number) field of the first record in colShoppingCart.

What I want is clearly explained in my post. That doesn't make sense to me. The array colShoppingCart is in Power Apps.

Based on your answer, how should I accomplish to insert the link to the Document Library file in the SharePoint list in the records that were patched in the same Submit button action?

I really appreciate if someone can help me here.

Fernando

 

Hi @calerof :

Do you want to update the specified record through flow? (by filtering Folio)

If so,you can use'Filter Query' to get the specified records, and then use'Apply to each' to traverse them.

1.JPG

 

 

 

Best Regards,

Bof

 

View solution in original post

@v-bofeng-msft ,

How can I find "Getitems_Filter", the second expression in the Filter Query you mention above? Never mind, I found it, Ask Power Apps. 

Then in Power Apps the Flow button expects two arguments, which are they?

Thanks

 

v-bofeng-msft
Community Support
Community Support

Hi @calerof :

You will be prompted for the parameter when you call flow in powerapps. One should fill in varSignature, and the other should provide the parameters used in Filter Query.

Best Regards,

Bof

Hi @v-bofeng-msft ,

Finally got it working, thank you.

Fernando

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,445)