0

Is it possible to get the default values for a library using JavaScript?

For example for the column A I've set the default Value 'Pencil'

  • What do you mean by default values for library ? – Pushpendra Aug 5 '15 at 15:38
  • For example for the column A I've set the default Value 'Pencil' – yngrdyn Aug 5 '15 at 15:41
  • 1
    For this you need to read each column and find its default value. I will provide the required code snippets as answer. – Pushpendra Aug 5 '15 at 15:44
2

To get the default values of columns you first need to get the columns and then use the get_defaultValue() method to get the default value.

this.list = webSite.get_lists().getByTitle("ListTitle");
this.fieldCollection = list.get_fields();
this.field = fieldCollection.getByTitle("FieldTitle");

Once you get the field you can use the below code to find the default value.

defaultValue = field.get_defaultValue();

Note : This is not a tested code so might need to correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.