Forum Discussion

prash4030's avatar
prash4030
New Contributor III
8 months ago

People Planning new hire entry

Hello Expert,

Is it possible to make employee register fields mandatory? we want users to select certain required fields before committing save. 

Let me know,

thank you

  • It depends on the requirements where and what you want to do. In my case I added validation checks in both BeforeSaveDataEvent. 

    Below is a small example:

    If (args.FunctionName.XFEqualsIgnoreCase("SaveRegisterRows")) Then
    Dim saveDataTaskInfo = New XFSqlTableEditorSaveDataTaskInfo
        saveDataTaskInfo = args.SqlTableEditorSaveDataTaskInfo
        For Each xfRow As XFEditedDataRow In saveDataTaskInfo.EditedDataRows
            If xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Insert OrElse xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Update Then
    Dim status As String = xfRow.ModifiedDataRow.Item("Status") 
    If (String.IsNullOrEmpty(JobTitle) Or JobTitle.XFContainsIgnoreCase("TBD")) Then
    isError = True
                 errorMessage = errorMessage & Environment.NewLine & "Job Title cannot be blank or TBD for RegisterID: ...."."
    End If
    Next
    ....
    At the end of the code throw the exception...Is the above condition is met then a popup message will showup when planner clicks on the save.
     

     

  • hbindu's avatar
    hbindu
    New Contributor III

    It depends on the requirements where and what you want to do. In my case I added validation checks in both BeforeSaveDataEvent. 

    Below is a small example:

    If (args.FunctionName.XFEqualsIgnoreCase("SaveRegisterRows")) Then
    Dim saveDataTaskInfo = New XFSqlTableEditorSaveDataTaskInfo
        saveDataTaskInfo = args.SqlTableEditorSaveDataTaskInfo
        For Each xfRow As XFEditedDataRow In saveDataTaskInfo.EditedDataRows
            If xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Insert OrElse xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Update Then
    Dim status As String = xfRow.ModifiedDataRow.Item("Status") 
    If (String.IsNullOrEmpty(JobTitle) Or JobTitle.XFContainsIgnoreCase("TBD")) Then
    isError = True
                 errorMessage = errorMessage & Environment.NewLine & "Job Title cannot be blank or TBD for RegisterID: ...."."
    End If
    Next
    ....
    At the end of the code throw the exception...Is the above condition is met then a popup message will showup when planner clicks on the save.
     

     

  • hbindu's avatar
    hbindu
    New Contributor III

    Yes, you can. you can change the color of the register fields to differentiate between read-only and allow-updates fields. You can add validation checks in the custom Event People Planning Business rule to check if the required fields have the values before saving the new entry by the planner.

    • prash4030's avatar
      prash4030
      New Contributor III

      hi,

      thank you for your reply.

      i tried to figure this out through documentation on events but no luck. i configured the reference assembly for PLP Solution helper (as per documentation). do i need to use SaveRegisterRows to validate? and how to pass field names as parameter and in case of missing value, want to show a msgBox.

      would really appreciate any guidance. 

  • prash4030's avatar
    prash4030
    New Contributor III

    thank you so much! i was able to configure as per my need. thank you again

    regards

    prashant