How to make field required On change the Picklist values

Posted by Sudhakar on 18-Sep-2014 10:40

Hi Team,

As shown above, consumer Direct Status (Reference field from Client2 object) is a picklist field editable in the above page (Client status )and Drip Reason (Native in Client object ) is native field.


My requirement is when on changing the consumer Direct Status in client status page,if the value of Consumer Direct Status is DRIP,then we need make Drip reason field as required other wise no need to make required.

Can Any one help me how can i achieve the above.

All Replies

Posted by pvorobie on 18-Sep-2014 10:45

You can write validation logic for your field which generates if no value is set in certain cases (depending on value of another field).

Posted by Orchid Corpin on 18-Sep-2014 10:52

Hi sudhakar,

This can be achieve with a field validation of Drip Reason field, can be something like this codes.

if("{!R12345#value}" == "DRIP" && "{!drip_reason}" == "") { 
   return "Drip Reason must be specified."; 
}

Regards,

Orchid

Posted by Orchid Corpin on 18-Sep-2014 10:54

Try using a trigger "Validate Record Data" and specify the sample code above.

Posted by Sudhakar on 18-Sep-2014 10:58

the drip reason field we are using in more than 1 page,and we want to make it required only in specific page as shown in above  based on consumer Direct Status field change  

Posted by Sudhakar on 18-Sep-2014 11:17

i try to use following code in Validation record data and added the trigger in workflow action,but even through Consumer direct status value is Drip on loading the page and if i try to change value other than Drip then also it displaying error message,

if("{!R77816268.consumer_direst_status#value}"=="DRIP")

{

return "Drip Reason is required";

}

Posted by Orchid Corpin on 18-Sep-2014 11:42

Try remove the timing "before update" if you specified this to the trigger, but I see something wrong by doing this the validation error came after the record was saved.

Posted by Sudhakar on 18-Sep-2014 12:04

i removed the Trigger timing and tried, i too face same thing,it showing error message after saving the record instead of showing before save the record.

How can we overcome that?i.e how can we show error message below/beside the field after save ?

Posted by Orchid Corpin on 18-Sep-2014 12:28

another option in to specify the validation in the drip reason field not in the consumer direct status since that has no validation link, and add a workflow status to the condition "{!status#code}" == "statusCode_here"

Something like:

if("{!R77816268.consumer_direst_status#value}"=="DRIP" && "{!drip_reason}" == "" && "{!status#code}" == "status_code") { 
   return "Must be specified."; 
}


Posted by Sudhakar on 18-Sep-2014 12:42

i did not get the complete thing,can you pls let me about 3rd condition i.e "{!status#code}" == "status_code")

Posted by Orchid Corpin on 18-Sep-2014 12:47

Since you are having a workflow action, that will be an indicator when the validation will be run instead of a particular page.

Posted by Sudhakar on 18-Sep-2014 12:49

thank you very much i got it,let me try the code

Posted by Sudhakar on 18-Sep-2014 13:21

no it is not working,i think it not taking consumer_direst_status value onchange

Posted by Orchid Corpin on 18-Sep-2014 13:39

Hi Sudhakar,

I see the issue now, the related field seems like not taking effect when changing the values and in the validation it is getting the "before" value. Let my try to report this issue to the team.

Just in case and if possible, try creating a picklist field instead of using the related field, this works for me when I test the picklist in a validation.

Regards,

Orchid

Posted by Sudhakar on 18-Sep-2014 13:43

actually the problem why we are using reference field is we do not have space for creating picklist in Client due to Field limitations,that is why we are using reference field.  

Posted by Orchid Corpin on 18-Sep-2014 13:58

I see, since you hit the Maximum of 150 integer Fields this includes the picklist, try using Radio buttons if possible which can have Maximum of 50 (not sure if you also hit this 50?). Radio buttons can function or an alternative for single-select picklist too.

Regards,

Orchid

Posted by Sudhakar on 18-Sep-2014 14:04

currently we have option for only formula fields and reference fields in client Object,we already crossed 500 fields limitations.

Posted by Orchid Corpin on 18-Sep-2014 18:11

That's a lot, in private cloud you can change the max number of fields.

Regards,

Orchid

This thread is closed