function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RakeebRakeeb 

Kindly Read the following Scenario for validation

HI, i have checkbox and text dataype i.e status and points, if the status is active then it will enable the point textbox otherwise it should be disable the textbox (points) ,so how can i do the validation so kindly let me know ASAP.

SAPOCSAPOC

from what i understood,Status is checkbox and Points is text field.

when status is checked point textbox can have value.if not no.

You can write validation rule like this.

 

if(Status__c,ISNull(point__c),!ISNull(point__c))

 

Error Message,

Points field can have value only when status is Active.

RakeebRakeeb

Thanks for giving the solution and one more thing i want,i have 2 custom objects names are quiz and quiz participant.

In quiz contains  Minimum_Score__c (Number) custom field

In quiz participant contains Quiz_Scored_Gain__c(number) ,Attempts__c(number) and user_quiz_status__c(Checkbox-active/Inactive)

my question is

 

  • If QUIZ_SCORE_GAINED >= MINIMUM_SCORE, then the USER_QUIZ_STATUS for that participant should be made as SUCCESS(active) else USER_QUIZ_STATUS = “FAILED”(inactive)
  • If USER_QUIZ_STATUS = “SUCCESS”, participant is not allowed to take another attempt
  • If USER_QUIZ_STATUS = “FAILED” and ATTEMPTS<=4 then participant can take on the Quiz for next attempt

So how can do validation  so kindly let me know the sol asap.

 
SAPOCSAPOC

Validation Rule:

if(Quiz_SCORE_GAINED>=MINIMUM_SCORE,USER_QUIZ_STATUS,IF((ATTEMPTS>=4 & USER_QUIZ_STATUS),TRUE,FALSE))

 

ERROR MESSAGE:

PARTICIPANT NOT ALLOWED TO TAKE ANOTHER ATTEMPT.

RakeebRakeeb

Thanks for giving reply, i have create validation for Quiz_SCORE_GAINED custom field i.e which you have provided above but i am getting error like "Error: Incorrect parameter for operator '&'. Expected Text, received Number"

 

 

 

Thank you,

SAPOCSAPOC

if(Quiz_SCORE_GAINED>=MINIMUM_SCORE,USER_QUIZ_STATUS,IF((AND(ATTEMPTS>=4 ,USER_QUIZ_STATUS),TRUE,FALSE))

 

RakeebRakeeb

Thanks alot to you for giving such a kind of solutions and your team.According to above scenario if Quiz_SCORE_GAINED>=MINIMUM_SCORE(it is successfully passed) then he sholud not attend the quiz i.e ATTEMPTS__c text field should be disabled.if he failed i.e Quiz_SCORE_GAINED<=MINIMUM_SCORE then he can attend the quiz up to 5 times .kindly let me know solution for asap

 

Thank you



SAPOCSAPOC

You can make fields enable or disable using visual force and Apex code only.

 

however you can prevent any action using validation rules.in your scenario you need to write VF  page to disable Attempts when Quiz_score_gained>=Minimum_score.

 

using validation rule you can prevents users from attempting the quiz as below

 

if(Quiz_Score_gained>=Minimum_score,isNull(Attempts),if(Attempts>5,True,false))

 

Error Message: User cannot attend Quiz.

RakeebRakeeb

Thanks a lot,i have 2 custom fields in different custom objects like quiz_duration_c and quiz_started_on .

the question was :

Quiz should be automatically ended on or before CURRENT_QUIZ_STARTED_ON + QUIZ_DURATION ,for these how can i do validation kinldy let me know asap.

 

Thanks