none
SharePoint Add In, JavaScript issue RRS feed

  • Question

  • Hi friends,

    I am in process of developing a SharePoint Add-in and I am stuck in JavaScript concept.
    I am not too strong in JavaScript. Users can select their tasks in SharePoint. For e.g. they selected tasks with Task IDs 10 and 9 as shown:




    In my Add-in I intercept those selected IDs and need to make an array so that I can do further processing.

    I make a function (MakeCAML) and select those list item IDs, each value task ID separately. For e.g. 10 will be one entry and 9 with second entry etc in the for each loop.  
    But in my function I am able to get listItemIDs as comma separate values like 10, 9. But when I access the indexer, I always get listItemIDs[0] 1 as value. I need to make listItemIDs[0] as 10.

    How could I achieve  this?

    Any help would be helpful. 

    Sandy

    Monday, December 19, 2016 5:21 PM

Answers

  • Hi,

    In your code, please use the following line of code to get the value.

    listItem[0];

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Sandy 791 Thursday, December 22, 2016 6:51 AM
    Wednesday, December 21, 2016 8:16 AM
    Moderator

All replies

  • Hi,

    In your code, please use the following line of code to get the value.

    listItem[0];

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Sandy 791 Thursday, December 22, 2016 6:51 AM
    Wednesday, December 21, 2016 8:16 AM
    Moderator
  • Hi Dennis, 

    You are correct. I changed the indexer as a dynamic value and start working. 
    Thanks. 

     for (var i = 0; i < delimiterlistItemIds.length ; i++) {
            queryMainFirst = "<View><Where><Or>";
            queryMainMiddle = "</Or></Where>"
            rowLimit = delimiterlistItemIds.length;
            queryMainLast = "</View>";
            listItemIds = decodeURIComponent(getQueryStringParameter("SPListItemId"));
    
            
    
            queryFilter += "<Eq><FieldRef Name='ID' /><Value Type='Counter'>" + delimiterlistItemIds[i] + "</Value></Eq>";
    
        }


    Sandy

    Thursday, December 22, 2016 6:51 AM