Editable grid

Certified Associate Developer

Hi guys,

In editable grid i have two fields one is scheduled date and one is Assignee.

Condition:

Scheduled date is mandatory field if the user add any name in assignee field.

If there is no name in assignee field, the system should allow to continue without scheduled date.

I tried this below code but its not working fine

1. When we add assignee and scheduled date its working.

2. When we add assignee without scheduled date i am getting a warning message.

3. When we add scheduled date without assignee its showing nothing, but i want to get display error message as "The scheduled date is mandatory if assignee is populated.

Code:

required: if(

not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),

true,

false),

validations: {

if(

and(not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),rule!AF_RULE_General_isBlank(ri!riskAssessmentData.scheduledDate)),

"The Scheduled date is mandatory if there is an assignee",

{}

)

}

  Discussion posts and replies are publicly visible

Parents
  • 1.) I really recommend the "insert" functionality for inserting code in the community forum. I makes it way easier to read. 
    2.)

    required: if(
    not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
    true,
    false
    ),
    
    -> make it shorter:
    
    	required: not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),

    3.) Your validation condition says: when your assignee is NOT NULL and  your scheduled day is NULL then show this message. But just in THAT case. 
    so you need to display your second scenario as well

    	validations: {
    			if(
    				or(
    				    and(
        					not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
        					rule!AF_RULE_General_isBlank(ri!riskAssessmentData.scheduledDate)
        				),
        				and(
        					rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
        					not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.scheduledDate))
        				)
        			),
    				"The Scheduled date is mandatory if there is an assignee",
    				{}
    				)
    
    	}

Reply
  • 1.) I really recommend the "insert" functionality for inserting code in the community forum. I makes it way easier to read. 
    2.)

    required: if(
    not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
    true,
    false
    ),
    
    -> make it shorter:
    
    	required: not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),

    3.) Your validation condition says: when your assignee is NOT NULL and  your scheduled day is NULL then show this message. But just in THAT case. 
    so you need to display your second scenario as well

    	validations: {
    			if(
    				or(
    				    and(
        					not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
        					rule!AF_RULE_General_isBlank(ri!riskAssessmentData.scheduledDate)
        				),
        				and(
        					rule!AF_RULE_General_isBlank(ri!riskAssessmentData.assignee)),
        					not(rule!AF_RULE_General_isBlank(ri!riskAssessmentData.scheduledDate))
        				)
        			),
    				"The Scheduled date is mandatory if there is an assignee",
    				{}
    				)
    
    	}

Children
No Data