web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Connected, Submit F...
Power Apps
Answered

If Connected, Submit Form If Not Connected add to Collection - App online yet still adds to collection

(0) ShareShare
ReportReport
Posted on by 87

Hello Everyone!

I have a submit button which if its connected to Wifi/data then it will submit the form back to the data source. If its not connected, it'll add to my collection. Recently I've noticed, that even if I'm Connected and press the Submit button that it'll just add it to the collection. The collection then gets uploaded either by going back into the app or clicking the refresh button. 

 

CorgiMad_0-1704890821683.png

Does anyone know why my app is adding data to my collection even when online?

Many thanks

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,501 Most Valuable Professional on at

    Hi @CorgiMad ,

    The syntax should be 

    If(
     Connection.Connected,
     . . . . . .

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • CorgiMad Profile Picture
    87 on at

    Hello @WarrenBelz 

     

    Admittedly I noticed that error after posting so changed it to the right syntax. However, it now spits out the below error against the SubmitForm...

     

    CorgiMad_1-1704958533398.png

     

    CorgiMad_2-1704958590544.png

     

    Many thanks

  • WarrenBelz Profile Picture
    155,501 Most Valuable Professional on at

    @CorgiMad ,

    Please post the full code in Text

  • CorgiMad Profile Picture
    87 on at

    If(Connection.Connected,SubmitForm(SurveyForm),

        Collect(colOffline,

        {

            OriginalIDC: OriginalID.Text,

            AddressC: Address.Text,

            PostcodeC: Postcode.Text,

            COAMC: COAMD.SelectedItems,

            NetworkC: NetworkD.SelectedItems,

            PipeIDC: PipeID.Text,

            DateBOMReportedC: BOMReport.SelectedDate,

            PipeDiameterC: Diameter.Text,

            PipeMaterialC: Material.SelectedItems,

            PressureTierC: PressureTier.SelectedItems,

            SurveyDateC: SurveyDate.SelectedDate,

            MainsTracedC: MainsTraced.SelectedItems,

            PhotoofMainsTracedC: MainsP.Image,

            MainsBuiltOverC: BuiltOver.SelectedItems,

            BuildingTypeC: BuildingType.SelectedItems,

            BOMDetailsC: BOMDetails.Text,

            BOMPhotoC: BOMPhoto.Image,

            TrialHolesC: TrialHoles.SelectedItems,

            TrialHoleFC: TrialHoleFindings.Text,

            MapsCorrectC: MapsCorrectValue.SelectedItems,

            MapsPhotoC: MapPhoto.Image,

            DR4RaisedC: DR4Raised.SelectedItems,

            DR4ReferenceC: DR4Reference.Text,

            DR4EvidencePhotoC: DR4EvidencePhoto.Image,

            AdditionalCommentsC: AdditionalInfo.Text

        }));

    SaveData(colOffline, "SavedItemsToKeep");

  • WarrenBelz Profile Picture
    155,501 Most Valuable Professional on at

    Hi @CorgiMad ,

    I was looking for something obvious, but it is not there - that code certainly should submit your Form if online and add to the Collection if not. The only thing needing changing is the SaveData at the bottom belongs only in the Offline result.

    If(
     Connection.Connected,
     SubmitForm(SurveyForm),
     Collect(
     colOffline,
     {
     OriginalIDC: OriginalID.Text,
     AddressC: Address.Text,
     PostcodeC: Postcode.Text,
     COAMC: COAMD.SelectedItems,
     NetworkC: NetworkD.SelectedItems,
     PipeIDC: PipeID.Text,
     DateBOMReportedC: BOMReport.SelectedDate,
     PipeDiameterC: Diameter.Text,
     PipeMaterialC: Material.SelectedItems,
     PressureTierC: PressureTier.SelectedItems,
     SurveyDateC: SurveyDate.SelectedDate,
     MainsTracedC: MainsTraced.SelectedItems,
     PhotoofMainsTracedC: MainsP.Image,
     MainsBuiltOverC: BuiltOver.SelectedItems,
     BuildingTypeC: BuildingType.SelectedItems,
     BOMDetailsC: BOMDetails.Text,
     BOMPhotoC: BOMPhoto.Image,
     TrialHolesC: TrialHoles.SelectedItems,
     TrialHoleFC: TrialHoleFindings.Text,
     MapsCorrectC: MapsCorrectValue.SelectedItems,
     MapsPhotoC: MapPhoto.Image,
     DR4RaisedC: DR4Raised.SelectedItems,
     DR4ReferenceC: DR4Reference.Text,
     DR4EvidencePhotoC: DR4EvidencePhoto.Image,
     AdditionalCommentsC: AdditionalInfo.Text
     }
     );
     SaveData(
     colOffline, 
     "SavedItemsToKeep"
     )
    );

    There is really nothing you can change that I can see.

     

  • CorgiMad Profile Picture
    87 on at

    Hello @WarrenBelz 

     

    Thanks for the quick response! 

    It really is a strange one. 

    When you say "The only thing needing changing is the SaveData at the bottom belongs only in the Offline result", where exactly would this go (Sorry not had my morning cup of tea). Moving it into the If statement?

    Many thanks

     

    Shelley

  • WarrenBelz Profile Picture
    155,501 Most Valuable Professional on at

    @CorgiMad ,

    Yes - not much use saving it it you are online and have submitted the form.

  • Verified answer
    CorgiMad Profile Picture
    87 on at

    Took a while but in the end I just recreated the form and it worked perfectly. It was almost like there was something setup in the background that would not like my Submit Form. 

     

    @WarrenBelz Have you ever come across an issue where if multiple items (say 4) within the collection get patched back to the Data Source at the exact time and the flow that gets triggered through 'When an item is created' has picked all of those 4 records instead one by one?

  • WarrenBelz Profile Picture
    155,501 Most Valuable Professional on at

    @CorgiMad ,

    Not to my knowledge sorry, but my usage of that trigger is rather limited.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 385

#2
Vish WR Profile Picture

Vish WR 367

#3
timl Profile Picture

timl 340 Super User 2026 Season 1

Last 30 days Overall leaderboard