Forum Discussion
prash4030
2 years agoNew Contributor III
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
- 2 years ago
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")) ThenDim saveDataTaskInfo = New XFSqlTableEditorSaveDataTaskInfosaveDataTaskInfo = args.SqlTableEditorSaveDataTaskInfoFor Each xfRow As XFEditedDataRow In saveDataTaskInfo.EditedDataRowsIf xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Insert OrElse xfRow.InsertUpdateOrDelete = DbInsUpdateDelType.Update ThenDim status As String = xfRow.ModifiedDataRow.Item("Status")If (String.IsNullOrEmpty(JobTitle) Or JobTitle.XFContainsIgnoreCase("TBD")) ThenisError = TrueerrorMessage = errorMessage & Environment.NewLine & "Job Title cannot be blank or TBD for RegisterID: ...."."End IfNext....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
OneStream Employee
2 years agoIt 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.
Related Content
- 1 year ago
- 2 years ago
- 8 months ago