+ Start a Discussion
Simon BairdSimon Baird 

URL No longer exists on Custom OnClick Javascript button

Hi all,

I am trying to add some text to a field by pulling it from its parent record using a Onclick Javascipt button. Getting the URL no longer exists on refresh. Note the button is a custom button called from a VF page use apex:commandbutton

var c = new sforce.SObject("Patient_Session__c"); 
c.id ="{!Patient_Session__c.Id}";
var pgn = "{!Patient__c.Patient_Progress_Note__c}";
c.Treatment_Notes__c = pgn;

window.location= '/{!Patient_Session__c.Id}';

you should use: window.location= '/' + {!Patient_Session__c.Id};