I have written a jQuery in Static Resource to hide the below highlighted "Revise Opportunity" button and its working perfect.

But i am unable to hide the "Inflight Note" Text field. Can anyone help/ suggest, how do i do that.

Below is the query which i have used to hide the "Revise Opportunity" button: enter image description here

var j$ = jQuery.noConflict();
j$(document).ready(function() {

var opp=window.location.href.substring( window.location.href.indexOf('.com/') + 5, window.location.href.indexOf('.com/') + 8 );

    var inFlightValidationFlag="true";
    var OppId = window.location.href.toString().split('.com/');

    var OdrObjList= sforce.connection.query("Select Is_Order_Submitted__c,Status__c from Order__c where Opportunity__c='" + OppId[1] + "'");
        var arrayOdrObjList = OdrObjList.getArray("records");

    if((!arrayOdrObjList[0].Is_Order_Submitted__c || arrayOdrObjList[0].Status__c=='Failed' inFlightValidationFlag=="true"){

        //here i want to write the code to hide the "Inflight Note" Text field.

1 Answer 1


I'm not a JS expert, but something seems wrong on this condition (probably missing a && or ||, and one "(" not being closed)

if((!**arrayOdrObjList[0].Is_Order_Submitted__c || arrayOdrObjList[0].Status__c=='Failed' inFlightValidationFlag=="true"**){

By the way, why don't you use record type and layout to hide button and/or fields ? It should be really easier, and much more safer!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .