How to check the value of List field in IF condition for getting related group approvals

Suzy
Tera Contributor

I have Functional area List field on form, FTM and DTS,ODG as values

if i select one value in Functional Area, approval should go for the related group.

for eg. If i select FTM, the approval should go to FTM Group approval only.

I have tried Switch but it is requesting approvals from all existed groups so now i am trying with IF Condition like as shown in the below image but it's not working. Please help me how to write the condition if in case need to write any script i have written below script its throwing error

 

answer = ifScript();

function ifScript() {
if (current.u_functional_area.indexOf('FTM')>-1) {
return 'yes';
}
return 'no';
}

find_real_file.png

 

 

Related Images:

find_real_file.png

 

 

find_real_file.png

1 ACCEPTED SOLUTION

Let's make double sure this array doesn't give trouble:

Use this(Added another toString() in the answer push):

var approvers = current.fieldName.toString();//Replace your field name
var answer = [];

if (approvers) {
    var approversArr = approvers.split(',');

    for (var i = 0; i < approversArr.length; i++) {
        answer.push(approversArr[i].toString());
    }
}

View solution in original post

29 REPLIES 29

Anirudh,

No its not related to any other table.

Functional Area field is created in Idea table and values are added through server script

please see the below screenshot, I have added List values in serverscript- Widget Editor

find_real_file.png 

 

ok, as the Functional Area field is not pointing to a table, the values are just choices... so its a choice field i guess. Could you tell what is the backend name of each of those choices...?

I'm suspecting the backend name has to be small caps(ftm, dts) ...

 

Bear with me, we are almost done here

You are one bearing with me...Thank you so much for that :):) 

 

the values have been added directly through serverscript to List field not through any choice table.

Based on Portfolio adding the values to Funactional ARea List field.

 

find_real_file.png

Suzy
Tera Contributor

and one more thing, The portfolio values also added through html script from Widget Editor

 

No, try and check the choices from the form. See below

Right click on the Functional Area field -> select Configure dictionary -> Scroll down to Choices related list 

 

find_real_file.png

 

If this is urgent feel free to contact me

Contact : 

9900177730