This example demonstrates how to validate a single field value. For example, the following code segment shows how you can ensure that a user in a specific group cannot lower the priority of a defect.
In this example, if the user is in the QATestergroup and the BG_PRIORITY field is being modified, the new value of the BG_PRIORITY field cannot be lower than the current value.
This example assumes that in the Priority field list for the project, lower priorities come first when the values are sorted in ascending order. For example, the list meets this requirement if the elements are as follows: 1-Low, 2-Medium, 3-High.
Add the code to the Bug_FieldCanChange event procedure so that it is triggered when the user attempts to change a defect field value.
Function Bug_FieldCanChange(FieldName, NewValue) ' Initialize the function's return value ' to avoid unpredictable behavior. Bug_FieldCanChange = True OnErrorResumeNext If User.IsInGroup("QATester") and FieldName ="BG_PRIORITY" _ Then If NewValue < Bug_Fields("BG_PRIORITY").Value then Bug_FieldCanChange = False msgbox "You do not have permission to lower " _ & "defect priority." Else Bug_FieldCanChange = True EndIf Else ' Enter your code here. EndIf PrintError "Bug_FieldCanChange" OnErrorGoTo 0 EndFunction
functionBug_FieldCanChange(fieldName, newValue) { // Initialize the function's return value to avoid unpredictable behavior. var Bug_FieldCanChange = true; if (User.IsInGroup("QATester") && fieldName == "BG_PRIORITY") { if (newValue < Bug_Fields("BG_PRIORITY").Value) { Bug_FieldCanChange = false; MsgBox("You do not have permission to lower " + "defect priority."); return Bug_FieldCanChange; } else { Bug_FieldCanChange = true; return Bug_FieldCanChange; } } else { // Enter your code here. } console.log("Bug_FieldCanChange"); }
https://admhelp.microfocus.comALM8942
Tips to improve your search results...ALM Help CenterALM Help CenterALM Help17.0-17.0.1AllView Local Help CenterView Online Help CenterbackGo back in browser historyforwardGo forward in browser historyRemove search highlightsnext topicGo to next topicprevious topicGo to previous topicPrint the current topicVersion:
Send Help Center Feedback
Let us know how we can improve your Help Center experience.