lundi 11 avril 2022

Field data types fingerprints for "validateUpdateListItem"

Field data types fingerprints for "validateUpdateListItem"

With "validateUpdateListItem" all major field data types update is supported, yet it can be difficult sometimes to find the correct format. So as a bonus section: 


.validateUpdateListItem([
  // Text field (single line and note)
  { FieldName: 'TextField', FieldValue: '123' },
  // Number field
  { FieldName: 'NumberField', FieldValue: '123'  },
  // Yes/No field
  { FieldName: 'YesNoField', FieldValue: '1' /* Yes, No, 1, 2 */ },
  // Person or group, single and multiple
  { FieldName: 'PersonField', FieldValue: JSON.stringify([{ Key: LoginName }]) },
  // Dates should be in in the following formats
  { FieldName: 'DateTimeField', FieldValue: '6/23/2018 10:15 PM' },
  { FieldName: 'DateField', FieldValue: '6/23/2018' },
  // Choice field (single and multi-valued)
  { FieldName: 'ChoiceField', FieldValue: 'Choice 1' },
  { FieldName: 'MultiChoiceField', FieldValue: 'Choice 1;#Choice 2' },
  // Hyperlink or picture (after URL a description can go after ', ' delimeter)
  { FieldName: 'HyperlinkField', FieldValue: 'https://arvosys.com, ARVO Systems' },
  // Lookups fields (single and multi-valued)
  { FieldName: 'LookupField', FieldValue: '2' /* Item ID as string */ },
  { FieldName: 'MutliLookupField', FieldValue: [3, 4, 5].map(id => `${id};#`).join(';#') },
  // Mamnaged metadata fields (single and multi-valued)
  { FieldName: 'SingleMMDField', FieldValue: 'Department 2|220a3627-4cd3-453d-ac54-34e71483bb8a;' },
  { FieldName: 'MultiMMDField', FieldValue: 'Department 2|220a3627-4cd3-453d-ac54-34e71483bb8a;Department 3|700a1bc3-3ef6-41ba-8a10-d3054f58db4b;' }
]);

Happy coding!

Aucun commentaire:

Enregistrer un commentaire