• Akshay Gupta
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
Hello Champs,
how to check if access token is expired and if so generate new access token by using refresh token, in code only.
and sending subsequent requests by using new access token
do we need to store refresh token.
Any help will be appreciated.
Thanks

Hi Guys,
I want to Print entire bootstrap model content (which has data from salesforce db via angularjs and js remoting) on click(Print button) event.
tried via standard java script printing function but seems not working.

any help would be appreciated.

Thank You,
Akshay
Hi Guys,

We have two visual force pages say A and B , and two controllers say controller1 and controller2 in controllers we are using java script remoting methods
both page display different data based on Logged in user and user's inputs.
My reqirement is the need to display data on page A (via come click event under java script ) and corrseponding method to fetch data exists in controller2.
What is the best possible way to fetch data on page A from controller2 via javaScript remoting.

Thank you,
Akshay
String strObjProsPrefix = Schema.MCPM_Prospect__c.getSobjectType().getDescribe().getKeyPrefix();
        String strQuery = 'Select Id, MCPM_Email_Reminder_Interaction__c, MCPM_Prospect_Email_For_Reminder__c, '+
                                  'MCPM_Premise_Lookup__c, MCPM_Prospect__c'+  
                                  'from MCPM_Interaction__c where ';
        if(strRecordId.startsWith(strObjProsPrefix)){
            strQuery += 'MCPM_Prospect__c=  \''+String.escapeSingleQuotes(strRecordId)+'\' and '+
                         'MCPM_Email_Reminder_Interaction__c  = true ' +
                                                          'ORDER BY CreatedDate DESC LIMIT 1 ';
        }                                                 
        else{
            strQuery += 'MCPM_Premise_Lookup__c= \''+String.escapeSingleQuotes(strRecordId)+'\' and ' +
                                 'MCPM_Email_Reminder_Interaction__c = true'+ 
                                                          'ORDER BY CreatedDate DESC LIMIT 1 ';
        }                                                
                                                          
        List<MCPM_Interaction__c> objInterction = Database.query(strQuery);


Hi I am getting above error, tried many thing don't know what's going wrong.
Please help,
 
Hi Guys,
For my req is, task(custom vf page) can be created from related list of two custom object say A and B.
when a task is created a child object C also get created either A or B based on the related list of object from where the new task is created.
when task is edited it should query records of object C based on task if related to A or B
I want to query child object C dynamically in one query based on type of parent.

 
While working on the trailhead challenge "Connect Components with Events" I am getting this error - "The campingList component isn't iterating the array of items and creating campingListItem components."
Here is my code.

Thanks.
1) campingItem.app
<aura:application extends="force:slds">
    <c:campingHeader/>	
</aura:application>
2) campingHeader.cmp
<aura:component>
    <!-- PAGE HEADER -->
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem>
            <lightning:icon iconName="action:goal" alternativeText="Camping Items"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Camping Items</h1>
                <h2 class="slds-text-heading--medium">New Camping Items</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>
    <!-- / PAGE HEADER -->
    <!-- NEW EXPENSE FORM -->
    <lightning:layout>
        <lightning:layoutItem padding="around-small" size="6">
        <!-- [[ expense form goes here ]] -->
            <c:campingList/>
        </lightning:layoutItem>
    </lightning:layout>
    <!-- / NEW EXPENSE FORM -->
</aura:component>

3) campingList.cmp
<aura:component controller="CampingListController">
    <aura:attribute name="items" type="Camping_Item__c[]"/>
 
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}"/>
	
    <!--Call campingListForm component for new Item Entry Form-->
    <c:campingListForm/>
	
    <!-- /Creating a list of items -->
    <lightning:card title="Items">
        <p class="slds-p-horizontal--small">
            <aura:iteration items="{!v.items}" var="campingItem">
                <c:campingListItem campingItem="{!campingItem}"/>
            </aura:iteration>
        </p>
    </lightning:card>
	
</aura:component>

4) campingListController.js
({
  
    // Load camping items from Salesforce
    doInit: function(component, event, helper) {
        // Create the action
        var action = component.get("c.getItems");
        // Add callback behavior for when response is received
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.items", response.getReturnValue());
            }
            else {
                console.log("Failed with state: " + state);
            }
        });
        // Send action off to be executed
        $A.enqueueAction(action);
    },
    
    handleAddItem: function(component, event, helper) {
        
        component.set("v.newItem",
                     { 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Packed__c': false,
                    'Price__c': 0,
                    'Quantity__c': 0});
    }
})
5) campingListItem.cmp
<aura:component>
    <aura:attribute name="campingItem" type="Camping_Item__c"/>
    <lightning:card title="{!v.campingItem.Name}" iconName="action:goal"
                    class="{!v.campingItem.Packed__c ?
                           'slds-theme--success' : ''}">
        <p class="slds-text-heading--medium slds-p-horizontal--small">
           Price: <lightning:formattedNumber value="{!v.campingItem.Price__c}" style="currency"/>
        </p>
        <p class="slds-text-heading--medium slds-p-horizontal--small">
           Quantity: <lightning:formattedNumber value="{!v.campingItem.Quantity__c}" style="decimal"/>
        </p>
        <p>
            <lightning:input type="toggle" 
                             label="Packed?"
                             name="packed"
                             class="slds-p-around--small"
                             checked="{!v.campingItem.Packed__c}"
                             messageToggleActive="Yes"
                             messageToggleInactive="No"
                             onchange="{!c.clickPacked}"/>
        </p>
    </lightning:card>
</aura:component>

6) campingListForm.cmp
<aura:component controller="CampingListController">
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c"
         default="{ 'sobjectType': 'Camping_Item__c',
                        'Name': '',
                        'Quantity__c': 0,
                        'Price__c': 0,
                        'Packed__c': false }"/>
   
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>

    <aura:registerEvent name="addItem" type="c:addItemEvent"/>

    <!-- CREATE NEW CAMPING ITEM -->
    <div aria-labelledby="newitemform">
        <!-- BOXED AREA -->
        <fieldset class="slds-box slds-theme--default slds-container--small">
        <legend id="newitemform" class="slds-text-heading--small 
          slds-p-vertical--medium">
          Add New Camping Item
        </legend>
  
        <!-- CREATE NEW CAMPING ITEM FORM -->
        <form class="slds-form--stacked">          
            <lightning:input aura:id="newitemform" label="Camping Item Name"
                             name="itemname"
                             value="{!v.newItem.Name}"
                             required="true"/> 
            <lightning:input type="number" aura:id="newitemform" label="Price"
                             name="itemprice"
                             min="0.1"
                             formatter="currency"
                             step="0.01"
                             value="{!v.newItem.Price__c}"
                             messageWhenRangeUnderflow="Enter a price that's at least $0.10."/>
            <lightning:input type="number" aura:id="newitemform" label="Quantity"
                             name="itemquantity"
                             min="1"
                             step="1"
                             value="{!v.newItem.Quantity__c}" 
                             messageWhenRangeUnderflow="Enter a quantity that's greater than 0."/>
            <lightning:input type="checkbox" aura:id="newitemform" label="Packed?"  
                             name="itempacked"
                             checked="{!v.newItem.Packed__c}"/>
            <lightning:button label="Create New Item" 
                              class="slds-m-top--medium"
                              variant="brand"
                              onclick="{!c.submitForm}"/>
        </form>
        <!-- / CREATE NEW CAMPING ITEM FORM -->
  
      </fieldset>
      <!-- / BOXED AREA -->
    </div>
    <!-- / CREATE NEW CAMPING ITEM -->
</aura:component>

7) campingListFormController.js​​​​​​​
​​​​​​​
({
    //Create new camping item
	submitForm : function(component, event, helper) {
        
        var isFormValid = component.find("newitemform").reduce(function(validSoFar, inputCmp){
            // Displays error messages for invalid fields
        	inputCmp.showHelpMessageIfInvalid();    	
            return validSoFar && inputCmp.get("v.validity").valid;
        });
        
        if (isFormValid) {
            
            var newCampingItem = component.get("v.newItem");
            helper.createItem(component, newCampingItem);
           
        }
	}
})
8) campingListFormHelper.js
({
     createItem : function(component) {
                       
        var action = component.get("c.saveItem");
        action.setParams({
            "item": item
        });
        
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {        
                var items = component.get("v.items");
                items.push(item);
                component.set("v.items",items);
            }
        });
        $A.enqueueAction(action);
         
        var item = event.getParam("item");
        var newItem = component.get("v.newItem");
        var addEvent = component.getEvent("addItem");
        addEvent.setParams({"item" : newItem});
        addEvent.fire();
        /*component.set("v.newItem",
                     { 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Packed__c': false,
                    'Price__c': 0,
                    'Quantity__c': 0});*/
    }
    
    
})
9) campingListController.apxc
public with sharing class CampingListController {
    @AuraEnabled
    public static List<Camping_Item__c> getItems() {
		List<Camping_Item__c> campingItems = [SELECT Id,Name,Price__c,Packed__c,Quantity__c FROM Camping_Item__c];
        return campingItems;
    }
    
    @AuraEnabled
    public static Camping_Item__c saveItem(Camping_Item__c campingItem) {
        upsert campingItem;
        return campingItem;
    }
}

10) addItemEv​​​​​​​ent.evt​​​​​​​​​​​​​​​​​​​​​​​​​​​​
<aura:event type="COMPONENT">
    <aura:attribute name="item" type="Camping_Item__c"/>
</aura:event>

​​​​​​​

Hi,
I'm stuck at the first challenge where it always returns me:
Could not find an entry in the ServiceCredentials custom setting named 'BillingServiceCredential' with the specified username and password. Ensure the you have entered the data correctly into the custom settings record.
I think that I did everything right. The unmanaged package came with a custom setting called ServiceCredentials:

User-added image
I clicked manage and added the BillingServiceCredential

User-added image

With following details
User-added image

Still giving me above error!
Any ideas?

Regs,
Pieter

Hi Guys,

We have two visual force pages say A and B , and two controllers say controller1 and controller2 in controllers we are using java script remoting methods
both page display different data based on Logged in user and user's inputs.
My reqirement is the need to display data on page A (via come click event under java script ) and corrseponding method to fetch data exists in controller2.
What is the best possible way to fetch data on page A from controller2 via javaScript remoting.

Thank you,
Akshay
String strObjProsPrefix = Schema.MCPM_Prospect__c.getSobjectType().getDescribe().getKeyPrefix();
        String strQuery = 'Select Id, MCPM_Email_Reminder_Interaction__c, MCPM_Prospect_Email_For_Reminder__c, '+
                                  'MCPM_Premise_Lookup__c, MCPM_Prospect__c'+  
                                  'from MCPM_Interaction__c where ';
        if(strRecordId.startsWith(strObjProsPrefix)){
            strQuery += 'MCPM_Prospect__c=  \''+String.escapeSingleQuotes(strRecordId)+'\' and '+
                         'MCPM_Email_Reminder_Interaction__c  = true ' +
                                                          'ORDER BY CreatedDate DESC LIMIT 1 ';
        }                                                 
        else{
            strQuery += 'MCPM_Premise_Lookup__c= \''+String.escapeSingleQuotes(strRecordId)+'\' and ' +
                                 'MCPM_Email_Reminder_Interaction__c = true'+ 
                                                          'ORDER BY CreatedDate DESC LIMIT 1 ';
        }                                                
                                                          
        List<MCPM_Interaction__c> objInterction = Database.query(strQuery);


Hi I am getting above error, tried many thing don't know what's going wrong.
Please help,
 
Hi Everyone,

Currently, I have 4 certifications (Platform Developer 1, Admin, Sales Cloud, Service Cloud) in salesforce. I am planning to take my Platform Developer II exam next month. There is not much information or any experiences of the people who have taken it online. In the official site, it says the exam comprises of 2 components, multiple-choice and programmatic assignment. Once I am done with multiple choice I will be asked to register for a programming assignment.

So have few questions about the programming assignment,
a. Is there any time-limit to complete the assignment ?
b. Will ther be any pass/fail for the assignment as well?
c. Incase there is a pass/fail, and we fail it then does the multiple choice exam we passed still holds ?

Please enlighten me with your thoughts as always.Looking forward.