Set lookpup field value if another field have a especified value Through javascript funtion

0
36
Forum Post: Change the Filter On option on Opportunity Associated View for Account form


hi ! i need autocomplete a lookup type field in my form if another field have a especified value.

if field “Nivel 2 ” = Beneficios Externos

field “SLA” = 24 hs B2C

else ” SLA” = 48 hs B2C

this is my code:


// GET Lookup
function RetrieveSLAToCaseB2C(executionContext) {

     var formContext = executionContext.getFormContext();
     var nivel2 = formContext.getAttribute(“axnr1_nivel_2”).getValue()
// Access the field on the form
     var fieldValue = formContext.getAttribute(“slaid”).getValue();
// Verify it does exist on the form
     if (nivel2 != null) {
// To get the Id, Name and Entity Name (account/contact)
       if (nivel2 != “Beneficios Externos”) {
          formContext.getAttribute(fieldValue).setValue(“24 hs B2C”);
       }else{
          formContext.getAttribute(fieldValue).setValue(“48 hs B2C”);
            }
       }
}



Source link

Leave a reply

Please enter your comment!
Please enter your name here