• Sandesh Vishwakarma 9
  • NEWBIE
  • 50 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 7
    Replies
public class OpportunityToBeSent {
    @future (callout=true)
    public static void makePostCallout(String recId) {
        String token; 
        //        System.debug('recorddIdd' + recorddIdd);
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXXXXXX/authenticate');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        // Set the body as a JSON object
        request.setBody('{"email": "XXXXX@XXXX.com","password": "XXXXXX"}');
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            Map<String, Object> m2 = (Map<String, Object>) results.get('data');
            System.debug('results'+ m2.get('jwtToken'));
            token = (string)m2.get('jwtToken');
            System.debug('token '+ token);
        }
        makePostCalloutt(recId , token);
        
    }
    
    
    public static void makePostCalloutt(String recId , String tokenn) {
        System.debug('Token >>>'+ tokenn);
      
        String body = recId;
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXX?id='+ body);
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text');
        request.setHeader( 'token', 'Bearer ' + tokenn );
        // Set the body as a JSON object
        request.setBody(body);
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
        
    }    
}
TASK : I want to send the recordId of the updated Opportunity record whenever it is updated. I want to send it to external web service , my code is working and fulfilling my requirement but have a look at it once. 

I first got the updated Opportunity recirdId from trigger then I called my first callout where I got the 'Token' , and then I called the secod method where I send the recordId.


Please examine this code. Thanks in advance 

public class OpportunityToBeSent {
    @future (callout=true)
    public static void makePostCallout(String recId) {
        String token; 
        //        System.debug('recorddIdd' + recorddIdd);
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXXXXXX/authenticate');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        // Set the body as a JSON object
        request.setBody('{"email": "XXXXX@XXXX.com","password": "XXXXXX"}');
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            Map<String, Object> m2 = (Map<String, Object>) results.get('data');
            System.debug('results'+ m2.get('jwtToken'));
            token = (string)m2.get('jwtToken');
            System.debug('token '+ token);
        }
        makePostCalloutt(recId , token);
        
    }
    
    
    public static void makePostCalloutt(String recId , String tokenn) {
        System.debug('Token >>>'+ tokenn);
      
        String body = recId;
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXX?id='+ body);
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text');
        request.setHeader( 'token', 'Bearer ' + tokenn );
        // Set the body as a JSON object
        request.setBody(body);
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
        
    }    
}
I have created a trigger to get the ID of the recently updated Opportunity record , Now How can I send this ID via REST API to external web application of .Net

Thanks in advance
I want to send the ID of the opportunity record just got updated to the external web service. How can I do it please help me . Thanks
I want to send the Opportunity record ID to an external web server whenever the opportunity record is updated so that they can perform opertions on their database to update the same record there as well.

I have written a trigger to get the recordID of thr updated record. Now I want to send it to the external web server please help me out. Thank you


trigger GetUpdatedOpportunityID on Opportunity (before update) {
        Set<Id> allInsertedIds = trigger.newMap.keySet();
        system.debug('allInsertedIds--------------------------------' + allInsertedIds);

}
 
public class OpportunityFetchField {
    
    @AuraEnabled
    public static list<Opportunity> insertOpportunity(list<Opportunity> oplist, ID ContactId, map<string, string> newObj){
        Contact rec = [SELECT ID ,Name from Contact where ID =: ContactId];
        system.debug('rec '+rec);
        system.debug('oplist '+oplist);
        system.debug('newObj '+newObj);
        for(Opportunity op :oplist){
            op.ContactId = rec.Id;
            op.StageName='Needs Analysis';
        }
        // op.Name= rec.Name;
        //op.CloseDate = Date.today();
        ///***************/
        Integer numberOfRelatedRecords = 0;
        //  Integer SessionNumber = 0;
        List<engageFI_Retail__c> eFIR = [SELECT ID , Name from engageFI_Retail__c where Contact_Name__c =: ContactId];
        System.debug('engageFI_Retail__c---->'+ eFIR);
        System.debug('Size------>'+ eFIR.size());

        
        if(eFIR.size()==5){
            /*----------------------------------------*/
            engageFI_Retail__c eFIRR =  [SELECT id , Name ,Contact_Name__c from engageFI_Retail__c where Contact_Name__c =: ContactId order by createdDate ASC limit 1];
            System.debug('eFIRR--------------'+eFIRR);
            delete eFIRR;
            /*-----------------------------------------*/
            engageFI_Retail__c er = new engageFI_Retail__c();
            
            if(newObj.containskey('BANK_CONVENIENCE__c')){
                er.BANK_CONVENIENCE__c = newObj.get('BANK_CONVENIENCE__c');
            }
            if(newObj.containskey('BANK_COST_EFFECTIVENESS__c')){
                er.BANK_COST_EFFECTIVENESS__c = newObj.get('BANK_COST_EFFECTIVENESS__c');
            }
            if(newObj.containskey('BANK_YIELD__c')){
                er.BANK_YIELD__c = newObj.get('BANK_YIELD__c');
            }
            if(newObj.containskey('BORROW_ACCESS_TO_LIQUIDITY__c')){
                er.BORROW_ACCESS_TO_LIQUIDITY__c = newObj.get('BORROW_ACCESS_TO_LIQUIDITY__c');
            }
            if(newObj.containskey('BORROW_CREDIT_CARDS__c')){
                er.BORROW_CREDIT_CARDS__c = newObj.get('BORROW_CREDIT_CARDS__c');
            }
            if(newObj.containskey('BORROW_DEBT_RESTRUCTURE__c')){
                er.BORROW_DEBT_RESTRUCTURE__c = newObj.get('BORROW_DEBT_RESTRUCTURE__c');
            }
            if(newObj.containskey('PLAN_EMERGENCY_FUND__c')){
                er.PLAN_EMERGENCY_FUND__c = newObj.get('PLAN_EMERGENCY_FUND__c');
            }
            if(newObj.containskey('PLAN_MAJOR_PURCHASES__c')){
                er.PLAN_MAJOR_PURCHASES__c = newObj.get('PLAN_MAJOR_PURCHASES__c');
            }
            if(newObj.containskey('PLAN_RETIREMENT__c')){
                er.PLAN_RETIREMENT__c = newObj.get('PLAN_RETIREMENT__c');
            }
            if(newObj.containskey('PROTECT_ACCOUNT_PROTECTION__c')){
                er.PROTECT_ACCOUNT_PROTECTION__c = newObj.get('PROTECT_ACCOUNT_PROTECTION__c');
            }
            if(newObj.containskey('PROTECT_ESTATE_PLANNING__c')){
                er.PROTECT_ESTATE_PLANNING__c = newObj.get('PROTECT_ESTATE_PLANNING__c');
            }
            if(newObj.containskey('PROTECT_INSURANCE_COVERAGES__c')){
                er.PROTECT_INSURANCE_COVERAGES__c = newObj.get('PROTECT_INSURANCE_COVERAGES__c');
            }  
            er.Scores__c = newObj.get('score');
            er.Contact_Name__c = rec.id;
            String datee = system.now().format('yyyy-MM-dd HH:mm');
            er.Name = rec.Name + ' - ' + datee ;
            insert er;
            
        }
        else if(eFIR.size()<5){
            engageFI_Retail__c er = new engageFI_Retail__c();
            
            if(newObj.containskey('BANK_CONVENIENCE__c')){
                er.BANK_CONVENIENCE__c = newObj.get('BANK_CONVENIENCE__c');
            }
            if(newObj.containskey('BANK_COST_EFFECTIVENESS__c')){
                er.BANK_COST_EFFECTIVENESS__c = newObj.get('BANK_COST_EFFECTIVENESS__c');
            }
            if(newObj.containskey('BANK_YIELD__c')){
                er.BANK_YIELD__c = newObj.get('BANK_YIELD__c');
            }
            if(newObj.containskey('BORROW_ACCESS_TO_LIQUIDITY__c')){
                er.BORROW_ACCESS_TO_LIQUIDITY__c = newObj.get('BORROW_ACCESS_TO_LIQUIDITY__c');
            }
            if(newObj.containskey('BORROW_CREDIT_CARDS__c')){
                er.BORROW_CREDIT_CARDS__c = newObj.get('BORROW_CREDIT_CARDS__c');
            }
            if(newObj.containskey('BORROW_DEBT_RESTRUCTURE__c')){
                er.BORROW_DEBT_RESTRUCTURE__c = newObj.get('BORROW_DEBT_RESTRUCTURE__c');
            }
            if(newObj.containskey('PLAN_EMERGENCY_FUND__c')){
                er.PLAN_EMERGENCY_FUND__c = newObj.get('PLAN_EMERGENCY_FUND__c');
            }
            if(newObj.containskey('PLAN_MAJOR_PURCHASES__c')){
                er.PLAN_MAJOR_PURCHASES__c = newObj.get('PLAN_MAJOR_PURCHASES__c');
            }
            if(newObj.containskey('PLAN_RETIREMENT__c')){
                er.PLAN_RETIREMENT__c = newObj.get('PLAN_RETIREMENT__c');
            }
            if(newObj.containskey('PROTECT_ACCOUNT_PROTECTION__c')){
                er.PROTECT_ACCOUNT_PROTECTION__c = newObj.get('PROTECT_ACCOUNT_PROTECTION__c');
            }
            if(newObj.containskey('PROTECT_ESTATE_PLANNING__c')){
                er.PROTECT_ESTATE_PLANNING__c = newObj.get('PROTECT_ESTATE_PLANNING__c');
            }
            if(newObj.containskey('PROTECT_INSURANCE_COVERAGES__c')){
                er.PROTECT_INSURANCE_COVERAGES__c = newObj.get('PROTECT_INSURANCE_COVERAGES__c');
            }  
            er.Scores__c = newObj.get('score');
            er.Contact_Name__c = rec.id;
            String datee = system.now().format('yyyy-MM-dd HH:mm');
            er.Name = rec.Name + ' - ' + datee ;
            insert er;
        }
        /****************/
        System.debug('ContactId' + ContactId);
        insert oplist;
        system.debug('oplist '+oplist);
        return oplist;
    }
    
    @AuraEnabled
    public static map<Id,engageFI_Retail__c > fetchEngageFIRetailRecentRecord(ID ContactIdd){
        System.debug('ContactIdd------'+ContactIdd);
        map<Id,engageFI_Retail__c > RecordMap = new Map<id,engageFI_Retail__c >();
        
        list<engageFI_Retail__c> eFIRRelatedRecord =  [SELECT id , Name ,BANK_CONVENIENCE__c,BANK_COST_EFFECTIVENESS__c,BANK_YIELD__c,
                                                       BORROW_ACCESS_TO_LIQUIDITY__c ,BORROW_CREDIT_CARDS__c,BORROW_DEBT_RESTRUCTURE__c,
                                                       PLAN_EMERGENCY_FUND__c,PLAN_MAJOR_PURCHASES__c,PLAN_RETIREMENT__c,
                                                       PROTECT_ACCOUNT_PROTECTION__c,PROTECT_ESTATE_PLANNING__c,PROTECT_INSURANCE_COVERAGES__c,
                                                       Scores__c,
                                                       Contact_Name__c,CreatedDate from engageFI_Retail__c where Contact_Name__c =: ContactIdd order by createdDate DESC limit 1];
        for(engageFI_Retail__c  RE : eFIRRelatedRecord ){
            RecordMap.put(Re.Id,Re);
            system.Debug('***'+RecordMap.values());
        }
        
        return RecordMap;
    }
    
}
public class OpportunityFetchField {
    
    @AuraEnabled
    public static list<Opportunity> insertOpportunity(list<Opportunity> oplist, ID ContactId){
        Contact rec = [SELECT ID ,Name from Contact where ID =: ContactId];
        system.debug('rec '+rec);
        system.debug('oplist '+oplist);
        for(Opportunity op :oplist){
            op.ContactId = rec.Id;
            op.StageName='Needs Analysis';
        }
        System.debug('ContactId' + ContactId);
        insert oplist;
        system.debug('oplist '+oplist);
        return oplist;
    }    
}
I have 2 slds box , In one I have 3 tect values now I want to drag 2 of them into second slds box and then have to save those two values into two different fields of the opportunity object.

[It is working fine till drag and drop onto another slds box now i want to save those 2 values into Opportunity object's 2 different fields.]

Here si my code 
Aura Component:-

<aura:component implements="force:appHostable">
    <aura:attribute name="startId" type="string"/>
    <aura:attribute name="parentId" type="string"/>
    
    <div class="slds-box" id="div1" ondrop="{!c.drop}" ondragover="{!c.allowDrop}">
        <h2 draggable="true" ondragstart="{!c.drag}" id="drag1" width="88" height="31"> Hiii</h2>
        <h2 draggable="true" ondragstart="{!c.drag}" id="drag2" width="88" height="31"> Hello</h2>
        <h2 draggable="true" ondragstart="{!c.drag}" id="drag3" width="88" height="31"> Hello There</h2>
        
    </div>
    
    
    
    <div class="slds-box" id="div3" ondrop="{!c.drop}" ondragover="{!c.allowDrop}"><span id="drag3"> </span></div>
    
</aura:component>
********************************************************************************************************
JS Controller :-

({
    allowDrop: function(cmp, event, helper){
        event.preventDefault();
    },
    drag: function(cmp, ev, helper){
          var parentId = document.getElementById(ev.target.id).parentElement.id;
       cmp.set("v.startId",ev.target.id);
       cmp.set("v.parentId",parentId);
    },
    drop: function(cmp, ev, helper){
        var drag = cmp.get("v.startId");
        var div = ev.target.id;
        alert(div);
        var fragment = document.createDocumentFragment();
        alert(fragment);
        fragment.appendChild(document.getElementById(drag));
        document.getElementById(div).appendChild(fragment);
        var c = document.getElementById(div).children;
        var x = document.getElementById('drag1').parentElement.id;
        var fragment = document.createDocumentFragment();
        fragment.appendChild(document.getElementById(c[0].id));
        document.getElementById(cmp.get("v.parentId")).appendChild(fragment);
    }
})
I am creating a lightning component where i have to I have iterated over list of Radio button results with label.

Now what i want to do is to Have a drag and drop functionality on those selected results from where i only want to choose only 5 of those 12 radio results , and then save those 5 into  5 different text fields of an object.

Here is my aura component code:-

<aura:component controller="OpportunityFetchField">
    <aura:attribute name="newOpportunity" type="Opportunity"
                    default="{ 'sobjectType': 'Opportunity',
                             'Name': '',
                             'StageName' :'',
                             'CloseDate' : '',
                             'Priority_1__c' :'',
                             'Priority_2__c' : '',
                             'Priority_Date_1__c' : '',
                             'Priority_Date_1__c' : ''
                             }"/>
    <aura:attribute name="stageList" type="List"/>
    <aura:attribute name="objName" type="String" default="Opportunity"/>
    <aura:attribute name="fldName" type="String" default="StageName"/>
    <aura:attribute name="today" type="Date" default=""/>
    <aura:attribute name="listOne" type="List" default="['CONVENIENCE','COST-EFFECTIVENESS', 'YIELD']"/>
    <aura:attribute name="listTwo" type="List" default="['CREDIT CARDS','DEBT RESTRUCTURE', 'ACCESS TO LIQUIDITY']"/>
    <aura:attribute name="listThree" type="List" default="['EMERGENCY FUND','MAJOR PURCHASES ', 'RETIREMENT']"/>
    <aura:attribute name="listFour" type="List" default="['ACCOUNT PROTECTION','INSURANCE COVERAGES', 'ESTATE PLANNING']"/>
    
    <aura:attribute name="selectedList" type="List"/>    
    <aura:attribute name="buttonSelected" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    
    <div class="slds-page-header">
        <!-- COMPANY LOGO -->
    </div>
    
    <div class="tab">
        <div class="slds-col slds-size_1-of-12">
            
            <div><lightning:button variant="{!v.buttonSelected == 'A' ? 'brand':'neutral'}" label="BANK" name="A" onclick="{!c.buttonHandler}"/> </div>
            <div><lightning:button variant="{!v.buttonSelected == 'B' ? 'brand':'neutral'}" label="BORROW" name="B" onclick="{!c.buttonHandler}"/> </div>
            <div><lightning:button variant="{!v.buttonSelected == 'C' ? 'brand':'neutral'}" label="PLAN" name="C" onclick="{!c.buttonHandler}"/> </div>
            <div><lightning:button variant="{!v.buttonSelected == 'D' ? 'brand':'neutral'}" label="PROTECT" name="D" onclick="{!c.buttonHandler}"/> </div> 
            <div><lightning:button variant="{!v.buttonSelected == 'E' ? 'brand':'neutral'}" label="PRIORITIZE" name="E" onclick="{!c.buttonHandler}"/> </div>
            
        </div>
    </div>
    
    <div class="slds-col slds-size_3-of-12">
        <aura:if isTrue="{!v.buttonSelected == 'A'}">
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>Yes</th> 
                        <th>No</th>
                        <th>Don't Know</th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.listOne}" var="item">
                        <tr>
                            <td><strong>{!item}</strong></td>
                            
                            <td><input type="radio" name="{!item}" value="Yes"  onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="No"  onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="Don't Know"  onchange="{!c.radioHandler}"/></td>
                            
                        </tr>
                    </aura:iteration>
                    
                </tbody>
            </table>
        </aura:if>
        <aura:if isTrue="{!v.buttonSelected == 'B'}">
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>Yes</th> 
                        <th>No</th> 
                        <th>Don't Know</th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.listTwo}" var="item">
                        <tr>
                            <td><strong>{!item}</strong></td>
                            <td><input type="radio" name="{!item}" value="Yes" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="No" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="Don't Know" onchange="{!c.radioHandler}"/></td> 
                        </tr>
                    </aura:iteration>
                </tbody>
            </table>
        </aura:if>
        <aura:if isTrue="{!v.buttonSelected == 'C'}">
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>Yes</th> 
                        <th>No</th>
                        <th>Don't Know</th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.listThree}" var="item">
                        <tr>
                            <td><strong>{!item}</strong></td>
                            <td><input type="radio" name="{!item}" value="Yes" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="No" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="Don't Know" onchange="{!c.radioHandler}"/></td> 
                        </tr>
                    </aura:iteration>
                </tbody>
            </table>
        </aura:if>
        
        <aura:if isTrue="{!v.buttonSelected == 'D'}">
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>Yes</th> 
                        <th>No</th> 
                        <th>Don't Know</th>
                    </tr>
                </thead>
                <tbody>
                    <aura:iteration items="{!v.listFour}" var="item">
                        <tr>
                            <td><strong>{!item}</strong></td>
                            <td><input type="radio" name="{!item}" value="Yes" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="No" onchange="{!c.radioHandler}"/></td>
                            <td><input type="radio" name="{!item}" value="Don't Know" onchange="{!c.radioHandler}"/></td>  
                        </tr>
                    </aura:iteration>
                </tbody>
            </table>
        </aura:if>
    </div>
    
    
    <!--  Here is the code of Iterated values of All Radio Buttons  -->    
    <aura:if isTrue="{!v.buttonSelected == 'E'}">  
        <div class="sourcebox">
            
            <h3><strong>PRIORITIZE</strong></h3> <br></br><br></br>
            
            <aura:iteration items="{!v.selectedList}" var="item">
                <div  ondragstart="{!c.dragStart}" ondragover="{!c.allowDrop}" draggable="true" id="drag1">  
                    {!item.label} - {!item.value}
                </div>
                <br></br>
            </aura:iteration>
        </div>

*****************************************************************************************
JS Controller:-
  
    dragStart : function(component, event, helper){
        // console.log(event.target.id);
        // event.currentTarget.style.border = "dashed";
        event.dataTransfer.setData("text", event.target.id);
    },
    allowDrop : function(component, event, helper){
        event.preventDefault();
    },
    OnNewDrop : function(component, event, helper){
        var data = event.dataTransfer.getData("text");
        alert(data);
        // var texteSelectionne = document.createTextNode(data);
        // event.target.appendChild(texteSelectionne);
        
        event.target.appendChild(document.getElementById(data));
        event.dataTransfer.clearData();
        
    }
Here is the scenario where I am seeking help from our community,

I have 10 radio group buttons now then what i need to do is on a click of a perticular button lets say 'SHOW RESULT' all the results should be shown of above all 10 radio groups WITH THEIR LABELS (eg. = Do you use credit card - Yes) that way. then on all those 10 results i want to create a drag and drop where i can only choose 5 of them. Then i need to save all these 5 into our lead object fileds.

Please help me out.
Thanks in advance

[I have done till creating radio groups and storing them into a list and theniterated over the list]
 
TASK : I want to send the recordId of the updated Opportunity record whenever it is updated. I want to send it to external web service , my code is working and fulfilling my requirement but have a look at it once. 

I first got the updated Opportunity recirdId from trigger then I called my first callout where I got the 'Token' , and then I called the secod method where I send the recordId.


Please examine this code. Thanks in advance 

public class OpportunityToBeSent {
    @future (callout=true)
    public static void makePostCallout(String recId) {
        String token; 
        //        System.debug('recorddIdd' + recorddIdd);
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXXXXXX/authenticate');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        // Set the body as a JSON object
        request.setBody('{"email": "XXXXX@XXXX.com","password": "XXXXXX"}');
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            Map<String, Object> m2 = (Map<String, Object>) results.get('data');
            System.debug('results'+ m2.get('jwtToken'));
            token = (string)m2.get('jwtToken');
            System.debug('token '+ token);
        }
        makePostCalloutt(recId , token);
        
    }
    
    
    public static void makePostCalloutt(String recId , String tokenn) {
        System.debug('Token >>>'+ tokenn);
      
        String body = recId;
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        
        request.setEndpoint('https://XXXXXXXXXXXXXXXX?id='+ body);
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text');
        request.setHeader( 'token', 'Bearer ' + tokenn );
        // Set the body as a JSON object
        request.setBody(body);
        System.debug('request'+ request);
        HttpResponse response = http.send(request);
        System.debug('response'+ response);
        // Parse the JSON response
        if (response.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
                         response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
        
    }    
}
I want to send the ID of the opportunity record just got updated to the external web service. How can I do it please help me . Thanks
public class OpportunityFetchField {
    
    @AuraEnabled
    public static list<Opportunity> insertOpportunity(list<Opportunity> oplist, ID ContactId, map<string, string> newObj){
        Contact rec = [SELECT ID ,Name from Contact where ID =: ContactId];
        system.debug('rec '+rec);
        system.debug('oplist '+oplist);
        system.debug('newObj '+newObj);
        for(Opportunity op :oplist){
            op.ContactId = rec.Id;
            op.StageName='Needs Analysis';
        }
        // op.Name= rec.Name;
        //op.CloseDate = Date.today();
        ///***************/
        Integer numberOfRelatedRecords = 0;
        //  Integer SessionNumber = 0;
        List<engageFI_Retail__c> eFIR = [SELECT ID , Name from engageFI_Retail__c where Contact_Name__c =: ContactId];
        System.debug('engageFI_Retail__c---->'+ eFIR);
        System.debug('Size------>'+ eFIR.size());

        
        if(eFIR.size()==5){
            /*----------------------------------------*/
            engageFI_Retail__c eFIRR =  [SELECT id , Name ,Contact_Name__c from engageFI_Retail__c where Contact_Name__c =: ContactId order by createdDate ASC limit 1];
            System.debug('eFIRR--------------'+eFIRR);
            delete eFIRR;
            /*-----------------------------------------*/
            engageFI_Retail__c er = new engageFI_Retail__c();
            
            if(newObj.containskey('BANK_CONVENIENCE__c')){
                er.BANK_CONVENIENCE__c = newObj.get('BANK_CONVENIENCE__c');
            }
            if(newObj.containskey('BANK_COST_EFFECTIVENESS__c')){
                er.BANK_COST_EFFECTIVENESS__c = newObj.get('BANK_COST_EFFECTIVENESS__c');
            }
            if(newObj.containskey('BANK_YIELD__c')){
                er.BANK_YIELD__c = newObj.get('BANK_YIELD__c');
            }
            if(newObj.containskey('BORROW_ACCESS_TO_LIQUIDITY__c')){
                er.BORROW_ACCESS_TO_LIQUIDITY__c = newObj.get('BORROW_ACCESS_TO_LIQUIDITY__c');
            }
            if(newObj.containskey('BORROW_CREDIT_CARDS__c')){
                er.BORROW_CREDIT_CARDS__c = newObj.get('BORROW_CREDIT_CARDS__c');
            }
            if(newObj.containskey('BORROW_DEBT_RESTRUCTURE__c')){
                er.BORROW_DEBT_RESTRUCTURE__c = newObj.get('BORROW_DEBT_RESTRUCTURE__c');
            }
            if(newObj.containskey('PLAN_EMERGENCY_FUND__c')){
                er.PLAN_EMERGENCY_FUND__c = newObj.get('PLAN_EMERGENCY_FUND__c');
            }
            if(newObj.containskey('PLAN_MAJOR_PURCHASES__c')){
                er.PLAN_MAJOR_PURCHASES__c = newObj.get('PLAN_MAJOR_PURCHASES__c');
            }
            if(newObj.containskey('PLAN_RETIREMENT__c')){
                er.PLAN_RETIREMENT__c = newObj.get('PLAN_RETIREMENT__c');
            }
            if(newObj.containskey('PROTECT_ACCOUNT_PROTECTION__c')){
                er.PROTECT_ACCOUNT_PROTECTION__c = newObj.get('PROTECT_ACCOUNT_PROTECTION__c');
            }
            if(newObj.containskey('PROTECT_ESTATE_PLANNING__c')){
                er.PROTECT_ESTATE_PLANNING__c = newObj.get('PROTECT_ESTATE_PLANNING__c');
            }
            if(newObj.containskey('PROTECT_INSURANCE_COVERAGES__c')){
                er.PROTECT_INSURANCE_COVERAGES__c = newObj.get('PROTECT_INSURANCE_COVERAGES__c');
            }  
            er.Scores__c = newObj.get('score');
            er.Contact_Name__c = rec.id;
            String datee = system.now().format('yyyy-MM-dd HH:mm');
            er.Name = rec.Name + ' - ' + datee ;
            insert er;
            
        }
        else if(eFIR.size()<5){
            engageFI_Retail__c er = new engageFI_Retail__c();
            
            if(newObj.containskey('BANK_CONVENIENCE__c')){
                er.BANK_CONVENIENCE__c = newObj.get('BANK_CONVENIENCE__c');
            }
            if(newObj.containskey('BANK_COST_EFFECTIVENESS__c')){
                er.BANK_COST_EFFECTIVENESS__c = newObj.get('BANK_COST_EFFECTIVENESS__c');
            }
            if(newObj.containskey('BANK_YIELD__c')){
                er.BANK_YIELD__c = newObj.get('BANK_YIELD__c');
            }
            if(newObj.containskey('BORROW_ACCESS_TO_LIQUIDITY__c')){
                er.BORROW_ACCESS_TO_LIQUIDITY__c = newObj.get('BORROW_ACCESS_TO_LIQUIDITY__c');
            }
            if(newObj.containskey('BORROW_CREDIT_CARDS__c')){
                er.BORROW_CREDIT_CARDS__c = newObj.get('BORROW_CREDIT_CARDS__c');
            }
            if(newObj.containskey('BORROW_DEBT_RESTRUCTURE__c')){
                er.BORROW_DEBT_RESTRUCTURE__c = newObj.get('BORROW_DEBT_RESTRUCTURE__c');
            }
            if(newObj.containskey('PLAN_EMERGENCY_FUND__c')){
                er.PLAN_EMERGENCY_FUND__c = newObj.get('PLAN_EMERGENCY_FUND__c');
            }
            if(newObj.containskey('PLAN_MAJOR_PURCHASES__c')){
                er.PLAN_MAJOR_PURCHASES__c = newObj.get('PLAN_MAJOR_PURCHASES__c');
            }
            if(newObj.containskey('PLAN_RETIREMENT__c')){
                er.PLAN_RETIREMENT__c = newObj.get('PLAN_RETIREMENT__c');
            }
            if(newObj.containskey('PROTECT_ACCOUNT_PROTECTION__c')){
                er.PROTECT_ACCOUNT_PROTECTION__c = newObj.get('PROTECT_ACCOUNT_PROTECTION__c');
            }
            if(newObj.containskey('PROTECT_ESTATE_PLANNING__c')){
                er.PROTECT_ESTATE_PLANNING__c = newObj.get('PROTECT_ESTATE_PLANNING__c');
            }
            if(newObj.containskey('PROTECT_INSURANCE_COVERAGES__c')){
                er.PROTECT_INSURANCE_COVERAGES__c = newObj.get('PROTECT_INSURANCE_COVERAGES__c');
            }  
            er.Scores__c = newObj.get('score');
            er.Contact_Name__c = rec.id;
            String datee = system.now().format('yyyy-MM-dd HH:mm');
            er.Name = rec.Name + ' - ' + datee ;
            insert er;
        }
        /****************/
        System.debug('ContactId' + ContactId);
        insert oplist;
        system.debug('oplist '+oplist);
        return oplist;
    }
    
    @AuraEnabled
    public static map<Id,engageFI_Retail__c > fetchEngageFIRetailRecentRecord(ID ContactIdd){
        System.debug('ContactIdd------'+ContactIdd);
        map<Id,engageFI_Retail__c > RecordMap = new Map<id,engageFI_Retail__c >();
        
        list<engageFI_Retail__c> eFIRRelatedRecord =  [SELECT id , Name ,BANK_CONVENIENCE__c,BANK_COST_EFFECTIVENESS__c,BANK_YIELD__c,
                                                       BORROW_ACCESS_TO_LIQUIDITY__c ,BORROW_CREDIT_CARDS__c,BORROW_DEBT_RESTRUCTURE__c,
                                                       PLAN_EMERGENCY_FUND__c,PLAN_MAJOR_PURCHASES__c,PLAN_RETIREMENT__c,
                                                       PROTECT_ACCOUNT_PROTECTION__c,PROTECT_ESTATE_PLANNING__c,PROTECT_INSURANCE_COVERAGES__c,
                                                       Scores__c,
                                                       Contact_Name__c,CreatedDate from engageFI_Retail__c where Contact_Name__c =: ContactIdd order by createdDate DESC limit 1];
        for(engageFI_Retail__c  RE : eFIRRelatedRecord ){
            RecordMap.put(Re.Id,Re);
            system.Debug('***'+RecordMap.values());
        }
        
        return RecordMap;
    }
    
}
Here is the scenario where I am seeking help from our community,

I have 10 radio group buttons now then what i need to do is on a click of a perticular button lets say 'SHOW RESULT' all the results should be shown of above all 10 radio groups WITH THEIR LABELS (eg. = Do you use credit card - Yes) that way. then on all those 10 results i want to create a drag and drop where i can only choose 5 of them. Then i need to save all these 5 into our lead object fileds.

Please help me out.
Thanks in advance

[I have done till creating radio groups and storing them into a list and theniterated over the list]