I am trying to validate a SharePoint online task list column, in the way that the column "Assigned" (People column) must be populated for the user to be allowed to save with info in "Due date" (Date/time column).

That is - no due date without an assigned.

I looked at this thread, but didn't really understand how to write the formula for my needs. But I guess it's an easy task for experts :)

Could someone give me som help?

  • You cannot use person or group field values in validation formulas. you may need to use javascript code in "PreSaveFunction()" to check your conditions (just a hint). Sep 18, 2019 at 11:26

1 Answer 1


The OOB validate setting cannot validate the People picker, i recommend you insert a content editor web part in the new form or edit form page, then copy the JS code in it:

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> 
<script type="text/javascript">
function PreSaveAction(){
    var assignTo = $("input[id^='AssignedTo'][id$='ClientPeoplePicker_HiddenInput']").val().length;
    var dueDate = $("input[id^='DueDate'][id$='$DateTimeFieldDate']").val().length;
    if(assignTo == 0 && dueDate != 0){ 
        alert("Please enter Assigned To for this user field");
        return false;
    return true;

Then, when there is value in Due date but not in Assigned To column, you cannot save the item and get a alert.

  • Thanks!Before I try this out: I do not need to validate the content of the People column, only that there is/is not information in the People column. But maybe that doesn't change anythnig?
    – MandMand
    Sep 19, 2019 at 12:03
  • yes, the script I post above just check if there is information in he people picker, check if the value of length is equals 0 or not. Sep 20, 2019 at 7:48
  • It worked almost perfectly, however, I discovered that if the object is saved with Assigned and Due date, then it is possible to Open-Edit-delete Assigned-save with info in Due date but not in Assigned. Is there a workaround for this? (I have inserted the code to both New form page and Edit form page)
    – MandMand
    Sep 25, 2019 at 10:45

Your Answer

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

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