"Unsaved Changes" message after some AddNew in Inserted method

A Javascript SaveChange call calls the server side Inserted method.
This is fine.
In the Inserted method, I call some AddNew methods again.
At the end of the execution, when trying to go to some other screen, I get the "Unsaved Changes" message. If I click "Save Change", the server side Inserted method is executed again.
How can I get rid of this "Unsaved Changes" message? And why did I get it?
Yves Pflieger

I believe the problem is that you are trying to use the ServerApplicationContext from within a method exposed by LightSwitch.  I don't think you can do that, and better yet, you don't need to because you already have access to the server context from
inside those methods (Inserting, Inserted, Can_Insert, etc.).  You can just use the normal api from those methods:
var x = this.DataWorkspace.ApplicationData.TestRecords.AddNew();
Server Application Context is used to access the server context from outside of LightSwitch exposed methods.  For example, you would use the SAC api if you needed to access LS data from inside a web api controller.
When properly using the SAC api from outside of LightSwitch exposed methods,
this thread will tell you all you need to know regarding .Current() vs. CreateContext() and how to properly dispose the SAC.

Similar Messages

  • APEX 4.1 is it possible to remove pagination "unsaved changes" message?

    Hi,
    We've developed a tabular form in APEX 4.1 which only contains one updateable column. Once the user modifies the column it raises a Dynamic Action which UPDATES data at source table. The problem is after modifying any field and clicking on pagination link, we get the following alert message "This form contains unsaved changes. Press "Ok" to proceed without saving your changes."
    Is it possible to get rid of that message? I found the way to translate the message but nothing to remove it. We also saw pagination is calling a JavaScript function called paginate, would it be possible to modify its definition to disable the message somehow?
    Thanks

    Hi,
    Apex uses a global array called gTabFormData to store the original form values when the page loads and identify which ones have been modified when the user does pagination. So, a hack you could use is to call this function right after you saved the changes to the database:
    function resetFormCachedData() {
        var c = $x_FormItems($x('report_<REPORT_STATIC_ID'>));  // e.g. report_MYSTATICID
        for (var e = 0; e < c.length; e++) {
            if (c[e].name != "X01") {
                gTabFormData[e] = c[e].value
            } else {
                gTabFormData[e] = "0"
    }I suggest putting this code in a JS library, so if Apex changes in a future release (e.g. providing a documented way to do this), it is easy to change it too.
    Luis

  • About the warning about changes message.

    Hi all,
    There is a messageChoice on the page,and the messageChoice must fire an action.But if the action is fired,then I click on the other tab or link, warning about changes message will not occur and directly farward to the other page.Is that possible that popup the warning about changes message after the messageChoice's event was fired ?
    Thanks,
    binghao

    Hi,
    this question is hard to understand. I don't see a messageChoice component in ADF Faces, can you give more details to your usecase and the components involved
    Frank

  • I try to insert some images on a website but the images are not in the right color mode. I do not know what to do? and also I have 1200 images to insert so I can not change one after one. So I need to set up an action, but I donot know how to do it... Tha

    I try to insert some images on a website but the images are not in the right color mode. I do not know what to do? and also I have 1200 images to insert so I can not change one after one. So I need to set up an action, but I donot know how to do it... Thanks

    What is the problem specifiaclly?
    If the images are intended for web use I would recommend converting them to sRGB which could be done with Edit > Convert to Profile or with File > Save for Web, but as including a Save step in Actions and applying them as Batch can sometimes cause problems I would go with regular converting.
    You could also try Image Processor Pro.
    Scripts Page

  • I created one apple I'd when I started using the iPad.  After some days, I had to create a new apple I'd as there was some problem with the first one. Now at some places still my old apple I'd is appearing.  Pls adv how I change this to my new apple Id.

    I created one apple I'd when I started using the iPad.  After some days, I had to create a new apple id
    as there was some problem with the first one. Now at some places still my old apple Id is appearing.  Pls adv how I change this to my new apple Id.

    Anything you downloaded with the first Apple Id will forever be tied to it, and will always require it to update.
    The question here is, why did you think you needed to create a new Apple ID? What was the problem with the first one?
    To get rid of th old one, you'll need to delete everything you downloaded with it, and then sign out of the ID in several places around the iPad. 
    Go to Settings->iTunes & App Stores->Apple ID->Sign out.
    Repeat the process, for Facetime, Messages, Mail and any other App you need to sign out of.

  • I use a yahoo account for my e-mail which worked fine until I changed my password a few weeks ago. I now keep getting a message up telling me to insert my password again. i know I'm putting in the right password but this driving me to distraction!

    I use a yahoo account for my e-mail which worked fine until I changed my password a few weeks ago. I now keep getting a message up telling me to insert my password again. I know I'm putting in the right password but this is driving me to distraction!
    I have now deleted the account and reinstalled it but now I can't get my e-mails through at all. Can anyone make any suggestions?

    Hello,
    Open Keychain Access in Utilities, use Keychain First Aid under the Keychain Menu item, then either check the Password under that item, change it, or delete it and start over.
    You may have multiple entries.
    Open Keychain Access in Utilities, enter the part after the @ sign in the search bar, hit enter

  • How to Display a message after inserting row in table............

    Hi
    I want to display a message after inserting rows in table like *'you have inserted a new row successfully*'.
    i am using the createinsert ADF Button to insert the rows in table.after that i am comitting it.
    after commiting i want to display message for the user.for this what i need to do.
    Please help me.
    Sailaja.

    user10860137
    Can you please explain me the each line in the code briefly.
    +public String saveButton_action(){+
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    Object result = operationBinding.execute();
    +// note "!" operator has been removed from the default code.+
    +if(operationBinding.getErrors().isEmpty()){+
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage saveMsg = new FacesMessage("Record Saved Successfully");
    ctx.addMessage(null,saveMsg);
    +}+
    return null;
    +}+
    And i have requirement to show the message on favcet "status bar".not in a popup window.(from the above code the message is showing in popup window. )the Layout i am using is PanelCollection.
    can you tell me what i need to do.
    Thanks
    Sailaja.
    Edited by: sj0609 on Mar 19, 2009 8:03 AM

  • On launching firfox v3.6.15 on windows vista this error message 'Script: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsBlocklistService.js:648' is shown, after some time FF stops responding.

    I've noticed that it is taking longer for Firefox to start. On launching the apps I get this message ' I've noticed that it is taking longer and longer for Firefox (always the most up-to-date version) to start. After some time FF stops responding

    Create a new profile exclusively for the 4.0 beta version and create a desktop shortcut with -P "profile" appended to the target to launch that profile.
    * http://kb.mozillazine.org/Testing_pre-release_versions
    * http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    * http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    * http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • I have an IPhone 3; when i checked my messages earlier some had been deleted. Upon looking at the settings i noticed my message settings have changed! I no longer have the option of how long to keep my SMS messages etc. Can anyone help?

    I have an IPhone 3; when i checked my messages earlier some had been deleted. Upon looking at the settings i noticed my message settings have changed! I no longer have the option of how long to keep my SMS messages etc. Can anyone help?

    The iOS settings for the iPhone 3 never had an option to determine how long you wanted to save messages. That settings is new to iOS8. As far as some being deleted, there is nothing about the phone that should delete messages without some user intervention. Try a reset on the phone, this will not affect your data. Hold the sleep/wake and home buttons together until you see the Apple logo and then release. The phone will reboot.

  • I just brought a apple protection plan as my phone warranty is going to end in a day, when i am trying to enter the protection plan code and my phone serial no its showing an error message try after some time is there any solution to that?

    i just brought a apple protection plan as my phone warranty is going to end in a day, after entering the protection plan code and my phone serial no its showing an error message "technical error try after some time", is there any solution for that?
    As i need the warranty to extend for another year please help me regarding this issue.
    When i bought a new iphone5 in Inda after using it for three days lock button was not working properly and it was warranty claimed and exchanged from apple service center in India, for the same phone I want to extend the warranty but its showing a error message is there any solution?

    Here is some information on the applecare +:
    http://www.apple.com/support/products/iphone.html
    It appears that you have to buy the applecare within 30 days of buying your phone - you said that your phone warranty is almost over, so when did you buy it??? That could be the explanation for the error.

  • I formatted my ext hard drive and changed it to mac os x extended(journaled). then i put in all my data back. after a while, i insert the hard drive but my macbook cannot read it. plz help

    i formatted my ext hard drive and changed it to mac os x extended(journaled). then i put in all my data back. after a while, i insert the hard drive but my macbook cannot read it. plz help

    SanandaDutta 
    tried on a different mac. The same problem exists.
    If that is the case, its extremely unlikely you have a bad USB cable on the seagate, rather as I mentioned earlier a bad SATA bridge card.
    If the Seagate 1TB USB external wont open on either Mac and youve verified same (try a diff. USB cable if you have one however this is nearly never the case),....then to get the data off that HD (unless it is dead which is also extremely unlikely),......then you would need to extract the HD from its case and insert same into either a HD dock or USB HD enclosure.
    8 out of 10  seemingly dead inopperable 1-3+ year old external HD are perfectly fine, rather the cheap 50 cent SATA bridge card fries and dies (alas)
    reply back if you need help in extracting same. 

  • I have an older iPod (2005). After years of inactivity I tried to install the cd on my PC. I get the following error message, after several attempts to install: iTunes cannot run because some of its required files are missing. Please re install  iTunes.

    I have an older iPod (2005). After years of inactivity I tried to install the cd on my PC. I get the following error message, after several attempts to install: iTunes cannot run because some of its required files are missing. Please re install  iTunes.

    Did you follow the exact instructions in this Apple support document to remove and re-install iTunes and ALL other Apple software on your XP machine?
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    B-rock

  • I'm unable to deauthorize my computer.  Getting an error message "Unable to erase authorization.  Please try again after some time."

    I'm unable to deauthorize my computer.  Getting an error message "Unable to erase authorization. Please try again after some time."

    ok, please try below steps,
    1. Quit ADE.
    2. Choose Start > Run.
    3. In the Open text box, type regedit and then press Enter. The Registry Editor opens.
    4. In the left pane of the Registry Editor, locate the following registry key:
         HKEY_CURRENT_USER\Software\Adobe\Adept
    5. Right-click the Adept key and choose Delete.
    6. In the Confirm Key Delete dialog, click OK.
    Your authorization will be deleted.
    ADE will be deauthorized now.
    Now Authorize ADE again.

  • Publish/Send messages in JMS to be delivered after some time

    I would like to know if the JMS standards address publishing of a message to a Topic or send to a queue which becomes visible or becomes eligible for subscribers to retrieve the message after a certain amount of time.
    In other words I would like to send messages to JMS such that a JMS subscriber can use the feature as a wake up call. Here the sending application sets the time at which subscriber will get the wake up call ( message ).

    I would like to know if the JMS standards address
    publishing of a message to a Topic or send to a queue
    which becomes visible or becomes eligible for
    subscribers to retrieve the message after a certain
    amount of time. Some JMS products provide this functionality. Weblogic and SwiftMQ. The latter has an integrated Job Scheduler:
    http://www.swiftmq.com/products/router/swiftlets/scheduler/index.html
    To solve your problem you'd create a message schedule:
    http://www.swiftmq.com/products/router/swiftlets/scheduler/messagejobs/index.html
    -- Andreas

  • I've tried to update my ipad 2 with IOs 6 but it was not possible. An error message always appear after some time during e download. Is there an solution?

    I've tried to update my ipad 2 with IOs 6 but it was not possible. An error message always appear after some time during e download. Is there an solution?

    Are you trying to update via wifi or connected to your computer?
     Cheers, Tom

Maybe you are looking for