Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #1 
We have a lovely library with a script call that accepts user names, or indeed role names, and an email subject & message, and sends the email. All good, nothing wrong.

Then we implement Single Sign On. All user names have the format 'domain\login'.

Of course, when the JScript is called, as it builds the string for the SQL, it has this backslash in it. I assume either it, or it and the following character are lost, unless by chance they happen to mean something in JSCriptese, in which case they are replaced.

How can I prevent this? And no, I am not going to edit all of the several hundred calls to this to make the "\" into "\\".

One possibility may be to call ework.Replace(ework.xyz,"\\","\\\\") but I do not in fact know what xyz is at the script call level. If I pass in the JScript variable, I presume it will do the same replacement.

Anyone found and fixed this?

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #2 
tried text.replace(/\\/g,"\\\\") but that seems to stuff up as the final " is taken as a literal ", not a closing one.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Nappy

Avatar / Picture

Guru
Registered:
Posts: 1,087
Reply with quote  #3 
Have you tried coding the \\ with String.fromCharCode(92) + String.fromCharCode(92)



__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.

PS that's for V6/7 for V9 the problem is V9 at the moment ;)
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #4 
I have done it now, thanks.

It seems not to have been the problem though. Now to find what the real problem was.....

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #5 
OK, it does not, it seems. Here goes:

Quote:
    var dbs ="\\\\";
    var regex = /,/g;

    sToRoleList = sToRoleList.replace(regex, "\',\'" );
    sToRoleList = sToRoleList.replace(/\\/g,dbs);


and then the string is built:
Quote:
... IN ('"+ sToRoleList + "') ...

which ends up when built as:
Quote:
IN ('<domain><login>')


BUT, when I do the same for the username of the user doing the deed, like so:
Quote:
    userName = userName.replace(regex, "\',\'" );
    userName = userName.replace(/\\/g,dbs);

...+ "', '" + userName + "', '" + ...


that comes through as:
Quote:
<domain>\\<login>

or
Quote:
<domain>\<login>

if I leave out the replacement.

Confused of Sydney......


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #6 
I see what it is now. The first value is passed as a 'literal' value. If I pass it as ework.xyz it comes through with two backslashes. The backslash has no effect at all in a variable, only in a literal string. I was getting the username from the ework. sink, so it did not lose a bs.

So I am forced to go through the lot and replace every single call involving a username (and in reality ANY TEXT AT ALL), and replace it with ework.<variable>.

How glad am I that I didn't give a fixed price quote for this one, eh?

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #7 
BTW, using ework.xyz is in our own best practice course, I am glad to say, but whoever wrote these obviously did not attend.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!