Prepopulate a Text On Description Field Based Choice field value selection

APV Babu
Tera Contributor

I have one requirement, I need to Display multiple text sentences based on choice field value selection, How can I achieve this requirement

 

!!Thanks in advance.

 

 

 

Regards,

APV Babu

1 ACCEPTED SOLUTION

Hi @APV Babu ,

 

Please find the below code . You need to create an onChange client script

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

  var taskTemplateName = g_form.getValue('task_template_name');

  var descriptionField = 'description'; // Change this to the correct field name

  switch (taskTemplateName) {

    case 'Plan Direction':

      g_form.setValue(descriptionField, 'Plan direction/approval of the proposed correction method in writing');

      break;

    case 'Population':

      g_form.setValue(descriptionField, 'Population and additional data points necessary for executing the correction.');

      break;

    case 'Responsible Party':

      g_form.setValue(descriptionField, 'Confirmation from the group responsible for the correction in writing');

      break;

    case 'Funding':

      g_form.setValue(descriptionField, 'Location of the funding for the correction');

      break;

    case 'Spreadsheet':

      g_form.setValue(descriptionField, 'The Adjustment Consultant Spreadsheet that captures the correction process in writing.');

      break;

    case 'Additional Info':

      g_form.setValue(descriptionField, 'Additional information is needed in order to process the requested correction.');

      break;

    default:

      g_form.setValue(descriptionField, ''); // Clear the description if no match is found

  }

}
}

 

Thanks,

Danish

 

View solution in original post

6 REPLIES 6

Danish Bhairag2
Tera Sage
Tera Sage

Hi @APV Babu ,

 

Can u provide a scenario please like if choice field value is something then description should be something

 

Thanks,

Danish

 

 

 

@Danish Bhairag2 , @Samaksh Wani 

 

I need to populate below "Description" text in Description field when Task Template Name field value changes

 

 

1.Task Template Name: Plan Direction
  Description: Plan direction/approval of the proposed correction method in writing
  2. Task Template Name: Population
  Description: Population and additional data points necessary for executing the correction.
  3. Task Template Name: Responsible Party
  Description: Confirmation from the group responsible for the correction in writing
  4. Task Name: Funding
  Description: Location of the funding for the correction
  5. Task Template Name: Spreadsheet
  Description: The Adjustment Consultant Spreadsheet that captures the correction process in writing.
  6. T ask Template Name: Additional Info
  Description:  Additional information is needed in order to process the requested correction.

Hi @APV Babu ,

 

Please find the below code . You need to create an onChange client script

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

  var taskTemplateName = g_form.getValue('task_template_name');

  var descriptionField = 'description'; // Change this to the correct field name

  switch (taskTemplateName) {

    case 'Plan Direction':

      g_form.setValue(descriptionField, 'Plan direction/approval of the proposed correction method in writing');

      break;

    case 'Population':

      g_form.setValue(descriptionField, 'Population and additional data points necessary for executing the correction.');

      break;

    case 'Responsible Party':

      g_form.setValue(descriptionField, 'Confirmation from the group responsible for the correction in writing');

      break;

    case 'Funding':

      g_form.setValue(descriptionField, 'Location of the funding for the correction');

      break;

    case 'Spreadsheet':

      g_form.setValue(descriptionField, 'The Adjustment Consultant Spreadsheet that captures the correction process in writing.');

      break;

    case 'Additional Info':

      g_form.setValue(descriptionField, 'Additional information is needed in order to process the requested correction.');

      break;

    default:

      g_form.setValue(descriptionField, ''); // Clear the description if no match is found

  }

}
}

 

Thanks,

Danish

 

Thanks!!!  It's Working😊