The rule "Before-save Rule for Task#Assignment.AssignedBy" of the Task.Assignment object does not work as expected

Version 1

    Details

    The rule "Before-save Rule for Task#Assignment.AssignedBy" of the Task.Assignment object does not work as expected, as it is not filling up the value when it is null.

    $(if Status == "Accepted"
      then if AssignedBy == EmptyString() || AssignedBy == null
           then CurrentUserName()
           else AssignedBy
      else if Status == "Completed"
           then if AssignedBy == EmptyString() || AssignedBy == null
                then CurrentUserName()
                else AssignedBy
           else if Status == "Assigned"
                then if AssignedBy == "  " || AssignedBy == EmptyString()
                     then CurrentUserName()
                     else AssignedBy
                else null)


    Resolution

    The rule: "Before-save Rule for Task#Assignment.AssignedBy" must be modified with the following definition:

    $(if Status == "Accepted"
      then if AssignedBy == EmptyString() || nvl(AssignedBy,  "1") == "1"
           then CurrentLoginId()
           else AssignedBy
      else if Status == "Completed"
           then if AssignedBy == EmptyString() || nvl(AssignedBy,  "1") == "1"
                then CurrentLoginId()
                else AssignedBy
           else if Status == "Assigned"
                then if AssignedBy == "  " || AssignedBy == EmptyString() ||
                        nvl(AssignedBy,  "1") == "1"
                     then CurrentLoginId()
                     else AssignedBy
                else null)