ariesmanlangit
Kilo Expert

Hi,



        I studied on how joinquery works, used it and found the answer. here's the code for reference of the others:



var detectReq = new GlideRecord('sc_request');


var detectReqItem = detectReq.addJoinQuery('sc_req_item');


detectReq.addQuery('requested_for',user);


detectReqItem.addCondition('cat_item',catalogSysID);


detectReq.query();


        if(detectReq.hasNext()){


                  errorMessage="Previous request detected. You cannot order this request again";


                  result='true';


        }


        else


                  result='false';



Thank you