+ Start a Discussion
Yao LinYao Lin 

Display Alert on Master Object when a Specific Child Object is Created on Visualforce Page

Hi all,

I am not familiar with Visualforce page. Please help the following scenario: I need to display an alert on Sales Order when a Sales Orde Line with a specific item is created. Sales Order is a Master Object and Sales Order Line is a Detail Object. One Sales Order can have many Sales Order Lines. I tried the following code, but it didn't work. 
<apex:page standardController="PBSI__PBSI_Sales_Order__c">

PBSI__PBSI_Sales_Order_Line__c record =(PBSI__PBSI_Sales_Order_Line__c)stdController.getRecord(); 

 List<PBSI__PBSI_Sales_Order_Line__c> SOL = [SELECT Id, PBSI__Sales_Order__c, PBSI__Item__c FROM PBSI__PBSI_Sales_Order_Line__c WHERE (PBSI__Sales_Order__c = :record.PBSI__PBSI_Sales_Order__c.Id AND PBSI__Item__c ='a0Xi0000002EqKu'];

                alert('Display Alert!!');