• Raghu Rao 12
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi 
I enabled DevHub on our NPSP production instance. I am trying to create a scratch org and try to push the NPSP pack in there. As per instructions, I am not able to capture the AppVID of the NPSP package since it redirects to the NPSP site. Please help in resolving this issue.
Hi 
I am capturing Last Name and Email on the parent component and then passing on the search results on to an embedded child Lightning Card component. Though it fetches the contact record(s) it does not display Lightning Card component (c:DisplayMembers) on the Lightning Tab. Below are the markup, controller and helper code.

Component Markup:
<aura:component implements="force:appHostable" controller="SearchDevoteeMember" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
   <aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact' }"/>
   <aura:attribute name="contacts" type="Contact[]"/>
    <aura:attribute name="contactList" type="Contact[]"/>
   <aura:attribute name="hasErrors" type="Boolean" description="Indicate whether there were failures or not" />
    <aura:attribute name="isVisible" type="boolean" default="false"/>

  

  <div class="slds-page-header" role="banner">
      <p class="slds-text-heading--label">Search Member</p>
   </div>
   <br/>

   <aura:if isTrue="{!v.hasErrors}">
      <!-- Load error -->
      <div class="userCreateError">
         <ui:message title="Error" severity="error" closable="true">
            Please review the error messages.
         </ui:message>
      </div>
   </aura:if>

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

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="lastName">Enter last name: </label>
         <div class="slds-form-element__control">
            <ui:inputText class="slds-input" aura:id="lastName" value="{!v.contact.lastname}" required="true" />
         </div>
      </div>

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="userEmail">Enter email:</label>
         <div class="slds-form-element__control">
            <ui:inputEmail class="slds-input" aura:id="userEmail" value="{!v.contact.Email}" required="true"/>
         </div>
      </div>

      <div class="slds-form-element">
         <ui:button class="slds-button slds-button--neutral" press="{!c.cancel}" label="Cancel" />
         <ui:button class="slds-button slds-button--brand" press="{!c.searchContacts}" label="Search Member" />
      </div>
   </div>
    <div>
   <!-- Iterate over the list of contacts and display them -->
   <aura:iteration var="contact" items="{!v.contactList}">
    <c:DisplayMembers contact="{!contact}"/>
</aura:iteration>
   </div>
</aura:component>

Controller JS:
({    
   doInit : function(component) {
    

   },
    
 
   searchContacts : function(component, event, helper) {
      var last = component.get("v.contact.lastname");
      var email = component.get("v.contact.Email");

         helper.searchContacts(component,last,email); 
        
       
   },
    
   cancel : function(component, event, helper) {
      $A.get("e.force:closeQuickAction").fire();
   }
})

Helper JS:
({
   searchContacts: function(component, last, email) {
      //Save the user and close the panel
      var action = component.get("c.getContacts");
         action.setParams({
            "LastName": last,
            "Email": email
         });

      action.setCallback(this, function(response) {
        // var response = a.getReturnValue();
         var state = response.getState();
         if(component.isValid() && state == "SUCCESS"){
            component.set("v.contacts", response.getReturnValue());
            component.set("v.contactList", response.getReturnValue());
            $A.get("e.force:closeQuickAction").fire();
            var toastEvent = $A.get("e.force:showToast");
            toastEvent.setParams({
                  "title": "Success!",
               "message": "Member Record(s) found!!"
            });
            toastEvent.fire();
            $A.get('e.force:refreshView').fire();
         } else if (state == "ERROR") {
            console.log('There was a problem and the state is: '+ action.getState());
         }
      });
      $A.enqueueAction(action);
      },

})

 
Hi 
I have incorporated a Javascriipt Credit Card reader. I am able to read in the credit care information from the reader into Javascript variables. However I am not able to map these variable values and display them in Visualforce page.
Here is the visualforce page and the apex controller snippets:
Controller Code:
public String getJSStart(){return '<script>document.write(';}
public String getJSEnd(){return ')</script>';}
public PageReference sendCardData () {
    if (Apexpages.currentPage().getParameters().containsKey('firstName')){
        String fn=Apexpages.currentPage().getParameters().get('firstName');
        String ln=Apexpages.currentPage().getParameters().get('lastName');
        
        CCName= fn+' '+ln;
        System.Debug('CCName is ::' + CCName);
        
    }//firstName
    if (Apexpages.currentPage().getParameters().containsKey('account')){
        CCNum=Apexpages.currentPage().getParameters().get('account');
        System.Debug('CCNum is ::' + CCNum);
    }//account
    if (Apexpages.currentPage().getParameters().containsKey('expMonth')){
        selectedExpMnth=Integer.ValueOf(Apexpages.currentPage().getParameters().get('expMonth'));
        System.Debug('selectedExpMnth is ::' + selectedExpMnth);
    }//expMonth
    if (Apexpages.currentPage().getParameters().containsKey('expYear')){
        selectedExpYr=Integer.ValueOf(Apexpages.currentPage().getParameters().get('expYear'));
        System.Debug('selectedExpYr is ::' + selectedExpYr);
    }//expMonth
return null;
}//sendCardData

Visualforce Page:
<apex:pageBlockSection title="Enter CREDIT CARD INFORMATION" columns="1" rendered="{!IF(CONTAINS(selectedPT,'Credit'),true,false)}"></apex:pageBlockSection>
<apex:pageBlockSection title="Enter CHECK INFORMATION" columns="1" rendered="{!IF(CONTAINS(selectedPT,'Check'),true,false)}"></apex:pageBlockSection>
<apex:actionFunction action="{!sendCardData}" name="CardInfo" rerender="CC">
  <apex:param name="firstName" value=""/>
  <apex:param name="lastName" value=""/>
  <apex:param name="account" value=""/>
  <apex:param name="expMonth" value=""/>
  <apex:param name="expYear" value=""/>
  <apex:param name="type" value=""/>  
</apex:actionFunction>
  
<apex:panelgrid id="CC" columns="4" rendered="{!IF(CONTAINS(selectedPT,'Credit'),true,false)}">
 <!-- rendered="{IF(!selectedPT == 'CREDIT CARD', true, false)}" -->
      <apex:outputLabel style="font-weight:bold;" value="Name as in Credit Card"></apex:outputLabel>
       <apex:inputText value="{!CCName}" id="lastName"/>
       <!-- required="{!IF(CONTAINS(selectedPT,'CREDIT'),true,false)}" -->
      <apex:outputLabel style="font-weight:bold;" value="Card Number (16 Digits):"></apex:outputLabel>
       <apex:inputText value="{!CCNum}" id="CRNUM" maxlength="19"/>
       <apex:outputText value="{!JSStart}account{!JSEnd}" escape="false"/>
       
      <apex:outputLabel style="font-weight:bold;" value="Card Exp Month : "></apex:outputLabel>
      <apex:selectList value="{!selectedExpMnth}" id="expMonth" multiselect="false" size="1">
           <apex:selectOptions value="{!TmplCEM}"/>
          <!--   <apex:actionSupport action="{!getPaymentFields}" event="" reRender="" />-->
      </apex:selectList> 
      <apex:outputLabel style="font-weight:bold;" value="Card Exp Year : "></apex:outputLabel>
     <apex:selectList value="{!selectedExpYr}" id="expYear" multiselect="false" size="1">
           <apex:selectOptions value="{!TmplCEYOptions}"/>
         <!--    <apex:actionSupport action="{!getPaymentFields}" event="" reRender="" />-->
      </apex:selectList>    
     <apex:outputLabel style="font-weight:bold;" value="3 Digit Card CVC Code"></apex:outputLabel>
       <apex:inputText value="{!CCCVC}" maxlength="3"/>
 </apex:panelgrid> 
<script type="text/javascript">

        // Called by plugin on a successful scan.
        var complete = function (data) {

            // Is it a payment card?
            if (data.type == "generic")
                return;

            // Copy data fields to form
            //$("#firstName").val(data.firstName);
            //document.getElementById("lastName").value = data.firstName+" "+data.lastName;
            //$("#lastName").val(data.lastName);
            //$("#fullName").val(data.fullName);
            //$("#account").val(data.account);
            //$("#expMonth").val(data.expMonth);
            //$("#expYear").val(data.expYear);
            //$("#type").val(data.type);
            //var lastName=data.lastName;
            
            var firstName=data.firstName;
            var lastName=data.lastName;
            var account=data.account;
            var expMonth=data.expMonth;
            var expYear=data.expYear;
            var type=data.type;
            document.getElementById('{!$Component.thepage.theform.CC.CRNUM}').value = account;
            //document.write("You have entered credit card number:"+ account);
            
            //document.getElementById("expMonth").value = expMonth;
            
            //document.getElementById("expYear").value = expYear;
            
            function sendCardData(){
            CardInfo(firstName,lastName,account,expMonth,expYear,type);
            }
            

        };

        // Event handler for scanstart.cardswipe.
        var scanstart = function () {
            $("#overlay").fadeIn(200);
        };

        // Event handler for scanend.cardswipe.
        var scanend = function () {
            $("#overlay").fadeOut(200);
        };

        // Event handler for success.cardswipe.  Displays returned data in a dialog
        var success = function (event, data) {

            $("#properties").empty();

            // Iterate properties of parsed data
            for (var key in data) {
                if (data.hasOwnProperty(key)) {
                    var text = key + ': ' + data[key];
                    $("#properties").append('<div class="property">' + text + '</div>');
                }
            }


            $("#success").fadeIn().delay(3000).fadeOut();
        }

        var failure = function () {
            $("#failure").fadeIn().delay(1000).fadeOut();
        }

        // Initialize the plugin with default parser and callbacks.
        //
        // Set debug to true to watch the characters get captured and the state machine transitions
        // in the javascript console. This requires a browser that supports the console.log function.
        //
        // Set firstLineOnly to true to invoke the parser after scanning the first line. This will speed up the
        // time from the start of the scan to invoking your success callback.
        $.cardswipe({
            firstLineOnly: true,
            success: complete,
            parsers: ["visa", "amex", "mastercard", "discover", "generic"],
            debug: false
        });

        // Bind event listeners to the document
        $(document)
            .on("scanstart.cardswipe", scanstart)
            .on("scanend.cardswipe", scanend)
            .on("success.cardswipe", success)
            .on("failure.cardswipe", failure)
        ;
    </script>
</apex:page>
Hi 
I am capturing Last Name and Email on the parent component and then passing on the search results on to an embedded child Lightning Card component. Though it fetches the contact record(s) it does not display Lightning Card component (c:DisplayMembers) on the Lightning Tab. Below are the markup, controller and helper code.

Component Markup:
<aura:component implements="force:appHostable" controller="SearchDevoteeMember" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
   <aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact' }"/>
   <aura:attribute name="contacts" type="Contact[]"/>
    <aura:attribute name="contactList" type="Contact[]"/>
   <aura:attribute name="hasErrors" type="Boolean" description="Indicate whether there were failures or not" />
    <aura:attribute name="isVisible" type="boolean" default="false"/>

  

  <div class="slds-page-header" role="banner">
      <p class="slds-text-heading--label">Search Member</p>
   </div>
   <br/>

   <aura:if isTrue="{!v.hasErrors}">
      <!-- Load error -->
      <div class="userCreateError">
         <ui:message title="Error" severity="error" closable="true">
            Please review the error messages.
         </ui:message>
      </div>
   </aura:if>

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

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="lastName">Enter last name: </label>
         <div class="slds-form-element__control">
            <ui:inputText class="slds-input" aura:id="lastName" value="{!v.contact.lastname}" required="true" />
         </div>
      </div>

      <div class="slds-form-element">
         <label class="slds-form-element__label" for="userEmail">Enter email:</label>
         <div class="slds-form-element__control">
            <ui:inputEmail class="slds-input" aura:id="userEmail" value="{!v.contact.Email}" required="true"/>
         </div>
      </div>

      <div class="slds-form-element">
         <ui:button class="slds-button slds-button--neutral" press="{!c.cancel}" label="Cancel" />
         <ui:button class="slds-button slds-button--brand" press="{!c.searchContacts}" label="Search Member" />
      </div>
   </div>
    <div>
   <!-- Iterate over the list of contacts and display them -->
   <aura:iteration var="contact" items="{!v.contactList}">
    <c:DisplayMembers contact="{!contact}"/>
</aura:iteration>
   </div>
</aura:component>

Controller JS:
({    
   doInit : function(component) {
    

   },
    
 
   searchContacts : function(component, event, helper) {
      var last = component.get("v.contact.lastname");
      var email = component.get("v.contact.Email");

         helper.searchContacts(component,last,email); 
        
       
   },
    
   cancel : function(component, event, helper) {
      $A.get("e.force:closeQuickAction").fire();
   }
})

Helper JS:
({
   searchContacts: function(component, last, email) {
      //Save the user and close the panel
      var action = component.get("c.getContacts");
         action.setParams({
            "LastName": last,
            "Email": email
         });

      action.setCallback(this, function(response) {
        // var response = a.getReturnValue();
         var state = response.getState();
         if(component.isValid() && state == "SUCCESS"){
            component.set("v.contacts", response.getReturnValue());
            component.set("v.contactList", response.getReturnValue());
            $A.get("e.force:closeQuickAction").fire();
            var toastEvent = $A.get("e.force:showToast");
            toastEvent.setParams({
                  "title": "Success!",
               "message": "Member Record(s) found!!"
            });
            toastEvent.fire();
            $A.get('e.force:refreshView').fire();
         } else if (state == "ERROR") {
            console.log('There was a problem and the state is: '+ action.getState());
         }
      });
      $A.enqueueAction(action);
      },

})

 
Hi,
I am working with an org which has the NPSP and a few other packages installed.
Using the "old" development cycle, I created a sandbox from the org, made my changes in eclipse and pushed the changes to production.
Now I want to use scratch orgs.
So I created a scratch org, used my package.xlm file from Eclipse to retrieve the config from the sandbox, converted it to the new format and attempted to push it to the scratch org.
However the config is dependent on fields that are part of the NPSP, so do I have to install all the packages that are in the sandbox manually into the scratch org before I can start development?
This seems to break the idea of a fast turnround - am I missing something?
Hi 
I have incorporated a Javascriipt Credit Card reader. I am able to read in the credit care information from the reader into Javascript variables. However I am not able to map these variable values and display them in Visualforce page.
Here is the visualforce page and the apex controller snippets:
Controller Code:
public String getJSStart(){return '<script>document.write(';}
public String getJSEnd(){return ')</script>';}
public PageReference sendCardData () {
    if (Apexpages.currentPage().getParameters().containsKey('firstName')){
        String fn=Apexpages.currentPage().getParameters().get('firstName');
        String ln=Apexpages.currentPage().getParameters().get('lastName');
        
        CCName= fn+' '+ln;
        System.Debug('CCName is ::' + CCName);
        
    }//firstName
    if (Apexpages.currentPage().getParameters().containsKey('account')){
        CCNum=Apexpages.currentPage().getParameters().get('account');
        System.Debug('CCNum is ::' + CCNum);
    }//account
    if (Apexpages.currentPage().getParameters().containsKey('expMonth')){
        selectedExpMnth=Integer.ValueOf(Apexpages.currentPage().getParameters().get('expMonth'));
        System.Debug('selectedExpMnth is ::' + selectedExpMnth);
    }//expMonth
    if (Apexpages.currentPage().getParameters().containsKey('expYear')){
        selectedExpYr=Integer.ValueOf(Apexpages.currentPage().getParameters().get('expYear'));
        System.Debug('selectedExpYr is ::' + selectedExpYr);
    }//expMonth
return null;
}//sendCardData

Visualforce Page:
<apex:pageBlockSection title="Enter CREDIT CARD INFORMATION" columns="1" rendered="{!IF(CONTAINS(selectedPT,'Credit'),true,false)}"></apex:pageBlockSection>
<apex:pageBlockSection title="Enter CHECK INFORMATION" columns="1" rendered="{!IF(CONTAINS(selectedPT,'Check'),true,false)}"></apex:pageBlockSection>
<apex:actionFunction action="{!sendCardData}" name="CardInfo" rerender="CC">
  <apex:param name="firstName" value=""/>
  <apex:param name="lastName" value=""/>
  <apex:param name="account" value=""/>
  <apex:param name="expMonth" value=""/>
  <apex:param name="expYear" value=""/>
  <apex:param name="type" value=""/>  
</apex:actionFunction>
  
<apex:panelgrid id="CC" columns="4" rendered="{!IF(CONTAINS(selectedPT,'Credit'),true,false)}">
 <!-- rendered="{IF(!selectedPT == 'CREDIT CARD', true, false)}" -->
      <apex:outputLabel style="font-weight:bold;" value="Name as in Credit Card"></apex:outputLabel>
       <apex:inputText value="{!CCName}" id="lastName"/>
       <!-- required="{!IF(CONTAINS(selectedPT,'CREDIT'),true,false)}" -->
      <apex:outputLabel style="font-weight:bold;" value="Card Number (16 Digits):"></apex:outputLabel>
       <apex:inputText value="{!CCNum}" id="CRNUM" maxlength="19"/>
       <apex:outputText value="{!JSStart}account{!JSEnd}" escape="false"/>
       
      <apex:outputLabel style="font-weight:bold;" value="Card Exp Month : "></apex:outputLabel>
      <apex:selectList value="{!selectedExpMnth}" id="expMonth" multiselect="false" size="1">
           <apex:selectOptions value="{!TmplCEM}"/>
          <!--   <apex:actionSupport action="{!getPaymentFields}" event="" reRender="" />-->
      </apex:selectList> 
      <apex:outputLabel style="font-weight:bold;" value="Card Exp Year : "></apex:outputLabel>
     <apex:selectList value="{!selectedExpYr}" id="expYear" multiselect="false" size="1">
           <apex:selectOptions value="{!TmplCEYOptions}"/>
         <!--    <apex:actionSupport action="{!getPaymentFields}" event="" reRender="" />-->
      </apex:selectList>    
     <apex:outputLabel style="font-weight:bold;" value="3 Digit Card CVC Code"></apex:outputLabel>
       <apex:inputText value="{!CCCVC}" maxlength="3"/>
 </apex:panelgrid> 
<script type="text/javascript">

        // Called by plugin on a successful scan.
        var complete = function (data) {

            // Is it a payment card?
            if (data.type == "generic")
                return;

            // Copy data fields to form
            //$("#firstName").val(data.firstName);
            //document.getElementById("lastName").value = data.firstName+" "+data.lastName;
            //$("#lastName").val(data.lastName);
            //$("#fullName").val(data.fullName);
            //$("#account").val(data.account);
            //$("#expMonth").val(data.expMonth);
            //$("#expYear").val(data.expYear);
            //$("#type").val(data.type);
            //var lastName=data.lastName;
            
            var firstName=data.firstName;
            var lastName=data.lastName;
            var account=data.account;
            var expMonth=data.expMonth;
            var expYear=data.expYear;
            var type=data.type;
            document.getElementById('{!$Component.thepage.theform.CC.CRNUM}').value = account;
            //document.write("You have entered credit card number:"+ account);
            
            //document.getElementById("expMonth").value = expMonth;
            
            //document.getElementById("expYear").value = expYear;
            
            function sendCardData(){
            CardInfo(firstName,lastName,account,expMonth,expYear,type);
            }
            

        };

        // Event handler for scanstart.cardswipe.
        var scanstart = function () {
            $("#overlay").fadeIn(200);
        };

        // Event handler for scanend.cardswipe.
        var scanend = function () {
            $("#overlay").fadeOut(200);
        };

        // Event handler for success.cardswipe.  Displays returned data in a dialog
        var success = function (event, data) {

            $("#properties").empty();

            // Iterate properties of parsed data
            for (var key in data) {
                if (data.hasOwnProperty(key)) {
                    var text = key + ': ' + data[key];
                    $("#properties").append('<div class="property">' + text + '</div>');
                }
            }


            $("#success").fadeIn().delay(3000).fadeOut();
        }

        var failure = function () {
            $("#failure").fadeIn().delay(1000).fadeOut();
        }

        // Initialize the plugin with default parser and callbacks.
        //
        // Set debug to true to watch the characters get captured and the state machine transitions
        // in the javascript console. This requires a browser that supports the console.log function.
        //
        // Set firstLineOnly to true to invoke the parser after scanning the first line. This will speed up the
        // time from the start of the scan to invoking your success callback.
        $.cardswipe({
            firstLineOnly: true,
            success: complete,
            parsers: ["visa", "amex", "mastercard", "discover", "generic"],
            debug: false
        });

        // Bind event listeners to the document
        $(document)
            .on("scanstart.cardswipe", scanstart)
            .on("scanend.cardswipe", scanend)
            .on("success.cardswipe", success)
            .on("failure.cardswipe", failure)
        ;
    </script>
</apex:page>