Explain startsWith() function

Sid_Takali
Kilo Patron

Hi all, 

 I have a requirement to check a string field (compare with another field which is on another form)  and if it starts with certain word then execute a else if() block.  

function onLoad() {
   //Type appropriate comment here, and begin script below
   var value= g_form.getValue('initiated_from');
    if (value=='')
    {
        g_form.setValue('u_tracking_type',1);
    }

    else if(value.startsWith("CS")) // 
        {
            g_form.setValue('u_tracking_type',2);
        }
}

5 REPLIES 5


Hey,

Didn't hear back on this.

Is your issue resolved? If yes, feel free to mark helpful/correct, so it will be helpful for others looking for similar query.

Best Regards
Aman Kumar