Field update issue

Community Alums
Not applicable

I was having a record producer where the table is hr case there was a dropdown i.e. inquiry and it consist of 5 different choices where the each choice will map to 5 different hr service where all 5 hr service belong to different tables

so i was having a field called sub type where the field belongs to employee talent table.

so when the user submit the record producer the variable inquiry value has to set the value in field called sub type in employee talent table 

can anyone help me how to achieve this through record producer script

1 REPLY 1

Deepak Shaerma
Kilo Sage

Hello @Community Alums 
In the Script field of your Record Producer, write a script and change according to your requirement:

 

var inquiryValue = producer.inquiry;
var subtypeValue;
switch (inquiryValue) {
    case "sys_id_of_choice_1":
        subtypeValue = "Value for subtype based on choice 1";
        break;
    case "sys_id_of_choice_2":
        subtypeValue = "Value for subtype based on choice 2";
        break;
        // add other cases here
    default:
        // Handle unknown inquiry value if necessary
        subtypeValue = "default value or leave blank";
}

var empTalentGR = new GlideRecord('employee_talent_table'); //use correct table name
empTalentGR.addQuery('user', gs.getUserID());
if (empTalentGR.next()) {
    empTalentGR.sub_type = subtypeValue; 
    empTalentGR.update();
}

 


Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma