Is there a way i can get a currently logged in user in a custom button running on javascript?
I have custom button on where i am trying to update certain fields like activated by. Is there a way i can get in a currently logged in user in the javascript?
Thanks
UPDATE :
Code
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
var retVal = confirm("Are you sure?");
if(retVal)
{
var OrderObj = new sforce.SObject("Order__c");
OrderObj.id = '{! Order__c.Id}'; /* Need Id field to update Order*/
OrderObj.Status__c = 'Activated'; /* Change status */
OrderObj.Activated_By__c= {!User.Id};
/* update method takes an array of Orders; init to 1 element - 'OrderObj' */
var result = sforce.connection.update([OrderObj ]);
if (result[0].success == 'false') {
alert(result[0].errors.message);
}
else {
location.reload(true); /* redisplay the detail page */
}
}
Here is the error