Topic
  • 3 replies
  • Latest Post - ‏2013-04-03T15:30:19Z by KaranBal
MDMWPC
MDMWPC
3 Posts

Pinned topic How to make comment field mandatory in each workflow step

‏2013-04-02T12:27:04Z |
Hi All,

How to make comment field mandatory in each workflow step of collaboration area. User need to enter his comments mandatory in each step of the workflow. MDM needs to display error message if user has not entered any comments in the comment field of the workflow step.
Currently this field is optional and will allow the user to save the item and exit from the workflow step even if he has not entered any data in comments section.
Is there any way we can achieve this without adding an additional mandatory attribute for comments in each workflow step.
Updated on 2013-04-03T15:30:19Z at 2013-04-03T15:30:19Z by KaranBal
  • KaranBal
    KaranBal
    108 Posts

    Re: How to make comment field mandatory in each workflow step

    ‏2013-04-02T16:10:26Z  
    As per my understanding, the comments tab is not configurable and can not be made mandatory without editing the source code bundled with ccd.war file. But changing the source code is not supported by IBM and hence I can not recommend it.

    BUT what you can do is create another tab on that screen, call it "Mandatory COMMENT" and then make this second tab a required field leaving the original as is. Creating a new tab on the screen can be done using the $TOP/etc/default/data_entry_properties.xml file.
  • babinag
    babinag
    91 Posts

    Re: How to make comment field mandatory in each workflow step

    ‏2013-04-03T05:04:36Z  
    Hello.

    You can not directly make "comments" field mandatory, but you can check content of this field at postprocess hook and add validation error at "id" attribute of item, for example. Try this java snippet:
    
    
    
    private 
    
    final PrePostProcessingFunctionArgumentsImpl inArgs; 
    
    private 
    
    final CollaborationItem colItem; 
    
    public 
    
    final 
    
    void checkComment() 
    { String exitValueForItem = inArgs.getExitValueForItem(); String latestComment = colItem.getLatestComment(); 
    
    if (exitValueForItem != 
    
    null) 
    { 
    
    if (exitValueForItem.equals(
    "Decline")
    //or some other step exit value && (latestComment == 
    
    null || latestComment.isEmpty())) 
    { AttributeInstance id = colItem.getAttributeInstance(
    "YourCatalogSpec/ID"); inArgs.addValidationError(id, Type.VALIDATION_RULE, 
    "You must enter system comment"); 
    } 
    } 
    }
    
  • KaranBal
    KaranBal
    108 Posts

    Re: How to make comment field mandatory in each workflow step

    ‏2013-04-03T15:30:19Z  
    • babinag
    • ‏2013-04-03T05:04:36Z
    Hello.

    You can not directly make "comments" field mandatory, but you can check content of this field at postprocess hook and add validation error at "id" attribute of item, for example. Try this java snippet:
    <pre class="jive-pre"> private final PrePostProcessingFunctionArgumentsImpl inArgs; private final CollaborationItem colItem; public final void checkComment() { String exitValueForItem = inArgs.getExitValueForItem(); String latestComment = colItem.getLatestComment(); if (exitValueForItem != null) { if (exitValueForItem.equals( "Decline") //or some other step exit value && (latestComment == null || latestComment.isEmpty())) { AttributeInstance id = colItem.getAttributeInstance( "YourCatalogSpec/ID"); inArgs.addValidationError(id, Type.VALIDATION_RULE, "You must enter system comment"); } } } </pre>
    Hi Babinag,
    I agree, that is a very elegant implementation of the requested feature. Thank you for sharing.