How to use autofil variable scripted to populate choice input field in mobile agent app?

zsquared
Tera Contributor

I am writing a script include and placing this into a variable to autofil an input field that is currently a choice field.

If the input field was a reference field, i would need my script include to return  a JSON object like the following:

 

var obj={ 

"Value": value,

"DisplayValue": displayValue

}

 

But I am trying to find out what object to return for a choice input field.  This is on the mobile agent app

2 REPLIES 2

Yashsvi
Kilo Sage

Hi @zsquared,

For a choice input field in the mobile agent app, your Script Include should return the value directly as a string

Script Include:

 

var ChoiceFieldHelper = Class.create();
ChoiceFieldHelper.prototype = {
    initialize: function() {},

    getChoiceValue: function() {
        var choiceValue = "your_choice_value"; // Replace with your logic
        return choiceValue;
    },

    type: 'ChoiceFieldHelper'
};

 

Usage in a Client Script:

var choiceValue = new ChoiceFieldHelper().getChoiceValue();
g_form.setValue('your_choice_field_name', choiceValue);

 

Replace "your_choice_value" and 'your_choice_field_name' with your specific logic and field name. This will set the choice field value appropriately in the mobile agent app.

Thank you, please make helpful if you accept the solution.

zsquared
Tera Contributor

This is what I thought but it does not work.

Also, I don't see a place where I can put client scripts in the mobile agent app