1

My function only works when I'm using my SP_ADMIN user. But when I'm using another user I receive the following error message from the console:

500 (Internal Server Error)

What's wrong with this code?

function addBirthday(List,Name, monthDay, Month, Location) {
    var hoy = new Date();
    var mes = hoy.getMonth();
    mes = mes + 1;

    var query = "<Query><Where><Eq><FieldRef Name='Mes_Nacimiento' /><Value Type='Integer'>"+mes+"</Value></Eq></Where><OrderBy><FieldRef Name='Dia_Nacimiento' Ascending='True' /></OrderBy></Query>";

    var camlViewFields = "<ViewFields><FieldRef Name='"+Name+"' /><FieldRef Name='"+monthDay+"' /><FieldRef Name='"+Month+"' /><FieldRef Name='"+Location+"' /></ViewFields>";

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: List,
        CAMLViewFields: camlViewFields,
        CAMLQuery: query,
        completefunc: function(xData, Status) {

            $(xData.responseXML).SPFilterNode("z:row").each(function() {

                var ItemNombre = $(this).attr("ows_"+Name);
                var ItemDay = $(this).attr("ows_"+monthDay);
                var ItemDayS = ItemDay.toString();
                var ItemMonth = $(this).attr("ows_"+Month);
                var ItemLocation = $(this).attr("ows_"+Location);
                if(ItemDayS.length == 1)
                    ItemDayS = "0" + ItemDayS;

                alert(ItemNombre);

            }); // end completefunc
        }
    }); // end SPServices call
}

1 Answer 1

1

It sounds like the other users don't have read access to the external list. Have you set the object permissions in Central Admin so that all users (or whatever subset) can read the external data?

2
  • Thanks! But Where I can give them permissions?
    – user50540
    Feb 25, 2016 at 16:02
  • technet.microsoft.com/en-us/library/jj683113.aspx Central Admin >> Application Manage Management >> Manage service applications >> BDC > [your external content type] ... Set Object Permissions (in the ribbon)
    – Erin L
    Feb 25, 2016 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.