cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
val43
Level: Powered On

refresh not working? lookup fails 1 time after patching new record, then works

Hi, 

I would like to check if a record exist in a datasource before patching it in. 

This works if the record was already there since before the last refresh of the datasource.

 

IF instead the record was just added in the PREVIOUS patching, then it is NOT FOUND.

In fact, it's not even listed in the drop down menu that I'm using to display the datasource.

 

IS THE REFRESH() FUNCTION AT FAULT??

 

 

UpdateContext({
    patchResult: Blank()
});


// trying to refresh in order to get the latest data
Refresh('helpdesk-categorie');  // not working?????


// checking if the record exists
If(IsBlank(LookUp('helpdesk-categorie', Title = input1.Text)),
    // if the record does NOT exist, then
    UpdateContext({
        patchResult: Patch(
            'helpdesk-categorie',
            Defaults('helpdesk-categorie'),
            {Title: input1.Text}
        )
    })
);

Refresh('helpdesk-categorie');

 

 

 

EDIT: actually, even if you manually refresh the datasource, it's still going to patch the same data twice, before failing this test:

IsBlank(LookUp('helpdesk-categorie', Title = input1.Text))

Whyyyyyy

2 REPLIES 2
Community Support Team
Community Support Team

Re: refresh not working? lookup fails 1 time after patching new record, then works

Hi @val43 ,

I've made a similar test but not met the same problem like your description.

Here's my test:

1)in my test, there used to not exist "bbb" value in Title column

2)this is my formula:

Patch('1018',Defaults('1018'),{Title:"bbb"});Refresh('1018');If("bbb" in '1018'.Title,Set(var,true),Set(var,false))

3)This is my result:
11182.PNG

 

 So, after I just patch new record, refresh data source, checking the value is useful.

I believe refresh function not being invalid.

Could you tell me how many records in your data source?

Maybe this is delegation problem.

If your record is larger than 2000, LookUp function may return wrong result.

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
val43
Level: Powered On

Re: refresh not working? lookup fails 1 time after patching new record, then works

Hi @v-yutliu-msft , thank for your reply and my apologies for taking so long to get back to you. 

 

I am still experiencing this issue but I found a work around.

First, I collect the whole source into a collection (the source is only 1 column with no more than a couple hundred rows). When patching, I also collect the new row into the collection. Before patching, I check the collection and not the source.

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,355)