Loading...
 
ESA > Join & Share > Forums > SSE Forum > How to access userId information in the Order page with JavaScript

SSE Forum

Help

Show posts:
Jump to forum:

How to access userId information in the Order page with JavaScript

Hi,
I need to access the userId value during the order operation to use it in a JS function. How could I retrieve this information? Is there a function or a hidden input where I can get the user id from the order page?

Thanks and regards


Re: How to access userId information in the Order page with JavaScript

Hello Marco,
This feature is being tested on SSE Test portal and should be made available in the next couple of weeks. It will be possible to access, in the service stylesheet, to the following user information:

userId
firstName
lastName
invoiceAddress
postCode
city
state
country
emailAddress
telNumber (if provided by user)
faxNumber (if provided by user)

Regards,
Ivo.



Re: How to access userId information in the Order page with JavaScript

Hello Marco.

This feature will not be implemented for now but will be added to a list of possible future enhancements, to be planned.

Paulo



Re: How to access userId information in the Order page with JavaScript

Hi Marco.

I confirm that this is not possible to do on the current version of the SSE. The documented feature I mentioned earlier works completely server-side and what you need (Javascript) is client-side. We are considering whether to implement something to help you specifically for the userId, by including a hidden HTML field, although ideally all public user profile fields should be accessible.

We cannot promise anything at this time though.

Paulo



Re: How to access userId information in the Order page with JavaScript

Because in the same service there is a drop down list that be must dynamically filled. The list contents depend on userId.

Regards



Re: How to access userId information in the Order page with JavaScript

Thanks Marco,

just an additional clarification:
why not having two (or more) services (maybe both restricted access) instead of one with multiple interfaces?

Ale



Re: How to access userId information in the Order page with JavaScript

Hi,
I admit that this solution is not clean, but is useful for our purposes.

Purpose:
In order to customize the order interface, I created an AJAX request to an external server.
The retrieved informations depend from userId. So I need the retrieve the userId in some JS function.

This is an example.

Regards



Re: How to access userId information in the Order page with JavaScript

Hi Marco,

just one question,

can you tell us why do you need the userId in that pagequestion

Thanks
Alessandro



Re: How to access userId information in the Order page with JavaScript

That's a dirty trick, but it does work in most cases biggrin

I am waiting for more information on a cleaner solution.

Paulo



Re: How to access userId information in the Order page with JavaScript

I create this JS function:

function getUserId()
{
	if(document.getElementsByTagName)
	{
		var found = 0;
		var lista_a = document.getElementsByTagName("a");
		for(i=0; isLessThanNumber(i,lista_a.length); i++)
		{
			var text   = lista_a[i].innerHTML;
			var tmp    = new String( text.match(/\(\w*\)/g) );
			var userId = new String( tmp.replace(/\(|\)/gi, "") );

			if ( userId != "null" )
				if ( userId.length != 0 )
					return userId;
		}
		alert("You are not logged in.");
		return null;
	}
	else
	{
		alert("getElementsByTagName unaviable");
	}
}

It works using the login information at the upper right of the page: My Profile (userId)



Re: How to access userId information in the Order page with JavaScript

Hi Marco,

I suppose that you need this to perform some validation or implement user-specific behavior. At first glance, I don't think that you can use this information on a Javascript function but I will investigate further.

Maybe you are aware that you can access several user profile fields (including the userId) at the stylesheet level, as per the ICD, section 4.4.2.2, pages 61 and 62. This works when your goal is to include the value(s) in your service's RFQ/Order XML input message, for example. All you need is to add the corresponding XSLT statement at the proper place in your XSL. However, I made a simple test to access it inside a javascript block and the result is empty, so apparently this is not possible.

I'll keep you informed.

Paulo



Show posts:
Jump to forum: