Location populated form level in request form view but list view unable to see location field

ashok17
Tera Contributor

Hi All,

Location populated form level in request form view using client script but list view unable to see location field, it's showing empty in the list view.

 

Please suggest for this issue.

 

Thanks,

1 ACCEPTED SOLUTION

Hi @ashok17 Ideally it should not behave like this. Try below code and see if it works

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue == '' || newValue == null) {
        g_form.setValue('location', '');
        return;
    }

    if (!g_form.hasField('location'))
        return;

    var caller = g_form.getReference('requested_for', setLocation);
}

function setLocation(requested_for) {
    if (requested_for) {
        g_form.setValue('location', requested_for.location);
        g_form.setMandatory('location', true);
        
        // Intentionally saving the form after setting the location
        g_form.save();
    }
}

View solution in original post

3 REPLIES 3

Sid_Takali
Kilo Patron

Hi @ashok17 can you share the client script you tried? 

Below is the on change client script:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

   if (newValue == '' || newValue == null) {
        g_form.setValue('location', '');

        return;
    }
    if (!g_form.hasField('location'))
        return;
    var caller = g_form.getReference('requested_for', setLocation);
}

function setLocation(requested_for) {
    if (requested_for)
        g_form.setValue('location', requested_for.location);
    g_form.setMandatory('location', true);
    //g_form.setReadOnly('location', true);
}

Hi @ashok17 Ideally it should not behave like this. Try below code and see if it works

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue == '' || newValue == null) {
        g_form.setValue('location', '');
        return;
    }

    if (!g_form.hasField('location'))
        return;

    var caller = g_form.getReference('requested_for', setLocation);
}

function setLocation(requested_for) {
    if (requested_for) {
        g_form.setValue('location', requested_for.location);
        g_form.setMandatory('location', true);
        
        // Intentionally saving the form after setting the location
        g_form.save();
    }
}