-1

when i select the records in vf page ,after click on the VF Button the conga should be call along with id for generating the PDF but on button click the window is opening but showing error that "ID Parameter is missing" ? how to over come the issue? your reply will be appricated ,please reply asap.

vfpage:

<apex:commandButton value="Generate Invoice" action="{!GenerateInvoice}"  onclick="openConga(setOfIds)" reRender="table1"/>

<script>
function openConga(setOfIds){
  if(setOfIds !=Null){
  var Formastring=setOfIds.splits(',');
  var joinIds=Formastring.join("'|'");
  var removeSpace=joinIds.replace(" ","");
  var removeLeft=removeSpace.replace("[","");
  var removeRight=removeLeft.replace("]","");
  var finalSetIds=removeRight;
   var CongaUrl ="/apex/APXTConga4__Conga_Composer?sessionId={!$API.Session_ID}"
+"&serverUrl={!$API.Partner_Server_URL_290}&Id={!Payment_Id}"
+"&QVar1Id=[sql1221]a186C0000007yB3?pv1="
+ finalSetIds
+"&TemplateId={QVar1}";
 window.open(CongaUrl, "Conga","menubar=no,height=600,width=800");

  }
}
</script>

controller:

[‎28-‎01-‎2019 12:13]  Sakhare, Ankita:  
public PageReference GenerateInvoice() {
    selectedEsr = new List < Payment__c > ();
    for (wrappayment wp: paymentList) {
        if (wp.selected == true) {
            Payment_Id = wp.pay.id;

        }
    }

    return null;
}
1

1 Answer 1

1

You should call the JavaScript method from onComplete instead of onclick. Because before your action complete his exceution you JS method get called with blank Id parameter

<apex:commandButton value="Generate Invoice" action="{!GenerateInvoice}"  oncomplete="openConga(setOfIds, '{!Payment_Id}')" reRender="table1"/>

Also, I suggest you pass the ID in parameters as if you are not rerendering that section you will still get the same exception.

7
  • Thanks for your reply@tushar Sharma but this logic is not working,please give me idea any other way ?
    – HKV
    Commented Jan 28, 2019 at 7:13
  • @hari Payment_Id you might not be getting value in this. Check if you are getting correct value here. Commented Jan 28, 2019 at 7:17
  • SharmaI have checked in the controller payement_Id is getting there
    – HKV
    Commented Jan 28, 2019 at 7:21
  • ,I have tried another way also, The conga page is getting there,But Facing error Parameter Id missing Like :<Script Language="JavaScript"> function openConga() { window.open('{!URLFOR($Action.Payment__c.Generate_PDF, Payment_Id)}', '','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes, toolbar=no,location=yes,status=yes'); </Script>
    – HKV
    Commented Jan 28, 2019 at 7:22
  • Button :Button:<apex:commandButton value="Generate Invoice" action="{!GenerateInvoice}" onclick="openConga()" reRender="table1"/>
    – HKV
    Commented Jan 28, 2019 at 7:25

You must log in to answer this question.

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