how can this script works

Confluence User - 09 Dec, 2016

hello

 

i have wrote this scritp, but when i apply at the joget validator(refund), it is not working

i tought that maybe have some problems in data load

 

can help me pls

 

import org.joget.apps.form.model.*;

 

 

var treatmenttype = form.hr_expense_claim_entry.getField("treatmenttype");

var amount = form.hr_expense_claim_entry.getField("amount");

var institutiontype = form.hr_expense_claim_entry.getField("institutiontype");

if("#treatmenttype#"="general")

 

{     if ("#institutiontype#"="public")

    

        { refund="#amount#"*1;}

    

    else

    

        { refund="#amount#"*0.75;}

 

else

    

    if("#amount#">=6000)

    

    {refund=6000;}

    

    else

    

    {refund="#amount#";}

 

}

 

 

scripts;datalists;workflow;userviews;forms;beanshell

2


10 Dec, 2016
confluenceUser
confluenceUser

The Joget Workflow Knowledge Base might help you here.

16 Dec, 2016
confluenceUser
confluenceUser

The code you wrote is not right. You will need to write in Java.

There's no such variable as #treatmenttype# or #amount#. You might be wanting to use Hash Variable. Check out the link Matthew posted earlier.

var treatmenttype = form.hr_expense_claim_entry.getField("treatmenttype");
var amount = form.hr_expense_claim_entry.getField("amount");
var institutiontype = form.hr_expense_claim_entry.getField("institutiontype");
if("#treatmenttype#"="general")
 
{     if ("#institutiontype#"="public")
    
        { refund="#amount#"*1;}
    
    else
    
        { refund="#amount#"*0.75;}
 
else
    
    if("#amount#">=6000)
    
    {refund=6000;}
    
    else
    
    {refund="#amount#";}
 
}

Good luck!

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print