Skip to content

Instantly share code, notes, and snippets.

@drwpow
Forked from nicksambrato/Send Options For Approval
Last active September 23, 2016 00:41
Show Gist options
  • Save drwpow/dcfc140e6679c4b7f93e4e39427cdaa0 to your computer and use it in GitHub Desktop.
Save drwpow/dcfc140e6679c4b7f93e4e39427cdaa0 to your computer and use it in GitHub Desktop.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var updateClientApproval = [];
var result = sforce.connection.query("SELECT Id, Create_Client_Approval__c FROM Order__c where Opportunity__c = '{!Opportunity__c.Id}' ");
var records = result.getArray("records");
var i = 0;
for (i; i < records.length ; i++) {
var child = result.records[i];
child.Create_Client_Approval__c = true;
updateClientApproval[] = child;
}
sforce.connection.update(updateClientApproval);
var CongaURL = "https://composer.congamerge.com" +
"?sessionId={!API.Session_ID}" +
"&serverUrl={!API.Partner_Server_URL_290}" +
"&id={!Opportunity__c.Id}" +
"&reportID=[Orders]00O50000004d8K1,[Account]00O50000004d8KB,[Contact]00O50000004d8Mv,[Approvals]00O50000004d9W8,[Fulfillments]00O50000004d9XQ,[Runs]00O50000004d4Rh" +
"&defaultpdf=1" +
"&templateID={!IF(CONTAINS( Opportunity__c.Convert_Payment_Terms_From_Picklist__c ,"Net"),"a0P50000006w30k","a0P50000006w31n")}" +
"&emailtemplateID={!IF(CONTAINS( Opportunity__c.Convert_Payment_Terms_From_Picklist__c ,"Net"),"a0G5000000D4jIM", "a0G5000000D4jIR")}" +
"&emailrelatedtoID={!Opportunity__c.Id}" +
"&emailtoID={!Opportunity__c.ContactId__c}" +
"&LG2=2" +
"&LG4=1" +
"&LG7=Followup+on+Ballpark+{!Opportunity__c.Account__c}+{!Opportunity__c.Name}" +
"&BML=Approval+Is+Being+Generated" +
"&ofn=Options+{!Opportunity__c.Name}" +
"&ds7=2" +
"&UF0=1" ;
window.open( CongaURL, "Conga", "width=700,height=550,menubar=0" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment