I am creating lists from javascript in my app.
Now I want to create a Field in that with unique values which is a number field.
I am using following code:
var fldCollection = oList.get_fields(); var f2 = context.castTo( accordionList.get_fields().addFieldAsXml("<Field Type='Number' DisplayName='AccordionOrder' Name='AccordionOrder' Required='True' Indexed='True' EnforceUniqueValues='True'/>", true, SP.AddFieldOptions.addToDefaultContentType), SP.FieldNumber); f2.set_title("AccordionOrder"); f2.update(); context.executeQueryAsync(onSuccessFieldAdd, onFail);
But when the code is getting executed it gives me error like:
This field must be indexed to enforce unique values
How can I create this field unique? I have put Indexed='True'
in the code. But it is not working.
Any help will be appreciated..