Activity Forums Salesforce® Discussions How can I check if there is an Attachment on an Object from Visualforce page?

  • Naman

    Member
    April 14, 2016 at 7:48 am

    Use java scripting to query object with inner query for Attachment. Like below

    sforce.connection.sessionId = '{!$Api.Session_ID}';
    var str='';
    var results = sforce.connection.query("SELECT Id,guid__c, (SELECT Id, Name FROM Attachments) FROM Application__c where guid__c ='{!$CurrentPage.parameters.guid}' limit 1");
    var records1 = results.getArray("records");

    (or)

    you can query in your controller check if attachment is there on object record, if yes, you can set a boolean to true and use that on page.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos