2

I have never created a Java Script button before but I tried to create a List View button on our Invoice Object. Use Case: select multiple invoices and run Conga Composer button to view what invoices with invoice lines would look like when selected invoices are consolidated.

Here is my current button:

var ids= {!GETRECORDIDS ($ObjectType.SCMC__Invoicing__c)}; 
var idsReport=ids.join("|"); 
var idsQuery=ids.join("'|'");

var CongaURL = "https://composer.congamerge.com" +
"?sessionId={!$Api.Session_ID}" + 
"&ServerUrl={!$Api.Partner_Server_URL_80}" + 
"&Id={!$User.X18_digit_User_ID__c}" + 
"&QueryId=aAQ5B0000008a34?pv0=" + idsQuery +
"&TemplateId=aAY5B0000004P7Z";
window.open( CongaURL, "Conga", "width=700,height=550,menubar=0" );

The error I am getting when I select 2 invoices and run the button:

SCMC__Invoicing__r.Id = 'a6E5B0000008t41','a6E5B0000008t4A' LIMIT 25000 ^ ERROR at Row:1:Column:1010 unexpected token: ','

1
  • Please refrain from asking for help in your posts, specially in the title as it is not representative of your issue. Thanks
    – glls
    Nov 30, 2017 at 14:46

1 Answer 1

1

The error stems from the fact that multiple values in a query should normally be written with "IN":

SCMC__Invoicing__r.Id IN ('a6E5B0000008t41','a6E5B0000008t4A')

It seems that you have unbalanced quotes, which may be throwing the entire thing off:

var idsQuery=ids.join("'|'");

Ends up creating a string like:

a6E5B0000008t41'|'a6E5B0000008t4A

While I suspect it probably needs to be quoted properly:

'a6E5B0000008t41'|'a6E5B0000008t4A'

In which case, you need to add some quotes in to your code:

var idsQuery="'"+ids.join("'|'")+"'";

A variant of this is mentioned in their online help topic here:

var ids= {!GETRECORDIDS( $ObjectType.OpportunityLineItem )};
var idsReport=ids.join("|");
var idsQuery=ids.join("'|'");
var CongaURL = "https://composer.congamerge.com" +
"?sessionId={!$Api.Session_ID}" +
"&ServerUrl={!$Api.Partner_Server_URL_80}" +
"&Id={!Opportunity.Id}" + 
"&ReportId=00OE0000000P57r?pv0=" + idsReport +
"&QueryId=a03o000000JuspY?pv0='" + idsQuery +"'";
window.open( CongaURL, "Conga", "width=700,height=550,menubar=0" );

They put the quotes in the URL part (pv0='" + idsQuery +"'"), and you probably accidentally overlooked them.

1
  • Thank you for your response. Here is the button now, still getting an error:WHERE SCMC__Invoicing__r.Id ='''a6E5B0000008t44','a6E5B0000008t4C'''ERROR at Row:1:Column:995 unexpected token: 'a6E5B0000008t44' {!GETRECORDIDS($ObjectType.SCMC__Invoicing__c)}; var idsQuery="'"+ids.join("'|'")+"'"; var CongaURL ="composer.congamerge.com"+ "?sessionId={!$Api.Session_ID}"+ "&ServerUrl={!$Api.Partner_Server_URL_80}"+ "&Id={!$User.X18_digit_User_ID__c}" + "&QueryId=aAQ5B0000008a34?pv0='" + idsQuery +"'"; "&TemplateId=aAY5B0000004P7Z"; Dec 6, 2017 at 2:53

You must log in to answer this question.

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