• Renato Garofalo 13
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I have a query inside a trigger and one of the conditions is that a reference field (lookup) is not null. My query is:
List<Contract> contratti=[Select Id,Opportunitl__c from Contract 
        where Id IN: Trigger.new AND Opportunitl__c !=null ];

where Opportunitl__c is the reference field, but it's not working. The list "contratti" contains Contracts with an empty Opportunitl__c. What is wrong in this query?
I'm using a script and windows.open function to go to a specific URL when a user click a button on the VFpage. Something is going wrong because after the click the same page is reloaded.
SCRIPT:
<script type="text/javascript"> function goback() { window.open(retURL); } </script>


Inside the retURL variable, there is the URL where I want to go, something like:https://eu6.salesforce.com/0015800000DuQWsAAN'
button:
<apex:commandButton action="{!deleteContract}" value="Elimina Contratto e prodotti selezionati" immediate="true" onclick= "goback()" /> </apex:pageBlockButtons>


How can I solve this problem?