Apex Code: public without sharing class CampAttendee { @AuraEnabled public static Camp_Attendee__c createCampAttendee(Camp_Attendee__c CampAttendee, String recordType){ System.debug('campattendee:'+ campattendee); System.debug('recordType:'+ recordType); campattendee.RecordTypeId = [SELECT Id from RecordType WHERE DeveloperName=:recordType].Id; campattendee.Submission_Date__c = date.TODAY(); CODE } } campattendee.Camp_Attendees_Gender__c = Gender; campattendee.Camp_Attendees_Pronoun__c = camperPronoun; campattendee.Camp_Attendees_Dietary_Needs__c = diet; campattendee.Related_how_In_Order_of_1__c = related; campattendee.Related_how_In_Order_of_2__c = related1; campattendee.Related_how_In_Order_of_3__c = related2; campattendee.Related_how_In_Order_of_4__c = related3; insert campattendee; return campattendee; } } Aura Bundle: CampAttendeeDetails.cmp -->
CAMP REGISTRANT DETAILS
CODE
Submit all details pertaining to the camper

Camper Details have been submitted:

{!v.FirstName}

CONTROLLER .js ({ fieldChange : function(component, event, helper) { console.log(event.getSource().getLocalId()); var attr = event.getSource().getLocalId(); var value = component.find(attr).get(\"v.value\"); component.getEvent(\"campattendeeFieldChange\").setParams({ data: {[attr] : value}}).fire(); }, runValidation : function(cmp, event, helper) { var campattendee = cmp.find(\"campattendee\"); var campattendeeBool; if (!campattendee.get(\"v.value\")) { //campattendee.set(\"v.errors\",  [{messageWhenValueMissing:\"Enter\"}]); campattendee.showHelpMessageIfInvalid(); campattendeeBool = false; } else { campattendeeBool = true; } return cmp.find('field').reduce(function(validSoFar, inputCmp) { inputCmp.showHelpMessageIfInvalid(); return campattendeeBool && validSoFar && inputCmp.get('v.validity').valid; }); } })", "answerCount": 1, "upvoteCount": 0, "datePublished": "2024-03-11T14:45:04.000Z", "author": { "@type": "Person", "name": "Lori Buchowicz", "url": "https://trailblazers.salesforce.com/profileView?u=0054V00000GM4ubQAD", "affiliation": { "@type": "Organization", "name": "Griffin Museum of Science and Industry" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi, Sorry for the inconvenience. If you don't receive a response here, we recommend reaching out to our support team for further assistance. You can do so by visiting https://help.salesforce.com/s/articleView?id=000393090&language=en_US&type=1", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007YwLSrSAN", "datePublished": "2024-03-14T11:12:20.000Z", "author": { "@type": "Person", "name": "Kermit Del Rosario", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000DbcGYQAZ", "affiliation": { "@type": "Organization", "name": "N/A" } } } ] } } Skip to main content

I have written similar code previously, and with my new company writing a Guest User facing page to enter camper details once an event registration has been purchased.  This time along, while creating this and validating Guest Site access I am not pulling any content - upon inspect this is the error message returning:  ComponentProfiler: Component-level profiling has not been enabled because "componentProfiler.instrumentation.ltng" gate is not open.  Without exceeding characters - omitted /replaced Code with the work CODE.  No external calls, this soley writes to Camp Attendee Object and had 0 errors in any of my code.  Any suggestions, workarounds, or assistance helpful

 

 Elements to this code:

 Site - https://msichicago--campsf.sandbox.my.salesforce-sites.com/campattendee

 Active Site Home Page CampParticipant

 Guest Site User Access

 VFP-  CampParticipant

 Code:  <apex:page standardStylesheets="false" applyBodyTag="false" showHeader="false">

     <apex:includeLightning />

     <style>

         html, body {

         margin: 0;

         padding: 0;

         }

          {

             width: 100%;

             margin: auto;

         }

         .slds-scope h1,.slds-scope h2,.slds-scope h3,.slds-scope h4,.slds-scope h5,.slds-scope h6,.slds-scope th,.slds-scope td {

             font-family: Arial;

         }

     </style>

     <div id="content">

         <div id="lightningComponent" />

     </div>

     <script>

         var myUserContext = "{!$User.UITheme}";

         // need to get service appt id for scheduler

         $Lightning.use("c:CampAttendee", function() {

             $Lightning.createComponent("c:CampAttendee",{ 'aura:id': 'campattendeeHeader', isExternal : 'true' },

                                         "lightningComponent");

         });

     </script>

    

 </apex:page>

 Apex Code:

 public without sharing class CampAttendee {

     @AuraEnabled

     public static Camp_Attendee__c

         createCampAttendee(Camp_Attendee__c CampAttendee, String recordType){

             System.debug('campattendee:'+ campattendee);

             System.debug('recordType:'+ recordType);

             campattendee.RecordTypeId = [SELECT Id from RecordType WHERE DeveloperName=:recordType].Id; 

 campattendee.Submission_Date__c = date.TODAY();

            

 CODE

             }

         }

     campattendee.Camp_Attendees_Gender__c = Gender;

     campattendee.Camp_Attendees_Pronoun__c = camperPronoun;

             campattendee.Camp_Attendees_Dietary_Needs__c = diet;

             campattendee.Related_how_In_Order_of_1__c = related;

                 campattendee.Related_how_In_Order_of_2__c = related1;

                 campattendee.Related_how_In_Order_of_3__c = related2;

                 campattendee.Related_how_In_Order_of_4__c = related3;

                 insert campattendee;

     return campattendee;

 }

 }

 Aura Bundle:

 CampAttendeeDetails.cmp

 <aura:component controller="CampAttendee">

     <aura:attribute name="campattendee" type="Object"/>

     <aura:attribute name="simpleRegistration" type="Camp_Attendee__c" default="{'sobjectType': 'Camp_Attendee__c'}"/>

     <aura:attribute name="newCampAttendeeEntryError" type="String"/>

     <aura:attribute name="pageStep" type="String" default="dataEntry"/>

     <aura:attribute name="isExternal" type="Boolean" default="false"/>

     <aura:attribute name="toastMsg" type="String" default="" />

     <aura:attribute name="toastType" type="String" default="" />

    

     <aura:registerEvent name="campattendeeFieldChange" type="c:CampAttendeeEvent"/>

     <aura:method name="runValidation" action="{!c.runValidation}" access="PUBLIC"/>

     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>   

        

     <div class="slds-col slds-size_1-of-12">

     <div class="slds-text-align_right slds-p-around_small slds-float_right">

     <a href="https://www.msichicago.org/">

             </a>

         </div>

     </div> -->

                 <div class="slds-col slds-size_1-of-1 slds-p-around_medium">

                         <div class="slds-text-heading_large">

                             <u>

                                 CAMP REGISTRANT DETAILS

                             </u>

                         </div>       

        

     <div class="slds-col slds-size_1-of_1"/>

     <div class="slds-form slds-form_element">

         <div class="slds-form-element_control">

                 <lightning:input aura:id="field" label="Purchaser" required="true" value="{!v.campattendee.Purchaser__c}"/>

 CODE

     </div>

         </div>

     Submit all details pertaining to the camper

     <lightning:button name="submit" label="Submit your campers details" title="Camper details" onclick="{!c.Submit}"/>

 <aura:if isTrue="{!v.FirstName}">

         <lightning:card title="Camper details">

             <p class="slds-p-horizontal--small">

                 Camper Details have been submitted:

                 <p>{!v.FirstName}</p>

             </p>

         </lightning:card>

     </aura:if>

 </aura:component>

 CONTROLLER

 .js

 ({

 fieldChange : function(component, event, helper) {

         console.log(event.getSource().getLocalId());

         var attr = event.getSource().getLocalId();

         var value = component.find(attr).get("v.value");

         component.getEvent("campattendeeFieldChange").setParams({ data: {[attr] : value}}).fire();

     },

     runValidation : function(cmp, event, helper) {

         var campattendee = cmp.find("campattendee");

         var campattendeeBool;

             if (!campattendee.get("v.value")) {

              //campattendee.set("v.errors",  [{messageWhenValueMissing:"Enter"}]);

                 campattendee.showHelpMessageIfInvalid();

                 campattendeeBool = false;

             }

         else {

             campattendeeBool = true;

         }

 return cmp.find('field').reduce(function(validSoFar, inputCmp) {

 inputCmp.showHelpMessageIfInvalid();

 return campattendeeBool && validSoFar && inputCmp.get('v.validity').valid;

         });

     }

 })

 

#Salesforce Developer@* Salesforce Developers *

1 risposta
0/9000