Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

FormState differences on Onload of a form

(0) ShareShare
ReportReport
Posted on by 45

Hi Community,

When I open a record from a view in the home level. Onload of the form, the form doesn't default to saved mode which is expected to default to save mode. Because of this I'm seeing differences in the behaviour of custom ribbon buttons on the form. Kindly help me in resolving this issue.

Thank You!

  • Suggested answer
    RE: FormState differences on Onload of a form

    Hi Giridhar, how are you?

    Looks like you have to get the form type when open a record using a function on OnLoad of the form.

    To do that, you need to use the context , passed to the custom function as a parameter and inside the fuction use the getFormType as documented on https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/getformtype

    My function on a web resource.

    pastedimage1586442105856v3.png

    The function added on form. Do not forget to pass execution context

    pastedimage1586441860501v2.png

    Result on create a new record.

    pastedimage1586442174604v4.png

    And when open a existing record

    pastedimage1586442225255v5.png

    The values of each type can be ckecked at https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/getformtype#return-value

    Please let me know if this answer you question or if you have any doubts about the instructions. Also, if this resolve you issue, mark this as anwered.

    Thanks for using community forum.

    Rodrigo Hentz

    Dynamics 365 - Support Engineer

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: FormState differences on Onload of a form

    Hi Giridhar,

    Can you share a bit more details on the issue?

    Are you using the getFormType method and not seeing "2" (Update) if you open an existing record that you can edit?
    Or are you referring to getSaveMode?

    Henry

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,684 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,414 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans