+ Start a Discussion

javascript button issue

Hi ,

I have an object Order(master) and it has a child  object Order Lines

I have a custom list Javascript button  on the Order Lines object ,"Create Purchase Order" which has a javascript code that validates the selected records and  redirects to the "New" page of another object "Purchase_order__c" with some values from the order prepopulated.


When i create the purchase order i need to have  some sort of summary of the order line records selected( a popup of selected records) that  the  user can view before going on to the new purchase order form.


How should i do this?

Can i use a visualforce page that displays the selected record details?

But how do i integrate this with my existing Javascript button just before the "new purchase order" form?

I dont want to have a visualforce new edit form.....

What is the easiest way to do this with the  existing code and validations?


Is there anyway in the button where i first redirect to the vf page ( which should appear as a popup)


Existing List button code:


var selectedRecords = {!GETRECORDIDS($ObjectType.Order_Line__c)};
if (selectedRecords[0] == null)
alert("Please select at least one Order Line.");
var SelectedIds='';
for(var i=0;i < selectedRecords.length; i++)
SelectedIds=SelectedIds.substring(0,SelectedIds.length - 1);
var sfQuery="Select Id,Name,sup__c from Order_line__c where ID in ("+SelectedIds+")";
var result=sforce.connection.query(sfQuery);
var bProcess= true;
var records = result.getArray("records");
for (var r = 0; r < records.length; r++)

var newRecords = [];
for (var n=0; n<selectedRecords.length; n++)
var c = new sforce.SObject("Order_line__c");
c.id = selectedRecords[n];
c.checked__c = 1;
result = sforce.connection.update(newRecords);


//Something here that will display the selected records details /////


window.location.href ="/a0I/e?retURL=%2Fa0I%2Fo"+
"&CF00NR0000000cvEt={!Sales_Order__c.Default_Warehouse__c}" +
"&CF00NR0000000cvEZ={!$User.FirstName } {!$User.LastName}"+
"&CF00NR0000000cvEK="+ records[0].sup__c+
"&CF00NR0000000cz5b="+ records[0].sup__c;
alert("Sorry ,You can create Purchase Orders from the same Supplier only!");






If I am not wrong, I had provide above Javascript solution to you for your previous threads,


Now your need is want to show some records , on some Pop-ups , before navigating to "New Purchase Order " form.


If you are comfortable with jQuery library,

we can show some cool pop-up to display selected records,

and then navigate to "New Purchase Order" page


Let me know,you can mail me at balasahebwani@gmail.com







Thank you Bala



I have sent you an email from my id :sabah@mvp.ae


Hi Bala, please help me with this