0

I'm unable to set the default value to false of my boolean field called Done

pnp.sp.web.lists.add("Todo","").then(() => {
  pnp.sp.web.lists.getByTitle("Todo").fields.add("Done","SP.FieldText",{
    FieldTypeKind: 8,
    Hidden: false
  }).then(() => {

  });
});

Does anyone have an idea, because I can't find any documentation on this.

1

You can try setting the xml schema of the field:

pnp.sp.web.lists.getByTitle("Todo").fields.createFieldAsXml('<Field 
    Type="Boolean" 
    DisplayName="Done" 
    Required="FALSE" 
    Indexed="FALSE" 
    ID="{f1c6f202-f976-4f4e-b0a3-8b984991d00d}" 
    StaticName="Done" 
    Name="Done" >
<Default>false</Default>
</Field>').then(f => {
    console.log(f);
});

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.