0

I am kinda new person in JavaScript, please help me our here with small doubt

What I am missing here ........ I want to correct this one....

I am trying this :

if( {!Account.CID__c}){
    window.open( '{! SUBSTITUTE($Setup.CustomSetting__c.Link__c,"[#CID#]",Account.AnotherField__C)}');
}
else{
 window.open( '{! SUBSTITUTE($Setup.CustomSetting__c.Link__c,"[#CID#]",Account.CID__c )}')
}

GOT ERROR "Unexpected Token )"

Earlier I was having

window.open( '{!SUBSTITUTE($Setup.CustomSettings__c.Link__c,"[#CID#]",Account.CID__c)}');

And I just want to add one more Condition here i.e.

If(CID__C == null){
  // put another AnotherField__C in place of that.
}else{ 
   //put Account.CID__C ...which we were having earlier 
}

https://stackoverflow.com/questions/33396999/onclick-javascript-button

1 Answer 1

1

Change your script to this:

if( '{!Account.CID__c}' == 'null' || '{!Account.CID__c}' == ''){
    window.open( '{! SUBSTITUTE($Setup.CustomSetting__c.Link__c,"[#CID#]",Account.AnotherField__C)}');
}
else {
    window.open( '{! SUBSTITUTE($Setup.CustomSetting__c.Link__c,"[#CID#]",Account.CID__c )}')
}

You must log in to answer this question.

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