Default value of dropdown field

harry24
Tera Contributor

Hello , 

 

I have hr case table extending task table , their is field called as contact type on task table , it is configured as dropdown with none . So when I create HR case from backend I want that by default it should populate the value as none , how to do this.

 

Thanks 

2 REPLIES 2

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello,

To ensure that the contact_type field in the HR case table is populated with the value "None" by default when creating an HR case from the backend, you can follow these steps:

  1. Update the HR Case Table Definition: Verify that the contact_type field is properly configured in the HR case table to have "None" as a valid option in its dropdown list.

  2. Set Default Value in the Dictionary Entry:

    • Navigate to the table definition for the HR Case table in your system.
    • Locate the contact_type field in the list of fields.
    • Edit the dictionary entry for this field.
    • Set the "Default Value" property of the contact_type field to None or the appropriate default value if it's a specific value representing "None" (such as an empty string or a particular value in your dropdown options).

Scripted Approach: If you are creating HR cases programmatically (e.g., through a script or backend logic), ensure that the default value is set in your script. Here's a sample script in a business rule or script include:

 
(function executeRule(current, previous /*null when async*/) { // Check if this is a new record if (current.isNewRecord()) { // Set the default value for contact_type field current.contact_type = 'None'; // or use the appropriate value representing "None" } })(current, previous);

This script should be added to a Business Rule that runs before the record is inserted or updated.

 

Regards,

Vaishnavi Lathkar

Bhavya11
Kilo Patron

Hi @harry24 ,

 

right click on field called as contact type check default value of that field if something is other remove it then you can see it will set as none

 

 

Thanks

BK