• stevejones
  • 0 Points
  • Member since 2009

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I create html component on home page where someoen put text in textbox and hit go buttton,case will be created.


Issue: It says invalid session Id. (So I used login method nad gave my username and password) but when it create case ,it define my name for owner of case. I need owner who is logged in.


How to get logged in user info in html home component.


Here is my code.


<script src="/soap/ajax/14.0/connection.js"></script> <script language="JavaScript" type="text/javascript"> function submitSearchForm(){ var searchField = document.getElementById('advsearchfield'); var result = sforce.connection.login("myname@xxx.com.test", "password"); var newCase = new sforce.SObject("Case"); newCase.Description =searchField.value; newCase.Status="Closed"; newCase.Origin="Hot Button"; newCase.Subject="General Inquiry"; result = sforce.connection.create([newCase]);if (result[0].getBoolean("success")) {alert("new account created with id " + result[0].id);} else {alert("failed to create account " + result[0]);}} </script> <form name="advsrch" method="post" onsubmit="return submitSearchForm();"><input class="searchTextBox" id="advsearchfield" maxlength="80" size="18" name="sbstr">&nbsp;<input class="btn" value=" Go! " type="submit"></form>



any suggestion?