Create list item in sharepoint online list throws error in iPhone

Hi all :
I have got a piece of JS code where I am creating multiple list items. So first I am creating an Expense item and then each of the expense line item( 5 of those ) in a different list. It creates the Expense item successfully and then when it tries to
create the line items, I am getting the following error :
Request failed. Unexpected response from server. null
However when I go to the line items list, I can see all the items being created!!! I am also inserting my code below.
clientContext.executeQueryAsync(function (sender, args) {
                var createdExpenseID = viewModel.listItem.get_id();
                //Now create the expense line items - one by one
                clientContext = SP.ClientContext.get_current();
                web = clientContext.get_web();
                list = web.get_lists().getByTitle("Expense Items");
                var expenseIDLookup = new SP.FieldLookupValue();
             expenseIDLookup.set_lookupId(createdExpenseID);
                /*for (i = 1; i <= 5; i++) {
                    var descriptionField = "description"+i;
        alert(viewModel.model.window[descriptionField]);
                itemCreateInfo = new SP.ListItemCreationInformation();
             this.listItem = list.addItem(itemCreateInfo);           
             //alert(list);
             this.listItem.set_item('Title', viewModel.model.description1());
             this.listItem.set_item('Date', $('#date1').val());
             this.listItem.set_item('ProjectNumber', viewModel.model.projectNumber1());
             this.listItem.set_item('ClientToPay', viewModel.model.selectedClienttopay1());
             this.listItem.set_item('Amount', viewModel.model.amount1());
             this.listItem.set_item('ExpenseCurrency', viewModel.model.selectedExpenseCurrency1());
                this.listItem.set_item('ExchangeRate', viewModel.model.exchange1());
                this.listItem.set_item('ConvertedAmount', viewModel.model.converted1());
                this.listItem.set_item('Expense', expenseIDLookup);
                this.listItem.update();
                clientContext.load(this.listItem);
                clientContext.executeQueryAsync(function (sender, args) {
    function (sender, args) {
                 alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
                itemCreateInfo = new SP.ListItemCreationInformation();
             this.listItem = list.addItem(itemCreateInfo);           
             //alert(list);
             this.listItem.set_item('Title', viewModel.model.description2());
             this.listItem.set_item('Date', $('#date2').val());
             this.listItem.set_item('ProjectNumber', viewModel.model.projectNumber2());
             this.listItem.set_item('ClientToPay', viewModel.model.selectedClienttopay2());
             this.listItem.set_item('Amount', viewModel.model.amount2());
             this.listItem.set_item('ExpenseCurrency', viewModel.model.selectedExpenseCurrency2());
                this.listItem.set_item('ExchangeRate', viewModel.model.exchange2());
                this.listItem.set_item('ConvertedAmount', viewModel.model.converted2());
                this.listItem.set_item('Expense', expenseIDLookup);
                this.listItem.update();
                clientContext.load(this.listItem);
                clientContext.executeQueryAsync(function (sender, args) {
    function (sender, args) {
                 alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
   //Now redirect to the newly created item edititem.aspx page for attaching attachments
                window.location.replace("/sites/process/Lists/Expense/EditForm.aspx?ID="+createdExpenseID+"&Source=/sites/process");
function (sender, args) {
    alert('Expense creation failed');                
The outermost executeQueryAsync creates the Expense item and on being successful, I create the line items.
Any help will be much appreciated.
Thanks and regards,
developer_melbourne

Ok so I resolved the issue and thought to provide the answer. It was caused by the line where it is doing redirection using window.location.replace. Somehow it works in IE, not in Safari in iPhone.
Anyways you can do the redirection after all the items get created in the last success  method of the last item creation OR you can use deferred/promise of jQuery to achieve the same.
Thanks

Similar Messages

  • I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 profession​al. The create new report VI opens Excel but throws error (-21471672​62- from automation open VI) when I try to open MS word. please help...

    I am using report generation toolkit 1.1 with Labview 7.0 and Office 2003 professional. The create new report VI opens Excel but throws error (-2147167262- from automation open VI) when I try to open MS word. please help...

    Hi Leo22,
    Does this error occur if you use any of the example programs that come shipped with LabVIEW? I would try opening one of the examples that write data to Word and see if those give you an error. Also, have you tried just putting down a New Report.VI and change the report type to Word? If this simple vi (that's all you need to open Word) breaks, I would check to see if there are any instances of Word still open. Check the task manager to see if any word processes are still open. There should not be a problem accessing Word 2003 from LabVIEW 7.0. If neither of these solutions work, please give some more detail about your application and we can research further. Thanks!
    Jeremy L.
    National Instruments
    Jeremy L.
    National Instruments

  • Is it possible for a 3rd party program to create a list item in sharepoint online 2013?

    I have limited experience with the online version of sp. I've been asked if it's possible for a 3rd party app that our company is beginning to use, to programmatically add items to a list.    I don't have any details about the program yet,
    but I've been told that a batch would run at night and they would like it to create items in a SP list and pass along several fields of metadata.   
    Is this possible in the online version?   I know that Power Shell can do this, but is it possible for an app to get access to run a PS command?   
    thanks,

    Yes.
    There is something known as the Client Side (?) Object Model or CSOM. This allows you to create list items, lists and even sites with .Net code from a non server machine.
    You could run 'classic' Server Object Model  C#/VB.NET or PowerShell to do the same job and it might be easier as there's alot more material out there on how to do it. On the other hand it's probably going to make your solution more complicated and
    harder to maintain over the long run.
    This article introduces you to the CSOM and how to use it and is applicable to O365 as well as on-premise:
    http://msdn.microsoft.com/en-us/library/office/fp179912%28v=office.15%29.aspx
    As an alternative you can look at the REST API which allows you to use web services to interact with SharePoint.
    http://msdn.microsoft.com/en-us/library/office/fp179912%28v=office.15%29.aspx

  • Can we query more than 5000 library items in Sharepoint online library using CSOM?

    I am writing a console application to fetch all documents from the SharePoint Online Site. I am worrying what happens if library items grow beyond 5000 items. In my earlier experience from SP2010, I will raise the threshold limit from Central Admin Site
    and then perform my CAML query operation. In SharePoint Online Site, is this possible ? If not, is there any alternative to get all the documents above 5000 limit ?

    At the moment I wouldn't advise it without using folders.
    You can, definitely, add more than 5k items in Office 365 lists. If you design them well and add indexes before you go over the threshold then it should be fine.
    HOWEVER, once you go over the 5k threshold you lose the ability to change all the items in the list at once. Which means you can't add indexes to columns, can't add new columns, can't remove columns or perform any large admin task.
    Incidentally CAML queries and upping the threshold are either/or options in on-premises installs. CAML is the way forward and can be used without increasing the threshold in the vast majority of cases.
    In terms of support the MS documentation is unhelpful:
    http://office.microsoft.com/en-gb/office365-sharepoint-online-enterprise-help/sharepoint-online-software-boundaries-and-limits-HA102694293.aspx
    There it states that MS only support 5k items in a site list/library.

  • Stop and Restart Workflow on Item Edit (sharepoint online)

    How can I stop running the workflow instances for the current updated list item?
    I mean, how can I recognize the item that just updated and how can I stop the workflow
    that access with this item? in s.p online.
    thank you! 

    Hi,
    According to your post, my understanding is that you wanted to cancel workflow in SharePoint online.
    We can pass the ID of the list & list item to get all the instances, then you can enumerate each of them and find the one you want to suspend or terminate.
    To pass the ID of the list and list item, you can refer to the following code snippets.
    // connect to the workflow services via a CSOM client context
    var clientContext = new ClientContext(siteCollectionUrl);
    var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web);
    // connect to the instance service
    var workflowInstanceService = workflowServicesManager.GetWorkflowInstanceService();
    // get all instances
    var workflowInstances = workflowInstanceService.EnumerateInstancesForListItem(listId, listItemId);
    clientContext.Load(workflowInstances);
    clientContext.ExecuteQuery();
    Then we can find the list item workflow to suspend as below.
    foreach (var instance in workflowInstances)
    // is this what we are looking for?
    // if so, suspend it
    workflowInstanceService.SuspendWorkflow(instance);
    // or you can terminate it
    workflowInstanceService.TerminateWorkflow(instance);
    http://sharepoint.stackexchange.com/questions/69366/how-do-we-stop-a-sharepoint-2013-workflow-azure-workflow-programmatically
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • SELECT LIST throws error for WHERE CLAUSE

    Hi All
    I am struck with, what looking like a trivial error, but I don't know how to settle it down. I am new to Apex (3.1). I am experimenting with. I have Oracle 10g running on Windows.
    I have a dropdown item in one of my pages (SELECT list). I am trying to display few items there dynamically (depends on the user who logged in). I set it as SELECT LIST and entered the following query in "List of Values".
    select enrolled_course display_value, course_id return_value
    from COMP_LIST
    where stu_id = :APP_USER
    order by 1I got the following error.
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.Then, I tried the step by step instruction from "Oracle® Application Express - Advanced Tutorials -Release 3.1.2 -E10497-02". Using creating list of values creation as seperately. That too, I got the same error.
    I am doing it wrong I suppose. Please correct me. Thanks in advance
    With Regards
    Guru
    Edited by: guru paran on Oct 16, 2008 5:12 PM

    Thanks Andy
    When I hardcoded, it worked.
    select enrolled_course display_value, course_id return_value
    from COMP_LIST
    --where-- --emp_id-- = --100--
    where stu_id = 100
    order by 1
    {code}
    :APP_USER is not working then, Now, I should be using v('APP_USER')? When I tried v('APP_USER'), I got the same error back! The COMP_LIST is a view. Is there some problem with the view then?
    But again, I am able to select from it without WHERE (now with hardcoded value also)....
    Edited by: guru paran on Oct 16, 2008 6:26 PM
    Added [code] tags
    Edited by: guru paran on Oct 16, 2008 6:42 PM
    It is STU_ID and not EMP_ID
    Edited by: guru paran on Oct 16, 2008 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Preserving old Created On dates during SharePOint Online migration

    We are currently migrating files from our on-premise fileshare to SharePoint Online. We wish to carry as much file meta data from the fileshare into SharePoint Online, but when we drag&drop a file from the fileshare to our Documents
    library in in SharePoint we lose the original Created On data stored on the fileshare i.e. SharePoint site column 'Created' is populated with the date the file is created on SharePoint and not the original date of the file.
    Could anyone advise on how we can carry the Created On date from the fileshare into SharePoint?

    I believe Office 365 supports only web templates, not site templates. There is a subtle difference between these two.
    http://geekswithblogs.net/erwinvanhunen/archive/2012/02/09/creating-a-site-collection-from-your-own-webtemplate-on-office.aspx
    You need to create a custom web template, import it as .wsp, upload to Solutions gallery of Office 365 site-collection and activate it it. Have your done this ??
    I don't think you get direct access to log files for troubleshooting correlation id issues. You may need to contact microsoft support.
    Please mark the replies as answers if they help or unmark if not.

  • Creating Library Item results in series of JavaScript error messages?

    I've made two attempts to create library items from a page. One is a navigation bar and the other a side bar that has some lists and "non html code" in it.
    In both cases as the library item was created I rec'd a series of alerts warning of JavaScript errors.
    See attached images, which show just two of the error messages.
    It appears that the library item is then created but if I insert it into another document I get more JavaScript error messages.
    What do I do to avoid having this JavaScript problem?
    Thanks

    Troubleshooting JavaScript errors in Dreamweaver

  • Automatically upload documents to list items in Sharepoint Online

    Hi
    I need to upload pdf documents to a list (not
    a document library, this is not an option) on SharepointOnline (Office365).
    In practice, whenever a document is "sent" or "uploaded" to the list, a new list item would be created automatically and the document would be attached to the list item automatically.
     At the moment, we are doing this manually but this is not practical with 1,000s of documents.
    Any help would be appreciated. The community365 people were unable to help and redirected me here.
    Many thanks,
    AK

    For those who may be interested, I found a workaround that does the trick.
    Rather than uploading the actual documents to each list item, I upload the documents to a document library and then include hyperlinks to the locations of the documents in the document library.
    This can be achieved by:
    (i) creating a new workflow in Sharepoint Designer;  the workflow must be attached to the document library where the documents are located AND must be set to launch automatically when a new item is created in the library (see the parameters of the workflow);
     and
    (ii) in the workflow, choose the action "create a new item"; click on "this list" and choose your destination list; choose a list column where the hyperlink will appear and click on "add" to add a field directing towards that column; choose "Current Element/Encoded
    Absolute URL" as the source of data. And bam! it works. A life saver.
    Cheers
    AK

  • Error while creating new item in SharePoint List

    Hi,
    I have requirement to use cascading dropdown, I just created all the steps which are explained in the below URL
    http://spcascade.org/. But i am getting Debug message Error: "Error pulling data from list"
    and "try setting spWebUrl to appropriate SharePoint URL". Please help me to find the solution fro this.
    Thanks.

    var spObj = $().SPCascade({
    destListColTitles: ['Continent','Country','State','City'],
    srcListColInternalNames: ['Continent','Country','State','Title'],
    srcListName: 'CitiesLookupList',
    srcListFilterCAMLQuery: "<Query><Where><Contains>
    <FieldRef Name='Continent'/><Value Type='Text'>America</Value>
    </Contains></Where></Query>"
    spWebURL: 'http://sharepointurl',
    getDataOnly: 'false',
    debug: 'true',
    });

  • Show filter choice option in SharePoint List throws error

    Hi,
    I have a list in SharePoint 2010 site. I tried to put a filter on one of the columns, I got the 'Show Filter Choice' option. When I clicked on it, this was the error message I got:
    Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
    Same activity on a different list in the same site did not throw this error and worked just fine. What could be the possible reason?

    After a lot of research and googling, I found the root cause:
    If the XSLT transforming takes longer tham 1 sec (Defult setting), this error will be thrown. This issue is present in RTM and a fix to it is was released in FEB 2014 CU. After applying the patch I had to run this powershell script:
    $farm = Get-SPFarm
    $farm.XsltTransformTimeOut = 5
    $farm.Update()
    To check the current timeout value, run this:
    $farm = Get-SPFarm
    $farm.XsltTransformTimeOut
    Reference: http://blogs.msdn.com/b/bkr_sharepoint/archive/2014/06/09/no-xslttransformtimeout-found-property-in-sharepoint-farm.aspx

  • Selecting a Role from dropdown list throws error

    Hi,
    I'm using CRM Web UI 7.0. I'm facing problem selecting a Role from dropdown list in the assignment block Roles in the screen Employee. The problem is that the dropdown list doesn't show any value on clicking and gives an error message "Error on page" at the bottom of page. The roles exist in the system and also I'm able to see them for Accounts screen & in the GUI.
    Kindly help.
    Regards,
    Shaili

    Hi,
    Just to add to this issue: WebUI-> Account Management-> Contacts-> Roles-> Edit list. When we try to add a role from dropdown in Firefox, it works fine but same throws an error in Internet Explorer related to some script.
    Did someone face similar issue and how was it solved?
    Regards,
    Shikha

  • Sharepoint Online - File Associations - Create association for .sql files in SPO365

    I maintain a document library as a script repository with .sql scripts.  we refer to these often for operational processes.  
    unfortunately, we are currently only given the option to download these files from SharePoint Online.   
    Is it possible to create an association in SharePoint Online to have these files preview as text or to at least open them in SSMS or Notepad. 
    caveat =  we dont want to change the default OS association for these files.  SSMS is fine for the desktop, but in SPO365 a text viewer would be ideal as it would most easlily facilitate a copy and paste. 
    Thanks 
    G'B
    Scott Davis

    Hi,
    According to your description, when you removed the Read List and Read Item operations and created them back based off of the view and recreated the external list, you saw all the columns you wanted.
    Then you can modify view to choose the columns which you want to display.
    The issue is, now the item picker and other operations that did not change seem to be going off of the view.
    Do you mean that when you add/edit the item, it still displays the foreign key column in the list view?
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • Create new User Account in sharepoint online

    I am trying to create a webpart (C#)  to allow a user to create an account in sharepoint online (office 365). I thought there would be some type of web-service I could use to do this but so far no luck. I tried sharepointemailws.asmx but that didn't
    work. There has to be a way that this can be done in C#, does anyone know? Help!

    As you can use the New-MsolUser PowerShell cmdlet there must be a web service there. These might not be documented yet. You might try using Fiddler and see what PowerShell is sending.
    Mike Smith TechTrainingNotes.blogspot.com
    my SP customization book

  • How to disable Add New Item in SharePoint 2013

    Hi,
    I want to disable the Add New Item button after the user created one item in SharePoint 2013.
    Is it possible to disable?
    Please reply
    Thank you

    I'd do it creating a custom web part that would mimic the list web part, and have logic in there that makes sure to hide the button once an entry by the current user has been made in the list. You could also create a workflow that would remove the user's
    permission to add a new item on the list upon creating an item.
    Nikolas Charlebois-Laprade Microsoft Certified Professional & Software Engineer http://nikcharlebois.com

Maybe you are looking for