Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

way to change a page in view mode to create mode using C/Side code

Posted on by Microsoft Employee

Hi,

Any way to change a page in View mode (RunFormMode = View) to Create mode(RunForm Mode =Create ) based on the status of a checkbox in that page using C/AL code.

Two conditions are follows:

When Checkbox = True, RunFormMode of the page should be in Create mode.

when  Checkbox = False, RunFormMode of the page should be in View  mode.

How to change the the RunFormMode of  a page using  C/AL Code in Navision RTC?

Plz help! !

Plz

*This post is locked for comments

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: way to change a page in view mode to create mode using C/Side code

    You can make a field editable and non-editable on the fly based on other field value but once the page is loaded i don't think you can make the page editable or non-editable you  can do that before the page is open.

    If you are looking to make the control editable, then check the customer card page for example the contact field on that page is controlled based on the primary contact no. value.

  • keoma Profile Picture
    keoma 32,675 on at
    RE: way to change a page in view mode to create mode using C/Side code

    please try the second solution. button ...

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: way to change a page in view mode to create mode using C/Side code

    I applied your logic but the field in the page (RTC) didn't change to edit mode after enabling the checkbox.

    Plz help...

  • Verified answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: way to change a page in view mode to create mode using C/Side code

    if you push a checkbox to set the form in to viewmode it won't be able to set it back to edit mode, because the form is in view mode.

    but you can do the following: define a global variable ControlEditable (type boolean) and set this variable as value to the editable property of the controls, which you want to switch the edit/view mode. then add a checkbox control to the form and use the triggers onpush and onvalidate to switch by setting the variable ControlEditable to true/false followed by a currform.update.

    other solution:
    add a button to the form,
    add following code to trigger button-onpush:
    currform.editable := not currform.editable;
    currform.update;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans