1. Authentication Token - This is a string representing the Private Key encrypted Netsuite token. Token encryption is not discussed here.
2. User Email - the email address of the user being mapped
3. Pasword - the password of the user being mapped
4. NetSuite Account - the account number of the user being mapped to
5. Partner ID - the application partner ID provided during SSO Setup. This, most of the time, is the same as the NetSuite Account, unless otherwise specified on initial setup.
Steps:
1. Create a simple windows form with 5 text boxes to accomodate the five required fields mentioned above.
2. Add NetSuite WSDL to the project's Web Reference.
3. Create a button with the following script:
private void btnMapSso_Click(object sender, EventArgs e)
{
try
{
SsoCredentials sso = new SsoCredentials();
sso.authenticationToken = txtAuth.Text.ToString();
sso.email = txtEmail.Text.ToString();
sso.password = txtPassword.Text.ToString();
sso.partnerId = partnerID.Text.ToString();
sso.account = txtAccount.Text.ToString();
SessionResponse resp = _service.mapSso(sso);
string url = "https://system.netsuite.com/pages/partners/singlesignon.jsp?";
url += "a=" + txtAuthKey.Text.ToString();
url += "&pid=" + partnerID.Text.ToString();
url += "&pacct=" + txtAccount.Text.ToString();
if (resp.status.isSuccess)
{
lblResponse.Text = "Mapping is Successful";
System.Diagnostics.Process.Start(url);
}
else
lblResponse.Text = "Mapping Failed";
}
catch (Exception ex)
{
lblResponse.Text = ex.Message;
}
}
4. Run the application and enter the information required. Make sure that Authentication Token is valid.
5. If the mapping is successful, it will display "Mapping is Successful" otherwise, "Mapping Failed".
Here's the sample screenshot:
No comments:
Post a Comment