This example demonstrates how you can perform validations of all fields by using the CanPost event procedure. For example, this code segment ensures that a user cannot reject a defect without adding a comment.
In this example, a user may not post a defect where the defect status (BG_STATUS) has been changed to Rejected unless some explanatory text has been typed in the R&D Comment field (BG_DEV_COMMENTS).
Add the code to the Bug_CanPost event procedure so that the check is performed when the user attempts to submit the defect.
Function Bug_CanPost ' Initialize the function's return value ' to avoid unpredictable behavior. Bug_CanPost = False OnErrorResumeNext If Bug_Fields("BG_STATUS").IsModified and _ Bug_Fields("BG_STATUS").Value = "Rejected"and _ not Bug_Fields("BG_DEV_COMMENTS").IsModified then Bug_CanPost = False msgbox "You must enter a comment when rejecting a defect." Else Bug_CanPost = True EndIf PrintError "Bug_CanPost" OnErrorGoTo 0 EndFunction
functionBug_CanPost() { // Initialize the function's return value to avoid unpredictable behavior. var Bug_CanPost = false; if (Bug_Fields("BG_STATUS").IsModified && Bug_Fields("BG_STATUS").Value == "Rejected" && !(Bug_Fields("BG_DEV_COMMENTS").IsModified)) { Bug_CanPost = false; MsgBox("You must enter a comment when rejecting a defect."); return Bug_CanPost; } else { Bug_CanPost = true; return Bug_CanPost; } console.log("Bug_CanPost"); }
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.