Has anyone ever called an ASP from a process map? My code is written in BasicScript but I'm having problems with the XMLHTTP object properties and methods not being recognized. My snippet of code that isn't working is as follows:
Set objXML = CreateObject("Microsoft.XMLDOM")
objXML.async = False
If objXML.Load(strASPLocation) Then
Set objNodeList = objXML.getElementsByTagName("USER")
msgbox "XML Load failed. Please ensure the following ASP page is valid:" & chr(13) & strASPURL
It fails on the objXML.asyc = False line as well as on the objXML.Load line and the objXML.getElementsByTagName line. Any ideas?
Yup, exactly. It's a very simple ASP that just connects to the WorklistShares table and retrieves the names of the users with access to the specified user's worklist. I've done this many times from forms using VBScript, I just can't get it to work from the process map using either BasicScript or JScript. Probably due to my inept scripting skills. I tried to get Tech Support to help but I got the old "this is outside the scope of support" line. Any help you could give me would be great!
Can I replace the .responseText with .getElementsByTagName("TAG")? I only want to retrieve a specific tag value from the ASP. I've tried putting that in but the value I get back is "undefined". Is .getElementsByTagName("TAG") a valid method in JScript?
Also, do you have a good web reference for JScript programming? I haven't found a good one. MSDN is only somewhat helpful. Thanks!
I believe you would have to first replace '.responseText' with '.responseXML' ( assuming that your ASP is returning some sort of XML doc ).
Afterwards you should be able to use the getElementsByTagName() method of the DOMDocument object. If not you can instantiate the DOMDocument obj, return the xmlDoc into it ie ( .responseXML.xml), then use the above said method to grab your Tag.
If you're just after the value of the Tag and not the entire XML doc then you could save yourself the overhead and just return that.
Sorry, been travelling a lot with work... Okay so, if I understand this correctly you just want the value held within a single xmldoc element.
If I may ask... Why are you returning an entire xmldoc just to retrieve the value of a single element? Seems like a lot of overhead to me; By creating a xmldom object, loading in the xmldoc and retrieving the value of a single element.
Why not just return the rs result thru the ASP using the Response.Write() method, then retrieve that from the ".responseText" as was previously illustrated.
If you need to use xml then I don't see why you can't retrieve the xml document by "srvXmlHttp.responseXML.xml" and load that result into a waiting xmldomdocument, then parse the element value.
Thanks again for your reply. A lot of the problem here is my lack of experience and programming knowledge with JScript and XML. I basically did what you describe and used the .responseText method and then parsed on the element value - that worked.
Next problem: would you happen to have a JScript function that sends an e-mail message to a list of users? I have one in BasicScript that I'm trying to convert but I'm having problems.
Should probably start a new forum for this as it would make it easier for others to find information. But, I don't see what you can't model it after the basic script sample, however instead you could pass in an array of usernames that will be receiving the email and loop thru each element grabbing the email address from the Users object.
If it's a list that doesn't really need to be that dynamic you could just build a string of fully qualified email addresses separated by ";" then pass that directly to the Email.To property.
I've tried basically what you described in your second option. However, in BasicScript the .To property doesn't seem to need a fully qualified e-mail address; that is, I just pass the User.DisplayName property. Is it different in JScript? Do I need to pass the e-mail address instead? And does the .To property accept a semi-colon delimited list?
In fact, if you have a look at the email samples in the documentation of WorkflowServer, you will be able to find a complete code sampel for sending emails like that. (With one exception, the sample calling statement has an error in it, suggesting you could use null value for variables that are not used (I think it was the BCC field), which will not work. Replace the null with an empty string (''), and you can use that function.)