Hi there,
i am trying to do an @dbLookup in the client-side code to get the email address of the person its going to assign the reqest to and pop-up an email window (seems silly this, I know…dont ask!
)
Here is my code :
var territory = XSP.getElementById(“#{id:territory}”);
var category = XSP.getElementById(“#{id:category}”);
var priority = XSP.getElementById(“#{id:priority}”);
var detail = XSP.getElementById(“#{id:requestdetail}”);
var pumpmod = XSP.getElementById(“#{id:pumpmod}”);
var jobval = XSP.getElementById(“#{id:jobval}”);
var oem = XSP.getElementById(“#{id:oem}”);
if(territory.value == “”)
{
alert(“Please select a Territory.”);
return false;
}
if(category.value == “”)
{
alert(“Please select a Category.”);
return false;
}
if(oem.value == “”)
{
alert(“Please enter the OEM/Ship From.”);
return false;
}
if(priority.value == “”)
{
alert(“Please select a Priority.”);
return false;
}
if(detail.value == “”)
{
alert(“Please enter the Request Details.”);
return false;
}
if(pumpmod.value == “”)
{
alert(“Please enter the Pump Model.”);
return false;
}
if(jobval.value == “”)
{
alert(“Please enter the Job Value.”);
return false;
}
// Test Mail script :
var answer = confirm (“Would you like to send attachments now?”)
if (answer){
var daReferrer = document.referrer;
/*@cc_on
@*/
var hcat = @DbLookup(@DbName(), "(LUCat)", category.value, 2);
alert(hcat);
var key = hcat + "~" + territory.value + "~" + oem.value;
alert (key);
//var email = "yours@email.com";
var email = @DbLookup(@DbName(), "(LURule)", key, 3);
@*/
var errorMsg = "here here here is the error error error error";
var subject = "File attachments for SWRS Request :";
var body_message = "%0D%0D%0D%0DThank you "+name+" for submitting this error to us. Please tell us in the space above, what you were doing when the error occurred.%0D%0DReferring Page: "+daReferrer+" %0D%0DException Error Message:%0D-------------------------------------------%0D"+errorMsg;
var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message;
win = window.open(mailto_link,'emailWindow');
if (win && win.open &&!win.closed) win.close();
}else{
alert (“If you wish to send files later, please follow the instructions in the email sent to you.”)
}
Its not dealing with the @ commands very well. It is giving me the error :
‘Function Expected’
grr!
Anyone help me ?
Much appreciated.
Jamie