cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sopatte Resolver II
Resolver II

Sharepoint Write failures

I've been struggling with this for months and have not come up with a solution. I am caching data from a Sharepoint list called PSO in a local collection called PSOCache. I have a "SyncState" field which is set to 0 when a record is edited in the app, 1 when it is written back to PSO, and then set to 2 when the record is updated in Flow.

 

Sometimes but not always, updates get "lost" and the record reverts to its previous values. New records never seem to get "lost". Below is the relevant code in an icoWriteBack.Select. This is called from OnVisible for my gallery screen, in other words after the user creates or updates a PSOCache record in the New/Edit screens. The gallery displays filtered records from PSOCache. 

If(Connection.Connected
&& Concat(PSOCache,If(SyncState=0,"1",""))<>""
,UpdateContext({IsSyncing:true}) ;ForAll( PSOCache // Update all cached edits back to db ,If(SyncState=0 ,If(IsBlank(ID) ,Patch(PSO ,Defaults(PSO) ,{ MSF: PSOCache[@MSF] ,Inspected: PSOCache[@Inspected] ,Status: PSOCache[@Status] ,Bin: PSOCache[@Bin] ,Description: PSOCache[@Description] ,OwnerName: PSOCache[@OwnerName] ,OwnerAlias: PSOCache[@OwnerAlias] ,SN: PSOCache[@SN] ,VPN: PSOCache[@VPN] ,Ticket: PSOCache[@Ticket] ,StatusText: PSOCache[@StatusText] ,StatusDetail: PSOCache[@StatusDetail] ,SyncState:1 } ) ) ;UpdateIf(PSO ,PSO[@ID]=PSOCache[@ID] ,{ MSF: PSOCache[@MSF] ,Inspected: PSOCache[@Inspected] ,Status: PSOCache[@Status] ,Bin: PSOCache[@Bin] ,Description: PSOCache[@Description] ,OwnerName: PSOCache[@OwnerName] ,OwnerAlias: PSOCache[@OwnerAlias] ,SN: PSOCache[@SN] ,VPN: PSOCache[@VPN] ,Ticket: PSOCache[@Ticket] ,StatusText: PSOCache[@StatusText] ,StatusDetail: PSOCache[@StatusDetail] ,SyncState:1 } ) ) ) ;UpdateIf(PSOCache ,SyncState=0 ,{SyncState:1} ) ;SaveData(PSOCache,"PSOCache") ;UpdateContext({IsSyncing:false}) )

Another icon, icoSyncing, is selected either manually or every 5 seconds.

If(Connection.Connected && !IsSyncing
    ,Select(icoWriteBack)
    ;UpdateContext({IsSyncing:true})
    ;ClearCollect(PSOCache
        ,Filter(PSO
            ,StatusText = "Pending Pickup"
            || StatusText = "Tech Custody"
            || SyncState <> 2 // records that have not been updated by the "Flow"
            ,OwnerName = UserName
            || OwnerAlias = UserAlias
        )
    )
    ;SaveData(PSOCache,"PSOCache")
    ;UpdateContext({IsSyncing:false})
)

When the issue occurs, I can see the gallery shows the new values, that the IsSyncing field gets updated, then when icoSyncing.Select runs, the record reverts. This indicates to me that the write failed; the original data from Sharepoint is overwriting the data in PSOCache.

2 REPLIES 2
TopShelf-MSFT Community Champion
Community Champion

Re: Sharepoint Write failures

Hi @sopatte are you still experiencing this issue?

 

@TopShelf-MSFT 

sopatte Resolver II
Resolver II

Re: Sharepoint Write failures

Yes, as of yesterday

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (5,403)