• Sravana Sudheer
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 18
    Replies
Hello Friends

I am trying to show Lightning component on VF page. I am basically showing custom object list view along with a pop up box in my lightning component. When i am trying to refer the same component on VF page the Pop up and list view are rendering same as in Lightning but when i am trying to click on record ( h ref value is showing void (0)). Can anyone help me with the VF page $Lightning.createComponent method construction. My component and vf page are as shown below
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,lightning:actionOverride" access="global" >
   
    <aura:attribute name="recordId" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.openModal}"/>
    
    <lightning:listView aura:id="listViewcps"
    objectApiName="ABC"
    listName="All"
    rows="80"
    showSearchBar="true"
    showActionBar="true"
    enableInlineEdit="true"
    showRowLevelActions="true"/>
   
    

    
    <aura:attribute name="isOpen" type="boolean" default="false"/>
    <div class="slds-m-around_xx-large">
     
   
        <aura:if isTrue="{!v.isOpen}">
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
               <div class="slds-modal__container">
                    <header class="slds-modal__header">
                        <lightning:buttonIcon iconName="utility:close"
                                              onclick="{! c.closeModel }"
                                              alternativeText="close"
                                              variant="bare-inverse"
                                              class="slds-modal__close"/>
                       <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">CP MODAL DIALOG</h2>
</header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <p><b> 
                              TEST alert content

                            </b>
                        </p>
                    </div>

                  
                    <footer class="slds-modal__footer">
                        <lightning:button variant="neutral" 
                                          label="Cancel"
                                          title="Cancel"
                                          onclick="{! c.closeModel }"/>
                        <lightning:button variant="brand" 
                                          label="Like and Close"
                                          title="Like and Close"
                                          onclick="{! c.likenClose }"/>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
          
            
        </aura:if>
    </div>
</aura:component>


JS controller:

({
   doInit: function(component, event, helper) {
     
       var recordId = component.get("v.recordId").Id;
       debugger;
       sforce.one.navigateToSObject(component.get("v.recordId").Id);
       console.log('record id is '+recordId);
    },
    
    
    openModal: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"
      component.set("v.isOpen", true);
   },
 
   closeModel: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpen", false);
   },
 
   likenClose: function(component, event, helper) {
      // Display alert message on the click on the "Like and Close" button from Model Footer 
      // and set set the "isOpen" attribute to "False for close the model Box.
      //alert('thanks for like Us :)');
      component.set("v.isOpen", false);
   },
})



VF page:

<apex:page showHeader="True" sidebar="false">

<div id="lightning"/>
<apex:includeLightning />
<script>
       var recordId= "https://login.salesforce.com/a00/o";
        
//Need help with this        
$Lightning.use("c:Cpligapp", function() {
          $Lightning.createComponent("c:CPlistview",
           
              {  }

           ,
          "lightning",
          function(cmp) {
          

          });
        });
    </script>

</apex:page>
User-added image
 
Hello friends

I created new picklist field on activities and trying to refer that on task kanban. But for some reason i am not able to see that picklist as an option for group by field section. i checked permissions of that custom field and it is visible for me as well as for some other profiles in the system. Any help would be hugely appreciated.
Thank you!
Hi All,

When i am trying to convert Vf page as word document i am getting blank space on the first page between header and start text as well as receving blanlk last page as attached. Any help would be greatly This blank space is coming right after header in first page before document is getting startedThis is blank last page
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<style>


            @page Section1{
                 size:9.0in 11in;
                 mso-page-orientation:landscape;
                 margin:0.5in 0.5in 0.5in 0.5in;
                 mso-header-margin:0.52in;
                 mso-footer-margin:0.5in;
                 mso-header: h1;
                 mso-footer: f1;
                 mso-paper-source:0;
            }
            div.Section1{
             page:Section1;
            }
            table#hrdftrtbl{
                margin:0in 0in 0in 15in;

            }
            p.MyFoot, li.MyFoot, div.MyFoot
            {
                mso-pagination:widow-orphan;
                tab-stops:center 100.0pt right 250.0pt;
                margin:0in;
                margin-top:.0001pt;
                margin-bottom:.0001pt;

            }
            p.MsoHeader,li.MsoHeader,div.MsoHeader
            {
             margin:-8in;
             margin-top:0.1pt;
             mso-pagination:widow-orphan;
             tab-stops:center 3.0in right 6.0in;
            }

            body 
            {
                font-family:DINPro-Light, Verdana, Arial;
                font-size: 11px;        
            }
            th, td 
            {
                padding: 2px;
                border: 1px solid Black;
                width: 40%;

            }
            th.sechead
            {
                text-align: center;
                col-span:1;
                white-space: nowrap;
            }
            table.fixed {border: 1px solid Black; table-layout:fixed;width: 100%;}



            div.breakPageAfter
            {
              page-break-after:always !important;
              page-break-inside:avoid !important;
              overflow:hidden !important;
            }

        </style>
</head>

<apex:repeat value="{!oplist}" var="op"> 
     <div class="breakPageAfter">
            <h1 style="color:Red;font-size: 140%;">
                       {!op.Account.name}({!op.name}) 
            </h1>

                <div class="column" overflow="hidden" >
                    <div class="Row">
                        <table class="fixed" border="none" >
                             <!--<tr>
                                  <th> Account Name</th>
                                  <td>{!op.Account.name}({!op.name})</td>
                             </tr>-->
                             <tr> 
                                  <th> Submitted By: </th>
                                  <td>{!op.owner.name}</td>
                             </tr>
                             <tr> 
                                  <th> Owner Title </th>
                                  <td>{!op.owner.title}</td>
                             </tr>
                             <tr>
                                  <th> Region</th>
                                  <td>{!op.Primary_Region__r.name}
                                  </td>
                             </tr>
                             <tr> 
                                  <th> Report Date </th>
                                  <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!TODAY()}" /> </apex:outputText>
                                  </td>
                             </tr>
                         </table>
                    </div>&nbsp;

                    <div class="Row">
                     <table class="fixed" border="none">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="1" Style ="color:rgb(255, 255, 255);">Document Objective</th>
                             </tr>
                             <td><p><b>The purpose of this plan is to document information about the account 
                                in a single document and to identify opportunities for a long-term relationship 
                                with the client that will bring in continuous sales opportunities.</b></p>
                             </td>
                     </table>
                    </div><br/><br/><br clear="all" style="page-break-inside:avoid;" />
                    <div class="Row">
                      <table class="fixed" border="1">
                        <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="2" Style ="color:rgb(255, 255, 255);">Account Background</th>
                        </tr>
                        <tr>
                           <th> Annual Spend</th>
                           <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Est_Client_Spend__c}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                           <th> Revenue </th>
                           <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Amount}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                           <th> Fee </th>
                           <td><apex:outputText value="{0,number,0}%"> <apex:param value="{!op.Est_MSP_fee__c}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                            <th> Partner Providers </th>
                           <!--<td><apex:outputText value="{0,number,0}%"> <apex:param value="{!op.Est_MSP_fee__c}" /></apex:outputText>
                           </td>-->
                        </tr>
                      </table>          
                    </div><br/>
                    <div class="Row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="1" Style ="color:rgb(255, 255, 255);">Client Company Overview</th>
                             </tr>
                             <td><p><b>{!op.Account.Description}</b></p>
                             </td>
                        </table>
                    </div><br/><br/>
                </div>
                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1" cellspacing="0" cellpadding="0" 
                           style='border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;'>
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="2" Style ="color:rgb(255, 255, 255);">Opportunity Details</th>
                            </tr>
                            <tr>
                                  <th>Client Relationship Background</th>
                                  <td>{!op.Brief_Description_of_the_Opportunity__c}</td>
                            </tr>
                            <tr>
                                  <th>Client Business Objectives and Initiatives</th>
                                  <td>{!op.Client_Expected_Outcomes__c} </td>
                             </tr>     

                            <tr>
                                  <th>Problem Statement</th>
                                  <td>{!op.Customer_Pain_Points__c}</td>
                            </tr>
                            <tr>
                                  <th>Actions Taken</th>
                                  <td></td>
                            </tr>
                            <tr>
                                  <th>Next Steps</th>
                                  <td>{!op.NextStep}</td>
                            </tr>
                            <tr>
                                  <th>Type</th>
                                  <td>{!op.Type}</td>
                            </tr>
                            <tr>
                                  <th>Time Frame</th>
                                  <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!op.createddate}"/> 
                                        </apex:outputText>&nbsp;-&nbsp;<apex:outputText value="{0,date,MM/dd/yyyy}"><apex:param value="{!op.Expected_Go_Live_Date__c }"/></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Revenue </th>
                                   <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.ExpectedRevenue}" /></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Gross Profit($) </th>
                                   <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Gross_Profit__c}" /></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Probability </th>
                                   <td><apex:outputText value="{0,Number,0}%"> <apex:param value="{!op.Probability}" /></apex:outputText>
                                  </td>
                           </tr>
                            </table>
                    </div>
                </div><br/><br/>
                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">Client Contact List/Org Chart</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Phone</th>
                                  <th>Email</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityContactRoles}" var="ct">
                            <tr>
                                  <td>{!ct.contact.name}</td>
                                  <td>{!ct.contact.Title}</td>
                                  <td>{!ct.contact.Phone}</td>
                                  <td>{!ct.contact.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                </div><br/><br/>

                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">Internal Account Team</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Level Of Relationship</th>
                                  <th>Company</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityTeamMembers}" var="optm">
                            <tr>
                                  <td>{!optm.user.name}</td>
                                  <td>{!optm.user.Title}</td>
                                  <td>{!optm.TeamMemberRole}</td>
                                  <td>{!optm.user.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                </div><br/><br/>

                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">OpCo Relationships</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Phone</th>
                                  <th>Email</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityContactRoles}" var="opct">
                            <tr>
                                  <td>{!opct.contact.name}</td>
                                  <td>{!opct.contact.Title}</td>
                                  <td>{!opct.contact.Phone}</td>
                                  <td>{!opct.contact.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                    </div><br/><br/>          

                    <div class="column" overflow="hidden" >
                        <div class="row">
                          <table class="fixed" border="1">
                             <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="1" Style ="color:rgb(255, 255, 255);">Risk Points</th>
                             </tr>
                             <td>{!op.Strategic_Risk__c}</td>
                          </table>
                        </div>
                    </div><br/><br/>

                    <div class="column" overflow="hidden">
                        <div class="row">
                          <table class="fixed" border="1">
                             <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="1" Style ="color:rgb(255, 255, 255);">Action Plan (Next Steps)</th>
                             </tr>
                             <td>{!op.NextStep}</td>
                          </table>

                        </div>
                    </div>
                    <br clear="all" style='mso-special-character:line-break;page-break-before:always'/>
     </div>            

</apex:repeat>

.
Hi All,
I do have 2 dependent picklist fiels called case reason and case type on case object. So  as i said i am using standard controller with extension i do have some custom functionality going on too. I do have recordtype of implementation on case and i added these 2 dependent fields to that and i selected only 2 values in the Controllling field(case reason). But it seems like the values in the controlling field are different for different profiles. I mean as a sys admin i am seeing 4 values in that controlling field instead of 2  from the page i developed? I saw some where that the dependent picklist wont work in custom controllers in the way they are supposed to but as i am using standard controller i am still facing that issue. Just wanted to know does the values in the picklist varies by profile too eventhough both profiles use the samerecordtype and page layout?
 Any help would be much appreciated!!
Hi All,
Got an error saying that unable to Post the data to 3rd party service due to invalid XML in one of the Field which we are mapping from salesforce which is in HML format. Tried using CDATA tags, but seems out like it didn't resolve the issue. 
Error: <Message>XML INVALID, Your XML is not valid according to Export DTD. unknown-65b0270:0: validity error : Element JobDescription was declared #PCDATA but contains non text nodes unknown-65b0270:0: validity error : No declaration for element p unknown-65b0270:0: validity error : No declaration for attribute style of element p
Tried using the below code.
JobDescription= rev.Job_Description__c;    --> Job_Description__c contains html tags like <ul>, <p>,<span>  etc.
String[] JD = JobDescription.split('<br>');
        JobDescription='';
        string JobDescriptionP='';
        for(String s : JD){
        JobDescription = JobDescription+'<![CDATA[<br>]]>' +s+' ';
            string[] JDP=JobDescription.split('<p>');
            for(string p:JDP){
                JobDescriptionP = JobDescriptionP+'<![CDATA[<p>]]>'+p+' ';
                        system.debug('jdp-----'+JobDescriptionP);
            }
            JobDescription=JobDescriptionP;
        system.debug('jd++++'+JobDescription);
        }
Hi All,
Got an error saying that unable to Post the data to 3rd party service due to invalid XML in one of the Field which we are mapping from salesforce which is in HML format. Tried using CDATA tags, but seems out like it didn't resolve the issue. 
Error: <Message>XML INVALID, Your XML is not valid according to Export DTD. unknown-65b0270:0: validity error : Element JobDescription was declared #PCDATA but contains non text nodes unknown-65b0270:0: validity error : No declaration for element p unknown-65b0270:0: validity error : No declaration for attribute style of element p
Tried using the below code.
JobDescription= rev.Job_Description__c;    --> Job_Description__c contains html tags like <ul>, <p>,<span>  etc.
String[] JD = JobDescription.split('<br>');
        JobDescription='';
        string JobDescriptionP='';
        for(String s : JD){
        JobDescription = JobDescription+'<![CDATA[<br>]]>' +s+' ';
            string[] JDP=JobDescription.split('<p>');
            for(string p:JDP){
                JobDescriptionP = JobDescriptionP+'<![CDATA[<p>]]>'+p+' ';
                        system.debug('jdp-----'+JobDescriptionP);
            }
            JobDescription=JobDescriptionP;
        system.debug('jd++++'+JobDescription);
        }
Hello All,
I am doing an api callout to an 3rd party website and i am writing an schedule class for that. while executing that scheduled calss i am getting the above error saying that you have some uncommitted work pending,please commit before rolling out. I have googled a lot about this and seems like we cannot callout after performing an Dml operations,

But in my code i am not able to seperate Dml and callout. Even i added @future annotation before the method which i used for Callout. It is retrieving the details of the first record after that when going to the second callout it is giving that error.

Basically it is following the unstructured format like doing a callout first and doing DML after that and again going for the callout- Which seems like not a best practice. So any suggestions in code will be a huge help.
@future(callout=true)
    public static void processAllOpenRequisition(){
        bulkify  = true;
       u = [SELECT Username_Broadbean__c,Password_Broadbean__c From USER WHERE id =:UserInfo.getUserId()];
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint('https://api.adcourier.com/hybrid/hybrid.cgi');
        req.setHeader('Content-Type', 'text/xml');
        requisitionRecMap = new Map<id, Recruiting_Activities__c>([SELECT  Time_now__c,Time_From__c FROM Recruiting_Activities__c WHERE EL_Status__c <> 'Closed' AND REcordtype.Name=:'Requisition' ]);
        system.debug('hellooooo'+requisitionRecMap);
          readObject(requisitionRecMap.keySet()); --> Here calling the another method for XML
           req.setBody(xmlData); 
            Http http = new Http();
            req.setTimeout(60000);
             if(!test.isrunningtest()){
                HttpResponse res = http.send(req);
                resbody = res.getBody();
                System.debug('*****'+res.getBody()); // Here you will get the response
             } 
       
            parseTest(); --> It is the method for parsing the data, here we are doing DML operations.
    }
    
    
 public static void readObject(Set<Id> recids){ 
   for(Recruiting_Activities__c ra:[SELECT  Time_now__c,Time_From__c,Req_ID__c  FROM Recruiting_Activities__c where Id IN:recids]){
       JobReference=ra.Req_ID__c;
       xmlData+='<?xml version="1.0" encoding="utf-8" ?>'
                +'<AdCourierAPI>'
                +'<Method>RetrieveApplications</Method>'
                +'<APIKey>3012861772</APIKey>'
                +'<Account>'
                    +'<UserName>'+u.Username_Broadbean__c+'</UserName>'
                    +'<Password>'+u.Password_Broadbean__c+'</Password>'
                +'</Account>'
                +'<Options>'
                    +'<Filter>'
                        +'<JobReference>'+JobReference+'</JobReference>'
                        +'<Times>'
                            +'<TimeFrom>ra.Time_From__c</TimeFrom>'
                            +'<TimeTo>2020-12-24T06:15:00Z</TimeTo>'
                        +'</Times>'
                        +'<Id></Id>'
                        +'<Rank>All</Rank>'
                    +'</Filter>'
                    +'<BodyFormat EncodingType="None" />'
                    +'<EmbedDocuments EncodingType="Base64">true</EmbedDocuments>'
                   +'<XMLFormat EncodingType="Base64">BGT</XMLFormat>'
                    +'<IncludeAddress>false</IncludeAddress>'
                +'</Options>'
            +'</AdCourierAPI>';
       system.debug('--------'+xmlData);
   }     
    
 }

 
Chatter information is different between Community and internal contexts. is there a way for the same chatter experience for internal employee regardless of whether they log in via AGS360(one of our community) or the internal salesforce experience?
Any suggestions would be great help.Thank you.
Hi
We are trying to create a modal pop up in home page component. For this we are using Jquery Libraries. And the way which we want the pop up to work is , We have a custom object called Home Modal and 2 custom fields for it namely modal status and User which is look up to user. So the functionality is when ever user logins for the first time it is suppose to show the modal pop, And if the user clicks i've read and understand  this button which is in the bottom of modal it is suppose to create a record in the custom object with the name of user pops up in the user fields and setting the modal status field to true(text field). So that if user clicks on it for first time until and unless the record deletes it wont pop up again. it is working in the way which we are looking for in Visual fprce pages but when tried pasting the same code in Home page component it is not working. I think component is not supporting to get the session id. The Code i am using is


<html>
  <head>
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css"/>
  
<script src="https://ags360--pdev.cs15.my.salesforce.com/soap/ajax/33.0/connection.js"  type="text/javascript"></script>

  <script type="text/javascript">
      sforce.connection.sessionId = "{!$Api.Session_ID}";

    var __sfdcSessionId = document.cookie.match('sid=([^;]*)')[1];
  </script>
  
    <script type="text/javascript">
    alert("Scripttt");
    var soql;
    var result;
    var records;
    var UserInfo;
      
    function showModal(){
                
        UserInfo = sforce.connection.getUserInfo();
        alert(UserInfo.userId);
        soql = "SELECT modal_status__c, User__r.Name FROM Home_modal__c  Where User__c='"+UserInfo.userId+"' ";
        result = sforce.connection.query(soql);
        records = result.getArray("records");
                    alert("records len=="+records.length);
        if(records.length==0){
            $(function() {
                    $( "#dialog" ).dialog({
                    modal: true,
                    draggable: false,
                    resizable: false,
                    position: ['center', 'top'],
                    show: 'blind',
                    hide: 'blind',
                    width: 400,
                    dialogClass: 'ui-dialog-osx',
                    buttons: {
                        "I've read and understand this": function() {
                            insertModalStatus();
                            $(this).dialog("close");
                            
                        }
                    }
                    });
                  });
        }
        
 
    }
    
    
                  
  function insertModalStatus(){
     //alert("asdasdasdasdas");
    var modalObj = new sforce.SObject("Home_modal__c");
    modalObj.User__c=UserInfo.userId;
    modalObj.modal_status__c="true";
    var insertResult = sforce.connection.create([modalObj]);   
    alert("insertResult == "+insertResult )
}

showModal();
  </script>

  <style>
  .ui-draggable .ui-dialog-titlebar {
  cursor: move;
  background: #A6192E;color: white;
}
  .ui-dialog .ui-dialog-titlebar {
  padding: .4em 1em;
  position: relative;
  background: #A6192E;color: white;
}
.ui-dialog .ui-dialog-buttonpane button {
  margin: .5em .4em .5em 0;
  cursor: pointer;
  background: #A6192E;color: white;
}
  </style>
</head>
 
<body>
 
<div id="dialog"  style='display:none;' title="Important Changes to Program Records ">
  <p>The AGS 360 team will be implementing a simplified structure for using Programs over the course of February. This will result in a more straightforward experience when referencing programs on projects, cases and other sections of the system while improving reporting capabilities. Look for more updates and system changes in the coming weeks.

Additionally, we'd like to extend a hearty welcome to the Operations pilot group. The program teams from Wellpoint, NAIC, Lexmark and Progressive have begun using AGS 360 for an expanded range of business processes. This pilot will exercise a wide variety of functionality in the system and set the stage for successful alignment to the AGS Way. We look forward to the feedback and insights from the pilot team.

For support, email <a href="mailto:AGS360@allegisglobalsolutions.com">AGS360</a></p>
</div>
 
 
</body>
</html>

Any suggestion will be great help.

 
Hi,
My SOQL Aggregate query returns 248 rows only but it is showing 50001 too many rows error. can anybody help me. Below is th debug logs which i found.

20:26:11.597 (4597606036)|SOQL_EXECUTE_BEGIN|[73]|Aggregations:0|select AVG(Case_Age__c) Caseage, COUNT(Id) Cnt, Program__r.Name progName, MAX(Program__c) progId from Case where Program__r.Name != null group by Program__r.Name limit 2000 20:26:13.019 (6019416719)|SOQL_EXECUTE_END|[73]|Rows:241
20:26:13.019 (6019464326)|EXCEPTION_THROWN|[73]|System.LimitException: Too many query rows: 50001
20:26:13.019 (6019747894)|SYSTEM_MODE_EXIT|false
Hello Friends

I am trying to show Lightning component on VF page. I am basically showing custom object list view along with a pop up box in my lightning component. When i am trying to refer the same component on VF page the Pop up and list view are rendering same as in Lightning but when i am trying to click on record ( h ref value is showing void (0)). Can anyone help me with the VF page $Lightning.createComponent method construction. My component and vf page are as shown below
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,lightning:actionOverride" access="global" >
   
    <aura:attribute name="recordId" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.openModal}"/>
    
    <lightning:listView aura:id="listViewcps"
    objectApiName="ABC"
    listName="All"
    rows="80"
    showSearchBar="true"
    showActionBar="true"
    enableInlineEdit="true"
    showRowLevelActions="true"/>
   
    

    
    <aura:attribute name="isOpen" type="boolean" default="false"/>
    <div class="slds-m-around_xx-large">
     
   
        <aura:if isTrue="{!v.isOpen}">
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
               <div class="slds-modal__container">
                    <header class="slds-modal__header">
                        <lightning:buttonIcon iconName="utility:close"
                                              onclick="{! c.closeModel }"
                                              alternativeText="close"
                                              variant="bare-inverse"
                                              class="slds-modal__close"/>
                       <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">CP MODAL DIALOG</h2>
</header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <p><b> 
                              TEST alert content

                            </b>
                        </p>
                    </div>

                  
                    <footer class="slds-modal__footer">
                        <lightning:button variant="neutral" 
                                          label="Cancel"
                                          title="Cancel"
                                          onclick="{! c.closeModel }"/>
                        <lightning:button variant="brand" 
                                          label="Like and Close"
                                          title="Like and Close"
                                          onclick="{! c.likenClose }"/>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
          
            
        </aura:if>
    </div>
</aura:component>


JS controller:

({
   doInit: function(component, event, helper) {
     
       var recordId = component.get("v.recordId").Id;
       debugger;
       sforce.one.navigateToSObject(component.get("v.recordId").Id);
       console.log('record id is '+recordId);
    },
    
    
    openModal: function(component, event, helper) {
      // for Display Model,set the "isOpen" attribute to "true"
      component.set("v.isOpen", true);
   },
 
   closeModel: function(component, event, helper) {
      // for Hide/Close Model,set the "isOpen" attribute to "Fasle"  
      component.set("v.isOpen", false);
   },
 
   likenClose: function(component, event, helper) {
      // Display alert message on the click on the "Like and Close" button from Model Footer 
      // and set set the "isOpen" attribute to "False for close the model Box.
      //alert('thanks for like Us :)');
      component.set("v.isOpen", false);
   },
})



VF page:

<apex:page showHeader="True" sidebar="false">

<div id="lightning"/>
<apex:includeLightning />
<script>
       var recordId= "https://login.salesforce.com/a00/o";
        
//Need help with this        
$Lightning.use("c:Cpligapp", function() {
          $Lightning.createComponent("c:CPlistview",
           
              {  }

           ,
          "lightning",
          function(cmp) {
          

          });
        });
    </script>

</apex:page>
User-added image
 
Hello friends

I created new picklist field on activities and trying to refer that on task kanban. But for some reason i am not able to see that picklist as an option for group by field section. i checked permissions of that custom field and it is visible for me as well as for some other profiles in the system. Any help would be hugely appreciated.
Thank you!
Hi All,

When i am trying to convert Vf page as word document i am getting blank space on the first page between header and start text as well as receving blanlk last page as attached. Any help would be greatly This blank space is coming right after header in first page before document is getting startedThis is blank last page
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<style>


            @page Section1{
                 size:9.0in 11in;
                 mso-page-orientation:landscape;
                 margin:0.5in 0.5in 0.5in 0.5in;
                 mso-header-margin:0.52in;
                 mso-footer-margin:0.5in;
                 mso-header: h1;
                 mso-footer: f1;
                 mso-paper-source:0;
            }
            div.Section1{
             page:Section1;
            }
            table#hrdftrtbl{
                margin:0in 0in 0in 15in;

            }
            p.MyFoot, li.MyFoot, div.MyFoot
            {
                mso-pagination:widow-orphan;
                tab-stops:center 100.0pt right 250.0pt;
                margin:0in;
                margin-top:.0001pt;
                margin-bottom:.0001pt;

            }
            p.MsoHeader,li.MsoHeader,div.MsoHeader
            {
             margin:-8in;
             margin-top:0.1pt;
             mso-pagination:widow-orphan;
             tab-stops:center 3.0in right 6.0in;
            }

            body 
            {
                font-family:DINPro-Light, Verdana, Arial;
                font-size: 11px;        
            }
            th, td 
            {
                padding: 2px;
                border: 1px solid Black;
                width: 40%;

            }
            th.sechead
            {
                text-align: center;
                col-span:1;
                white-space: nowrap;
            }
            table.fixed {border: 1px solid Black; table-layout:fixed;width: 100%;}



            div.breakPageAfter
            {
              page-break-after:always !important;
              page-break-inside:avoid !important;
              overflow:hidden !important;
            }

        </style>
</head>

<apex:repeat value="{!oplist}" var="op"> 
     <div class="breakPageAfter">
            <h1 style="color:Red;font-size: 140%;">
                       {!op.Account.name}({!op.name}) 
            </h1>

                <div class="column" overflow="hidden" >
                    <div class="Row">
                        <table class="fixed" border="none" >
                             <!--<tr>
                                  <th> Account Name</th>
                                  <td>{!op.Account.name}({!op.name})</td>
                             </tr>-->
                             <tr> 
                                  <th> Submitted By: </th>
                                  <td>{!op.owner.name}</td>
                             </tr>
                             <tr> 
                                  <th> Owner Title </th>
                                  <td>{!op.owner.title}</td>
                             </tr>
                             <tr>
                                  <th> Region</th>
                                  <td>{!op.Primary_Region__r.name}
                                  </td>
                             </tr>
                             <tr> 
                                  <th> Report Date </th>
                                  <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!TODAY()}" /> </apex:outputText>
                                  </td>
                             </tr>
                         </table>
                    </div>&nbsp;

                    <div class="Row">
                     <table class="fixed" border="none">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="1" Style ="color:rgb(255, 255, 255);">Document Objective</th>
                             </tr>
                             <td><p><b>The purpose of this plan is to document information about the account 
                                in a single document and to identify opportunities for a long-term relationship 
                                with the client that will bring in continuous sales opportunities.</b></p>
                             </td>
                     </table>
                    </div><br/><br/><br clear="all" style="page-break-inside:avoid;" />
                    <div class="Row">
                      <table class="fixed" border="1">
                        <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="2" Style ="color:rgb(255, 255, 255);">Account Background</th>
                        </tr>
                        <tr>
                           <th> Annual Spend</th>
                           <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Est_Client_Spend__c}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                           <th> Revenue </th>
                           <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Amount}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                           <th> Fee </th>
                           <td><apex:outputText value="{0,number,0}%"> <apex:param value="{!op.Est_MSP_fee__c}" /></apex:outputText>
                           </td>
                        </tr>
                        <tr>
                            <th> Partner Providers </th>
                           <!--<td><apex:outputText value="{0,number,0}%"> <apex:param value="{!op.Est_MSP_fee__c}" /></apex:outputText>
                           </td>-->
                        </tr>
                      </table>          
                    </div><br/>
                    <div class="Row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="1" Style ="color:rgb(255, 255, 255);">Client Company Overview</th>
                             </tr>
                             <td><p><b>{!op.Account.Description}</b></p>
                             </td>
                        </table>
                    </div><br/><br/>
                </div>
                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1" cellspacing="0" cellpadding="0" 
                           style='border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;'>
                            <tr Style ="background: #df7d26;">
                                <th class="sechead" colspan="2" Style ="color:rgb(255, 255, 255);">Opportunity Details</th>
                            </tr>
                            <tr>
                                  <th>Client Relationship Background</th>
                                  <td>{!op.Brief_Description_of_the_Opportunity__c}</td>
                            </tr>
                            <tr>
                                  <th>Client Business Objectives and Initiatives</th>
                                  <td>{!op.Client_Expected_Outcomes__c} </td>
                             </tr>     

                            <tr>
                                  <th>Problem Statement</th>
                                  <td>{!op.Customer_Pain_Points__c}</td>
                            </tr>
                            <tr>
                                  <th>Actions Taken</th>
                                  <td></td>
                            </tr>
                            <tr>
                                  <th>Next Steps</th>
                                  <td>{!op.NextStep}</td>
                            </tr>
                            <tr>
                                  <th>Type</th>
                                  <td>{!op.Type}</td>
                            </tr>
                            <tr>
                                  <th>Time Frame</th>
                                  <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!op.createddate}"/> 
                                        </apex:outputText>&nbsp;-&nbsp;<apex:outputText value="{0,date,MM/dd/yyyy}"><apex:param value="{!op.Expected_Go_Live_Date__c }"/></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Revenue </th>
                                   <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.ExpectedRevenue}" /></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Gross Profit($) </th>
                                   <td><apex:outputText value="{0,Number,Currency}"> <apex:param value="{!op.Gross_Profit__c}" /></apex:outputText>
                                   </td>
                            </tr>
                            <tr>
                                   <th> Probability </th>
                                   <td><apex:outputText value="{0,Number,0}%"> <apex:param value="{!op.Probability}" /></apex:outputText>
                                  </td>
                           </tr>
                            </table>
                    </div>
                </div><br/><br/>
                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">Client Contact List/Org Chart</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Phone</th>
                                  <th>Email</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityContactRoles}" var="ct">
                            <tr>
                                  <td>{!ct.contact.name}</td>
                                  <td>{!ct.contact.Title}</td>
                                  <td>{!ct.contact.Phone}</td>
                                  <td>{!ct.contact.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                </div><br/><br/>

                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">Internal Account Team</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Level Of Relationship</th>
                                  <th>Company</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityTeamMembers}" var="optm">
                            <tr>
                                  <td>{!optm.user.name}</td>
                                  <td>{!optm.user.Title}</td>
                                  <td>{!optm.TeamMemberRole}</td>
                                  <td>{!optm.user.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                </div><br/><br/>

                <div class="column" overflow="hidden">
                    <div class="row">
                        <table class="fixed" border="1">
                            <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="4" Style ="color:rgb(255, 255, 255);">OpCo Relationships</th>
                            </tr>

                           <tr>
                                  <th>Name</th>
                                  <th>Title</th>
                                  <th>Phone</th>
                                  <th>Email</th>

                            </tr>
                            <apex:repeat value="{!op.OpportunityContactRoles}" var="opct">
                            <tr>
                                  <td>{!opct.contact.name}</td>
                                  <td>{!opct.contact.Title}</td>
                                  <td>{!opct.contact.Phone}</td>
                                  <td>{!opct.contact.Email}</td>
                            </tr>

                           </apex:repeat>
                          </table>
                        </div>
                    </div><br/><br/>          

                    <div class="column" overflow="hidden" >
                        <div class="row">
                          <table class="fixed" border="1">
                             <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="1" Style ="color:rgb(255, 255, 255);">Risk Points</th>
                             </tr>
                             <td>{!op.Strategic_Risk__c}</td>
                          </table>
                        </div>
                    </div><br/><br/>

                    <div class="column" overflow="hidden">
                        <div class="row">
                          <table class="fixed" border="1">
                             <tr Style ="background: #df7d26;">
                                <th class="sechead"   colspan="1" Style ="color:rgb(255, 255, 255);">Action Plan (Next Steps)</th>
                             </tr>
                             <td>{!op.NextStep}</td>
                          </table>

                        </div>
                    </div>
                    <br clear="all" style='mso-special-character:line-break;page-break-before:always'/>
     </div>            

</apex:repeat>

.
Hi All,
I do have 2 dependent picklist fiels called case reason and case type on case object. So  as i said i am using standard controller with extension i do have some custom functionality going on too. I do have recordtype of implementation on case and i added these 2 dependent fields to that and i selected only 2 values in the Controllling field(case reason). But it seems like the values in the controlling field are different for different profiles. I mean as a sys admin i am seeing 4 values in that controlling field instead of 2  from the page i developed? I saw some where that the dependent picklist wont work in custom controllers in the way they are supposed to but as i am using standard controller i am still facing that issue. Just wanted to know does the values in the picklist varies by profile too eventhough both profiles use the samerecordtype and page layout?
 Any help would be much appreciated!!
Hi All,
Got an error saying that unable to Post the data to 3rd party service due to invalid XML in one of the Field which we are mapping from salesforce which is in HML format. Tried using CDATA tags, but seems out like it didn't resolve the issue. 
Error: <Message>XML INVALID, Your XML is not valid according to Export DTD. unknown-65b0270:0: validity error : Element JobDescription was declared #PCDATA but contains non text nodes unknown-65b0270:0: validity error : No declaration for element p unknown-65b0270:0: validity error : No declaration for attribute style of element p
Tried using the below code.
JobDescription= rev.Job_Description__c;    --> Job_Description__c contains html tags like <ul>, <p>,<span>  etc.
String[] JD = JobDescription.split('<br>');
        JobDescription='';
        string JobDescriptionP='';
        for(String s : JD){
        JobDescription = JobDescription+'<![CDATA[<br>]]>' +s+' ';
            string[] JDP=JobDescription.split('<p>');
            for(string p:JDP){
                JobDescriptionP = JobDescriptionP+'<![CDATA[<p>]]>'+p+' ';
                        system.debug('jdp-----'+JobDescriptionP);
            }
            JobDescription=JobDescriptionP;
        system.debug('jd++++'+JobDescription);
        }
Hello All,
I am doing an api callout to an 3rd party website and i am writing an schedule class for that. while executing that scheduled calss i am getting the above error saying that you have some uncommitted work pending,please commit before rolling out. I have googled a lot about this and seems like we cannot callout after performing an Dml operations,

But in my code i am not able to seperate Dml and callout. Even i added @future annotation before the method which i used for Callout. It is retrieving the details of the first record after that when going to the second callout it is giving that error.

Basically it is following the unstructured format like doing a callout first and doing DML after that and again going for the callout- Which seems like not a best practice. So any suggestions in code will be a huge help.
@future(callout=true)
    public static void processAllOpenRequisition(){
        bulkify  = true;
       u = [SELECT Username_Broadbean__c,Password_Broadbean__c From USER WHERE id =:UserInfo.getUserId()];
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint('https://api.adcourier.com/hybrid/hybrid.cgi');
        req.setHeader('Content-Type', 'text/xml');
        requisitionRecMap = new Map<id, Recruiting_Activities__c>([SELECT  Time_now__c,Time_From__c FROM Recruiting_Activities__c WHERE EL_Status__c <> 'Closed' AND REcordtype.Name=:'Requisition' ]);
        system.debug('hellooooo'+requisitionRecMap);
          readObject(requisitionRecMap.keySet()); --> Here calling the another method for XML
           req.setBody(xmlData); 
            Http http = new Http();
            req.setTimeout(60000);
             if(!test.isrunningtest()){
                HttpResponse res = http.send(req);
                resbody = res.getBody();
                System.debug('*****'+res.getBody()); // Here you will get the response
             } 
       
            parseTest(); --> It is the method for parsing the data, here we are doing DML operations.
    }
    
    
 public static void readObject(Set<Id> recids){ 
   for(Recruiting_Activities__c ra:[SELECT  Time_now__c,Time_From__c,Req_ID__c  FROM Recruiting_Activities__c where Id IN:recids]){
       JobReference=ra.Req_ID__c;
       xmlData+='<?xml version="1.0" encoding="utf-8" ?>'
                +'<AdCourierAPI>'
                +'<Method>RetrieveApplications</Method>'
                +'<APIKey>3012861772</APIKey>'
                +'<Account>'
                    +'<UserName>'+u.Username_Broadbean__c+'</UserName>'
                    +'<Password>'+u.Password_Broadbean__c+'</Password>'
                +'</Account>'
                +'<Options>'
                    +'<Filter>'
                        +'<JobReference>'+JobReference+'</JobReference>'
                        +'<Times>'
                            +'<TimeFrom>ra.Time_From__c</TimeFrom>'
                            +'<TimeTo>2020-12-24T06:15:00Z</TimeTo>'
                        +'</Times>'
                        +'<Id></Id>'
                        +'<Rank>All</Rank>'
                    +'</Filter>'
                    +'<BodyFormat EncodingType="None" />'
                    +'<EmbedDocuments EncodingType="Base64">true</EmbedDocuments>'
                   +'<XMLFormat EncodingType="Base64">BGT</XMLFormat>'
                    +'<IncludeAddress>false</IncludeAddress>'
                +'</Options>'
            +'</AdCourierAPI>';
       system.debug('--------'+xmlData);
   }     
    
 }

 
Hi,
My SOQL Aggregate query returns 248 rows only but it is showing 50001 too many rows error. can anybody help me. Below is th debug logs which i found.

20:26:11.597 (4597606036)|SOQL_EXECUTE_BEGIN|[73]|Aggregations:0|select AVG(Case_Age__c) Caseage, COUNT(Id) Cnt, Program__r.Name progName, MAX(Program__c) progId from Case where Program__r.Name != null group by Program__r.Name limit 2000 20:26:13.019 (6019416719)|SOQL_EXECUTE_END|[73]|Rows:241
20:26:13.019 (6019464326)|EXCEPTION_THROWN|[73]|System.LimitException: Too many query rows: 50001
20:26:13.019 (6019747894)|SYSTEM_MODE_EXIT|false


Exception :
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out*

**Visualforce Page**

    <apex:page controller="Controller" action="{!init}" showHeader="false" sidebar="false">
        <center>
            <apex:pageBlock title="Request Listener"></apex:pageBlock>         
        </center>
    </apex:page>
**Controller :**         


    PUBLIC with sharing class Controller
    {  
        PUBLIC String fromNumber      = ApexPages.currentPage().getParameters().get('From');
        PUBLIC String toNumber        = ApexPages.currentPage().getParameters().get('To');
        PUBLIC String body            = ApexPages.currentPage().getParameters().get('Body');  
        PUBLIC PageReference init()
        {          
            System.debug('From Phone Number :' +fromNumber);
            System.debug('To phone NUmber :' + toNumber);
            System.debug('Message Body :' + body);
                          
            TwilioRestClient Client = TwilioAPI.getDefaultClient();                                                  
                SYSTEM.DEBUG('FROM AND To  Number is NOT NULL');        
                String formattedNumber='+919876543210';   
                IF(body != NULL)
                    body = body;
                ELSE
                    body = '';
                Case c = NEW Case (Subject = formattedNumber,Description = body,Origin = 'Phone');
                INSERT c;                
               
                Map<String,String> params1 = new Map<String,String>
                {
                   'To'   => fromNumber,
                   'From' => '+1908280****',
                   'Body' => 'Conformation to customer'
                };
                TwilioMessage message = client.getAccount().getMessages().create(params1); /* Valid conformation SMS sent to the Customer.*/                                  
            return null ;
        }
    }
   

While login as admin then click preview on visualforce page executed but case is not created.I have checked the the debug log it throw the exception.

 

Hi everyone,

 

I've been altering some integration code and now I get the dreaded "You have uncommitted work pending. Please commit or rollback before calling out" message.  This is supposed to indicate I have begun an update or insert and subsequently made a callout.

 

The code I started with is very OO and it's hard to figure out exactly what is getting run when.  So after a while I started copying the code into a refactored base so I can tell exactly what is going on.  I am now at the point where my code has no DML at all, I'm not even doing a select and I still get the error.  Code is below.

 

I have to think one of two things is happening. Either the error message is incorrect or something is "stuck."  I don't have solid evidence for the latter idea but this error message has come and gone a couple of times without any obvious action on my part.

 

As I search this error message I only find people who actually were doing DML before the callout.  Clearly I am not.  Am I special?  I hope someone else has faced this.

 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

// execute this line in an anonymous block to see the error non-fun

CalloutLaidBare.toddWillMakeItHappen();

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// here's the class

public with sharing class CalloutLaidBare {


    public static void toddWillMakeItHappen() {

        Map<String, String> params = new Map<String, String>();
        params.put('master_plan_no', '10266411');
        params.put('master_plan_units', '1');

        // etc, all hard-coded values

        // normally I'd be parsing values from an opportunity which is why this is seperate from the future method


        String qs = makeStringFromMap(params);  // this works
        CalloutLaidBare.makeItHappenCallout(qs);

 

    }

    @future(callout=true)
    public static void makeItHappenCallout(String qs) {

        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('hard-coded endpoint');
        req.setMethod('POST');
        req.setBody(qs);

        try {
            HttpResponse res = h.send(req);

            // why bother parsing, I'll never get here

 

        } catch (Exception e) {
            // email myself e.getMessage() and drown my sorrows in chocolate
        }

    }


}

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Hi all,

I am new for Apex development. So please help me out. Any help will be appreciable.
Currently I am using a function in our application in which I am retrieving data from external web services and storing it in Salesforce database. I am calling this function in a ‘for’ loop because this is getting called multiple times based on the selection of checkboxes. At 1st time, this function is working properly but 2nd time, It's giving exception which is as follows:
ERROR: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

Below is the function which is getting called multiple times:
WebService static void getContent(String id)
{
    String response = '';
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    String url = 'url of the web service';
    req.setEndpoint(url);
    req.setMethod('GET');
    HttpResponse res=null;
    try {
        res= h.send(req);
    } catch(System.CalloutException e) {
    System.debug('ERROR: '+ e);
}

Thanks,
Manjiri