I am trying to runa query in a .js button to pull out an ID of a contact that is associated with a record so I can auto send an EchoSign document.
However I can not get this working, my googling skills have been made defective by this!
Basically I have a button that runs a URL and sends a document to EchoSign to be sent out, but it needs to be sent to the most recent contact that was sent an EchoSign document.
Example below:
var contactCheck = sforce.connection.query("SELECT echosign_dev1__Recipient__c
FROM echosign_dev1__SIGN_Agreement__c
WHERE echosign_dev1__Account__c = '{!Account.Id}'
AND echosign_dev1__Status__c = 'Signed'");
I'm still very new to .js so I am not 100% sure if I am doing things correctly, but I have seen the following 2 ways of pulling out just the ID and neither work:
var contactId = templateId.records[0].Id;
var contactId = contactCheck.records[i].get("Id"));
Can anyone help? This is stressing me out... I am going to turn prematurely grey at the age of 22