• Radhika Pawar 12
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
Hi All,

I am receving the velow error when record submitted via web form. this functionality developed using web-lead .
Error:
Access to XMLHttpRequest at 'https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8' from origin 
'https://author-uat.aem.avi.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

Web-Lead Form:
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type=hidden name="oid" value="1198D1x111118glX">
<input type=hidden name="retURL" value="https://google.com">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="pawar.radhika@avivainvestors.com">                               -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" Required/><br>

<label for="email">Email</label><!--<input  id="email" maxlength="80" name="email" size="20" type="text" Required/><br>-->
<input id="email" name="email" type="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /><br>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" Required/><br>
<input type="submit" name="submit">

</form>

 
**My component:**
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="sampleFundController">
    <!-- init aura:handler action[doInit] auto call on component load -->  
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <!-- 1."ChildRecordList" attibute store the list of child record. --> 
    <aura:attribute name="ChildRecordList" type="List" />    
    <!--Use a data table from the Lightning Design System:
    https://www.lightningdesignsystem.com/components/data-tables/ -->
    <aura:attribute name="ShowHidecancle" type="boolean" default="false"/>
    <aura:attribute name="ShowHideSave" type="boolean" default="false"/> 
    <aura:handler event="force:refreshView" action="{!c.isRefreshed}" />

    <lightning:notificationsLibrary aura:id="notifLib"/>    
    <div class="slds-m-around--x-small"> 
        <table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
            <thead>
                <tr class="slds-text-heading--label">
                    <th scope="col">
                        <div class="slds-truncate" title="Name">Name</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Email">Email</div>
                    </th>                    
                </tr>
            </thead> 
            <tbody>
               <!-- Iterate all child record list in table format -->  
                <aura:iteration items="{!v.ChildRecordList}" var="rec">
                    <tr>
                        <td>
                            <div class="slds-truncate" title="{!rec.Name}">{!rec.Name}</div>
                            
                        </td>
                        <td>
                            <div class="slds-truncate" title="{!rec.Publication_2__c}">
                                <lightning:input type="checkbox" variant="label-hidden" checked="{!rec.Publication_1__c}"  aura:id="AC_GFI"/>
                            </div>
                            </td>                        
                    </tr>
                </aura:iteration>
            </tbody>
        </table>        
        <div class="slds-col modal-footer slds-modal__footer">
            <center>
                <button class="slds-button slds-button--neutral uiButton--default uiButton--default uiButton" type="button">
                    <lightning:button variant="neutral" label="Cancel" onclick="{! c.handleCancel }" />
                </button>
                <button class="slds-button slds-button--neutral uiButton--default uiButton--brand uiButton" type="button">
                     <lightning:button variant="brand" label="Save" onclick="{!c.handleSave}" />
                 </button>                
                </center>
        </div>        
    </div>    
</aura:component>

 
**JScontroller:**

      ({
        doInit : function(component, event, helper) {    
            helper.getfunds(component, helper);
        },
        handleSave : function(component, event, helper) {
            helper.saveHandler(component, event, helper);
        },
        
        handleCancel: function(component, event, helper) {
         //$A.get("e.force:closeQuickAction").fire();
               helper.getfunds(component, helper);
             
        },    
        
       })

**JsHelper:**

       ({
        getfunds : function(component, event, helper) {
            var action = component.get("c.getfunds");
            console.log("action**"+action);
            var editedRecords =  component.get("v.recordId");
            console.log("editedRecords**"+editedRecords);
            action.setParams({
                'fundId' : editedRecords
            });
            action.setCallback(this,function(response) {
                var state = response.getState();
                console.log("state**"+state);
                if (state === "SUCCESS") {
                    console.log("length*RAD**"+response.getReturnValue().length);
                    console.log("state**"+response.getReturnValue());
                    component.set("v.ChildRecordList", response.getReturnValue());
                    $A.get('e.force:refreshView').fire();
                }
            });
            $A.enqueueAction(action);
          },
    
        saveHandler : function(component, event, helper) { 
        alert("Record Already exists.");    
        //component.set("v.showSpinner", true);         
        var action = component.get("c.updateFunds");
        console.log("action**"+action);
        var editedRecords =  component.get("v.ChildRecordList");
        console.log("editedRecords**"+editedRecords);
        action.setParams({
            'editedfundList' : editedRecords
        });
        action.setCallback(this,function(response) {
             
            var state = response.getState();
            console.log("state**"+state);
            var result = response.getReturnValue();
            console.log("result**"+result);
            if (state === "SUCCESS") {                
                console.log("length*RAD**"+response.getReturnValue().length);
                console.log("response**"+response.getReturnValue());
                component.set("v.ShowHideSave", true);
              
              
              var showToast = $A.get("e.force:showToast"); 
                        showToast.setParams({ 
                            'title' : 'Success!',
                            'type': 'success',
                            'message' : "The record has been updated successfully." 
                        }); 
                        showToast.fire(); 
                $A.get('e.force:refreshView').fire();               
                 
            }else{
                console.log("Error**");
            }
        });
        
    
        $A.enqueueAction(action);
      },
    })
Hi All,

what type of integration I can use for when record is created on the website it automatically pushes it into Salesforce.

Could you please provide me any study material for this scenario.
Thanks in advanced.
 
I have two lists which are populated by REST Response.First list is List<Business> Abc and second is List<Sales> xyz.
1)List<Busiess> Abc have below parameters
-AccountNumber
-BusinessStatus
-BusinessDescrib
2)List<Sales> xyz have below parameters:
-AccountNumber
-salesStatus
-salesDesc

AccountNumber is a common value in Both list.

I want to display the single table with account number and Its repective parameters from both lists (BusinessStatus,BusinessDescrib,salesStatus and salesDesc)
 
I want to make user mandatorily click on a particular button which is displayed on VF page. I want to throw an alert message if the user leaves the page or closes the tab or browser or URl is changed?
Hi All,

what type of integration I can use for when record is created on the website it automatically pushes it into Salesforce.

Could you please provide me any study material for this scenario.
Thanks in advanced.
 
I have two lists which are populated by REST Response.First list is List<Business> Abc and second is List<Sales> xyz.
1)List<Busiess> Abc have below parameters
-AccountNumber
-BusinessStatus
-BusinessDescrib
2)List<Sales> xyz have below parameters:
-AccountNumber
-salesStatus
-salesDesc

AccountNumber is a common value in Both list.

I want to display the single table with account number and Its repective parameters from both lists (BusinessStatus,BusinessDescrib,salesStatus and salesDesc)