• thatherahere
  • NEWBIE
  • 100 Points
  • Member since 2013
  • Sr. Salesforce Developer


  • Chatter
    Feed
  • 3
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 45
    Replies
Hi i want to use ajax toolkit for my project, however when trying one of the example i m getting this error again and again


{faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }

Here is the VF page.
 
<apex:page >
          <body><button onclick="setupPage();"> dev </button>
                 <div id="output"></div>
          </body>
          
          <script src="../../soap/ajax/35.0/connection.js" type="text/javascript"></script>
          <script>
                    function setupPage() {
                       
                           sforce.connection.query('select id from lead',
                           {onSuccess : layoutResults,
                            onFailure : queryFailed,
                            source : {
                                      output : document.getElementById("output"),
                      startTime : new Date().getTime()
                     }
           });
          
       }
       function queryFailed(error, source) {
       alert('hello 1');
                source.output.innerHTML = error;
}
/**
* This method will be called when the toolkit receives a successful
* response from the server.
* @queryResult - result that server returned
* @source - state passed into the query method call.
*/

function layoutResults(queryResult, source) {
     alert('hello 2');
     if (queryResult.size > 0) {
     var output = "";

     //get the records array
     var records = queryResult.getArray('records');

     //loop through the records and construct html string
     for (var i = 0; i < records.length; i++) {
          var account = records[i];
          output += account.Id + " " + account.Name +
          " [Industry - " + account.Industry + "]<br>";
     }

     //render the generated html string
     source.output.innerHTML = output;
     }
}

          </script>
    
</apex:page>
Need Help !!
Thanks 
Abhilash
Hey guys,

I got requirement to have automation on case object. This particular requirement is just update all child cases status to same as parent case when it is updated.

I tried with process builder but it cannot handle if case has 500+ childs. So I'm trying with trigger.

trigger caseStatusSync on Case (before update) {

Set<Id> casesToProcess = new Set<Id>();

for(case c : Trigger.new){
    if( 
         (Trigger.newmap.get(c.id).status != Trigger.oldmap.get(c.id).status) 
       &&(
            trigger.newmap.get(c.id).status.containsIgnoreCase('Escalated')
         || trigger.newmap.get(c.id).status.containsIgnoreCase('Resolved')
         )
       )
    {
        casesToProcess.add(c.id);
    }
}

list<case> childcases = [select id,status,parentid from case where parentid in :casesToProcess ];
list<case> childCasesToUpdate = new list<case>();
    for(case cs:trigger.new){
    for(case c:childcases){
        c.status= trigger.newmap.get(cs.id).status;
        childCasesToUpdate.add(c);
    }
    }
    update childCasesToUpdate;
}

I think nested for loops are not recommended, so the problem here is, how to get rid of nested for loops ?  

Any other advice/change to the above code will be greatly helpful for me thanks.

We have written a before/after update trigger on AgentWork object to get information about the Owner Change from Queue to User on Case record acceptance from Omni Channel. To get this From and To owner information we tried to use UserId and OriginalQueueId fields from AgentWork object. As we tried to access and use OriginalQueueId field in our trigger's handler class, Our trigger stopped firing. We found no debug logs in developer console on case acceptance. As we commented or removed OriginalQueueId field from our trigger code, trigger started executing. In our findings we saw that "OriginalQueueId" field is not present within AgentWork object from trigger.new list.
Here is the log:

AgentWork: AgentWork:{Id=0Bz5B0000004LhuSAE, IsDeleted=false, Name=00004387, CreatedDate=2017-09-28 12:33:56, CreatedById=0055B000000W1hGQAS, LastModifiedDate=2017-09-28 12:34:01, LastModifiedById=0055B000000W1hGQAS, SystemModstamp=2017-09-28 12:34:01, UserId=0055B000000W1hGQAS, WorkItemId=5005B000002SIDGQA4, Status=Opened, ServiceChannelId=0N932000000TN1KCAW, LASessionId=2de1db2c-6ae1-429e-97b9-160592cae978, StatusSequence=0, CapacityWeight=1.00, CapacityPercentage=null, RequestDateTime=2017-09-28 12:28:48, AcceptDateTime=2017-09-28 12:34:01, DeclineDateTime=null, CloseDateTime=null, SpeedToAnswer=313, AgentCapacityWhenDeclined=null, PendingServiceRoutingId=0JR5B0000000Ke6WAE, PushTimeout=60, PushTimeoutDateTime=null, HandleTime=null, ActiveTime=null, DeclineReason=null, CancelDateTime=null, AssignedDateTime=2017-09-28 12:33:56}


As we did not find this field in AgentWork record from trigger.new list, We tried to do the following query on AgentWork record to get OriginalQueueId field value:

SELECT Id, OriginalQueueId FROM AgentWork WHERE Id in: setCurrentAgentWorkIds


and again this stopped our trigger from execution and found no debug logs were generated for our trigger statements.
We try to execute the same query in Developer console & eclipse and we were able to see OriginalQueueId field value in results. It is just not working in use with our trigger execution. I verified the isAccessible via Schema.DescribeFieldResult and it is returning "true" for OriginalQueueId field.

Can we get an explanation on this behavior? Is there any special restriction on using OriginalQueueId field in AgentWork trigger?
See Class Here:

public with sharing class AgentWorkTriggerHandler {

    public static void afterUpdate( list<AgentWork> lstNewAgentWorks, map<Id, AgentWork> mapNewAgentWorks, list<AgentWork> oldNewAgentWorks, map<Id, AgentWork> mapOldAgentWorks ){

        map<Id, AgentWork> mapAWorkByCaseId = new map<Id, AgentWork>();
        for( AgentWork aWork : lstNewAgentWorks ){
            System.debug('---> AgentWork: '+aWork);
            if( aWork.Status == 'Opened' && String.valueOf( aWork.WorkItemId ).startsWith( '500' ) ){
                mapAWorkByCaseId.put( aWork.WorkItemId, aWork );
            }
        }

        if( mapAWorkByCaseId.size() > 0 ){
            map<Id, Case> mapNewCase = new map<Id, Case>();
            map<Id, Case> mapOldCase = new map<Id, Case>();

            map<Id, Id> mapQueueIdByWorkId = getQueueIdByWorkId( mapNewAgentWorks.keyset() );

            for( Case caseObj : [SELECT Id, OwnerId, Status, CreatedDate FROM Case WHERE Id in:mapAWorkByCaseId.keySet()]){
                AgentWork aWork = mapAWorkByCaseId.get( caseObj.Id );
                mapNewCase.put( caseObj.Id, caseObj );

                Case oldCase = caseObj; 
                oldCase.OwnerId = mapQueueIdByWorkId.get( aWork.Id );
                mapOldCase.put( caseObj.Id, oldCase );
            }
            System.debug( '----> mapOldCase: '+mapOldCase);
            System.debug( '----> mapNewCase: '+mapNewCase);
            CaseTriggerHandler.updateCaseLifeCycleRecords( mapNewCase.values(), mapNewCase, mapOldCase.values(), mapOldCase );
        }
    }

    public static map<Id, Id> getQueueIdByWorkId( set<Id> workIds ){
        map<Id, Id> mapQueueIdByWorkId = new map<Id, Id>();

        // If I comment below loop statement, I can see debug logs from this handler class in Developer console.
        // If I leave below loop uncommented, I did not get any debug logs for this handler class in developer console. even no debugs from the trigger. 
        for( AgentWork aWork : [SELECT Id, OriginalQueueId FROM AgentWork WHERE Id in:workIds]){ 
            mapQueueIdByWorkId.put( aWork.Id, aWork.OriginalQueueId );
        }
        return mapQueueIdByWorkId;
    }
}
I have overridden standard Edit button with a Custom Lightning Component and that component is using force:recordEdit component in it to allow user edit the record.
I have a custom save method implemented in my component that is pretty much similar to example documented at Salesforce Lightning component reference.
The line in my save method cmp.find("edit").get("e.recordSave").fire(); is working very weirdly. Sometimes it is working fine and saving the record and sometimes throwing bellow error:
User-added image

Here is the code implemenation for this:

Component Code:
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>

<div id="slds-modal__DCamp" aura:id="slds-modal__DCamp">
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-describedby="modal-content-id-1" class="slds-modal slds-slide-up-saving">
        <div class="slds-modal__container">
            <header class="slds-modal__header">
                <lightning:buttonIcon iconName="utility:close" variant="bare" onclick="{! c.cancelEdit }"  class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse slds-button_icon-small" alternativeText="Close window."/>
                <h2 id="modal-heading" class="slds-text-heading_medium slds-hyphenate">Edit {!v.recordName}</h2>
            </header>
            <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                <force:recordEdit aura:id="edit" recordId="{!v.recordId}"/>
            </div>
            <footer class="slds-modal__footer">
                <lightning:button variant="neutral" label="Cancel" onclick="{! c.cancelEdit }" />
                <lightning:button variant="brand" label="Save" onclick="{! c.save }" />
            </footer>
        </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open" style="visibility: visible;opacity: 1;"></div>
</div>
Controller.js​
save : function(cmp, event) {
    cmp.find("edit").get("e.recordSave").fire();
    console.log('----> inside save.');
},
handleSaveSuccess : function(cmp, event) {
    // Display the save status
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "type" : "Success",
        "mode" : "dismissible",
        "duration" : 5000,
        "message": "Record "+cmp.get("v.recordName")+" was saved."
    });
    toastEvent.fire();
    var  viewURL = "/"+cmp.get("v.recordId");
    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
        "isredirect" : false,
        "url": viewURL
    });                        
    urlEvent.fire();
}
Any idea, why it is behaving like this? any help on this will be greatly appreciated.
 
Is there any way to detect Org has "Advanced Currency Management" enabled in apex class? 
Hi,

I'm using Salesforce Lightning Design System with a Visualforce page and using <svg> tag to get SLDS Icons on Page header and Buttons. Initially on page load all works fine but when I try to re-render any <apex:outputPanel> that have <svg> icons inside it, on complete of rerendering it vanish my all <svg> icons.
I tried to debbug it by Inspect element in chrome and found after re-rendering any block my <svg> icon tags are not there.

anyone else experiencing this issue?

Any advise or guidance would be greatly appreciated.

Thanks,
@thatherahere
Hi,

I'm using Lightning Design System with a Visualforce page and using <svg> tag to get SLDS Icons on Page header and Buttons. Initially on page load all works fine but when I try to re-render any <apex:outputPanel> that have <svg> icons inside it, on complete of rerendering it vanish my all <svg> icons.
I tried to debbug it by Inspect element in chrome and found after re-rendering any block my <svg> icon tags are not there.

anyone else experiencing this issue?

Any advise or guidance would be greatly appreciated.

Thanks,
@thatherahere
Hi,

Is there any way to access chart color code of picklist values in apex class?

Hi there,

I have a requirement where I have to fetch Salesforce CRM Contents and have to display them in a vf page on my Org Site for public display.
Is there any way to achieve this?  


I got this link: http://developer.force.com/cookbook/recipe/displaying-salesforce-crm-content-documents-in-a-visualforce-page
With this I'm able to fetch and display them on vf page but I'm not getting How can I display them on Site! I have added my page to Site but I think Contents are not available on Site. :-/


Thanks,

Hi,
How can I check whether the current user is an approver or not for an Approval Process? 

 

I have overridden standard Edit button with a Custom Lightning Component and that component is using force:recordEdit component in it to allow user edit the record.
I have a custom save method implemented in my component that is pretty much similar to example documented at Salesforce Lightning component reference.
The line in my save method cmp.find("edit").get("e.recordSave").fire(); is working very weirdly. Sometimes it is working fine and saving the record and sometimes throwing bellow error:
User-added image

Here is the code implemenation for this:

Component Code:
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>

<div id="slds-modal__DCamp" aura:id="slds-modal__DCamp">
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-describedby="modal-content-id-1" class="slds-modal slds-slide-up-saving">
        <div class="slds-modal__container">
            <header class="slds-modal__header">
                <lightning:buttonIcon iconName="utility:close" variant="bare" onclick="{! c.cancelEdit }"  class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse slds-button_icon-small" alternativeText="Close window."/>
                <h2 id="modal-heading" class="slds-text-heading_medium slds-hyphenate">Edit {!v.recordName}</h2>
            </header>
            <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                <force:recordEdit aura:id="edit" recordId="{!v.recordId}"/>
            </div>
            <footer class="slds-modal__footer">
                <lightning:button variant="neutral" label="Cancel" onclick="{! c.cancelEdit }" />
                <lightning:button variant="brand" label="Save" onclick="{! c.save }" />
            </footer>
        </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open" style="visibility: visible;opacity: 1;"></div>
</div>
Controller.js​
save : function(cmp, event) {
    cmp.find("edit").get("e.recordSave").fire();
    console.log('----> inside save.');
},
handleSaveSuccess : function(cmp, event) {
    // Display the save status
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "type" : "Success",
        "mode" : "dismissible",
        "duration" : 5000,
        "message": "Record "+cmp.get("v.recordName")+" was saved."
    });
    toastEvent.fire();
    var  viewURL = "/"+cmp.get("v.recordId");
    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
        "isredirect" : false,
        "url": viewURL
    });                        
    urlEvent.fire();
}
Any idea, why it is behaving like this? any help on this will be greatly appreciated.
 
Hi,

Is there any way to access chart color code of picklist values in apex class?
I stuck at challenge 7 
i get this error 
User-added image

while i trying to dashboard name as Sales Operations 
the properties details  
User-added image

while i Subscription on Opportunities Pipeline Report 
i getting error while i click to save 
User-added image

i get this message while i click to save 
User-added image

please anyone guide how to solve reports and dashboards
 
Hi All ,
How to pass <lightning:select > and <lightning:input > values from child component to parent component 
i'm preparing the data on child component (user UI from with mutiple rows) and i have save button on parent component , when i'm click on save button  all the input field values need to bring from child component to parent ,i'm using component event but values are not getting....
I am creating Lightning componant. but not able to save this componant.

User-added image

Thanks
Mukesh
I have overridden standard Edit button with a Custom Lightning Component and that component is using force:recordEdit component in it to allow user edit the record.
I have a custom save method implemented in my component that is pretty much similar to example documented at Salesforce Lightning component reference.
The line in my save method cmp.find("edit").get("e.recordSave").fire(); is working very weirdly. Sometimes it is working fine and saving the record and sometimes throwing bellow error:
User-added image

Here is the code implemenation for this:

Component Code:
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>

<div id="slds-modal__DCamp" aura:id="slds-modal__DCamp">
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-describedby="modal-content-id-1" class="slds-modal slds-slide-up-saving">
        <div class="slds-modal__container">
            <header class="slds-modal__header">
                <lightning:buttonIcon iconName="utility:close" variant="bare" onclick="{! c.cancelEdit }"  class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse slds-button_icon-small" alternativeText="Close window."/>
                <h2 id="modal-heading" class="slds-text-heading_medium slds-hyphenate">Edit {!v.recordName}</h2>
            </header>
            <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                <force:recordEdit aura:id="edit" recordId="{!v.recordId}"/>
            </div>
            <footer class="slds-modal__footer">
                <lightning:button variant="neutral" label="Cancel" onclick="{! c.cancelEdit }" />
                <lightning:button variant="brand" label="Save" onclick="{! c.save }" />
            </footer>
        </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open" style="visibility: visible;opacity: 1;"></div>
</div>
Controller.js​
save : function(cmp, event) {
    cmp.find("edit").get("e.recordSave").fire();
    console.log('----> inside save.');
},
handleSaveSuccess : function(cmp, event) {
    // Display the save status
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "type" : "Success",
        "mode" : "dismissible",
        "duration" : 5000,
        "message": "Record "+cmp.get("v.recordName")+" was saved."
    });
    toastEvent.fire();
    var  viewURL = "/"+cmp.get("v.recordId");
    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
        "isredirect" : false,
        "url": viewURL
    });                        
    urlEvent.fire();
}
Any idea, why it is behaving like this? any help on this will be greatly appreciated.
 
Is there any way to detect Org has "Advanced Currency Management" enabled in apex class? 
I have a page built with external css and scripts .I added css to load in parallel and js to load one after another using aura iteration as below:
<!-- Bootstrap -->
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/lib/bootstrap/css/bootstrap.min.css"/>
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/lib/bootstrap/css/bootstrap-theme.min.css"/>
    
    <!-- Main CSS --> 
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/css/font.css"/>
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/css/jquery.ui.css"/>
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/css/jqtransform.css"/>
    <ltng:require styles="/resource/CorporateCommunicationResources/corp-comm-ui-prototype/css/screen.css"/>

     <!-- scripts -->   
 
    <ltng:require scripts='/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/jquery-2.1.4.min.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/jquery.jqtransform.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/jquery-ui.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/hammer.min.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/jquery.hammer.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/lib/bootstrap/js/bootstrap.min.js,/resource/CorporateCommunicationResources/corp-comm-ui-prototype/js/jquery.tablesorter.min.js,/resource/LoadData,/resource/Script' afterScriptsLoaded ="{!c.jsLoaded}" />



    
I have a component which uses aura:iteration multiple times as below:
 
<aura:iteration items="{!v.SomeListofList}" var="InsideList">
  <aura:iteration items="{!InsideList}" var="data">

     --- code  -----
   </aura:iteration>
</aura:iteration

When page load first time or if i open the browser console (Google Chrome) Then all components loads fine and css applies to it but if i refresh the app second time css breaks.Any help will be great.
 
Hello,

I am trying to get the second highest value in SOQL with below Query,
 
select Max(Age__C) from Patient__c Where Age__C NOT IN ( select MAX(Age__c) from Patient__c )
But am getting result with below Query
 
select Max(Age__C) from Patient__c Where Age__C NOT IN (23)


 
hai guys,

I have a requirment.
When creating a new in the custom object new button not visible in the standard page layouts.
How can i visible the new button in standard page layouts.please help me.

IN the profile level i given view all and modify all permissions
 
I'm attempting to include a mock web service callout in a test for a trigger, though the trigger and test don't explicitly execute a callout. I've found this documentation on creating the mock, but I'm pretty new to Apex and am unsure how to configure the two classes: WebServiceMockImpl and WebSvcCallout.

Any guidance would be appreciated. Below is the trigger, an associated class and the current test class.

Trigger:
trigger updateContactAfterConverted on Lead (after update) {
    
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            
            if (Lead.IsConverted) {
            
                // query new contact
            
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        
        }
    
    }
Associated class:
public class updateContactAfterConvertedFuture {
    
      @future
      public static void myMethod(String newContact) {
    
        // Find new contact
            
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
                                            
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    
    }
Test class:
@isTest
    private class testUpdateContactAfterConvertedOrig {
    
        static testmethod void myUnitTest() {

                Test.startTest();
                
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new WebServiceMockImpl());
        
        // Call the method that invokes a callout
        String output = WebSvcCallout.callEchoString('Hello World!');
        
        // Verify that a fake result is returned
        System.assertEquals('Mock response', output);                 
                
                // Create new test lead
                Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
                insert myLead;
                
                // Convert test lead
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.id);
                
                // Check conversion
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                lc.setDoNotCreateOpportunity(True);
                
                // Declare successful
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                Test.stopTest();
                System.assert(lcr.isSuccess());
    
        }
    }

 
  • February 20, 2016
  • Like
  • 0
check syntax of soql thorugh command button in my visualforce page can any one suggest how ??
Hi,

I created a custom button that should redirect to different apex page based on the record type.
Example: If record type = a then it should redirect to "abc" page otherwise "xyz" page

But when i click on the button i get illiegal token error.
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/23.0/apex.js")} 

var rtype;

if({!Account.RecordTypeId} == "012G0000000nKI7")
{
rtype = "/apex/Newcase?";
}
else 
{
    rtype = "/apex/oldcase?";

}

window.top.location.href = rtype ;

Please help.
Not getting any Value in CK editor on Parent Page . Value is coming through action button of child page
How to reRender the Parent page
//////////////////////Parent Page////////////////////////////////
<apex:page StandardController="Contact"  extensions="AccountSelectClassController" > 
<script>
var newWin=null;
        function check(){
            var url='/apex/selectvideo2';
            newWin=window.open(url, 'Popup','height=500,width=700,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
        }

        function closePopup(){
            if (null!=newWin){
                newWin.close();
             
            }  
        }
</script> 
<apex:form id="frmId">
<apex:outputLabel value="Choose Video "/>
<apex:outputLink onClick="check();return false;"> <br/>
Click here to choose session </apex:outputLink>
<br/><br/>
<apex:outputLabel value="Body" for="Body"/>:<br/>
<apex:inputtextarea value="{!body}" id="body" styleClass="ckeditor" richtext="false" style="width: 500px; height: 150px;">
</apex:inputtextarea>
<br/><br/><br/>        
<apex:includescript value="{!URLFOR($Resource.CkEditor,'ckeditor/ckeditor.js')}" />
</apex:pageblock>
</apex:form>
</apex:page>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ child Pop up page////////////////////////////////
<apex:commandButton value="Done" onclick="CloseWindow(); return false;" action="{!callapi2}" />
</apex:pageBlock>
<script>
        function CloseWindow(){
            var winMain=window.opener;
            if (null==winMain){
                winMain=window.parent.opener;
            }
            winMain.closePopup()   
        }
</script>    
</apex:form>

/////////////////////////Controller\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

public void callapi2(){
 //body = '';
 String  SessionId = '';
 for( consolewrap cwt : selectedWrapperList){
 if(cwt.selected){
  if(SessionId == ''){
   SessionId += cwt.sid;
  }else{
   SessionId += ','+ cwt.sid;
  }
  }
   } 
 
      List<video> ConsoleWrapperList1 = new List<video>();
        HttpRequest req = new HttpRequest(); 
        HttpResponse res = new HttpResponse();
        Http http = new Http(); 
        req.setEndpoint('http://webapi.demomail.net/test/SendVideoBody.js?id='+SessionId); 
        req.setMethod('GET');
        res = http.send(req);
        if(res.getstatusCode() == 200 && res.getbody() != null){ 
            String replaceIllegal= res.getbody().replaceAll('\n','').replaceAll('\r','').replace('','');
            ConsoleWrapperList1=(List<video>)System.JSON.deserialize(replaceIllegal,List<video>.class);
            
            body = ConsoleWrapperList1.get(0).bodyT;
            System.debug('***********: '+ body );
        }
  
 }