Skip to main content

Hello Everyone,

I have got a requirement for the request screen . The Requirement is When request status is completed --> sub status should only allow approved and other requirement is When request status is approved --> it should only allow billed.

so for the above requirement i tried to write the client script but while running client script I am facing an error so i am going to paste my client script code and error image below

 

Client script code:

showProgressIndicator();
var reqStatus1 = getControlValue('request','REQ_STATUS');

var emptyOptions = t];
var options = createCodeTableOption('','');
arrayPush(emptyOptions, options);
setControlOptions('request', 'req_category', emptyOptions);

if(reqStatus1 == 'COMPLETE') 
{
    var opt1 =  ];
    arrayPush(opt1, createCodeTableOption('APPROVED','Approved'));
    setControlOptions('request', 'req_category', opt1);
} 
else 
{
    var opt2 = <];
    arrayPush(opt2, createCodeTableOption('BILLED','Billed'));
    setControlOptions('request', 'req_category', opt2);
}
hideProgressIndicator();

 

Hi @Shashank ,

As per my understanding, the editor in the client script screen will allow specific set of functions to be executed. 

 

Client script editor

In this scenario, the function in line 1 will be throwing the error since it is not executable in the client script editor but the function in the line 2 will be executed (you can comment each line and observe the behavior). 

Try to add this script to a screen in web client and observe the behavior. Following thread explains the process in a detailed manner.

 


Hope this answer helps.

Best Regards,
Atheeq