• sheila srivatsav
  • NEWBIE
  • 220 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 18
    Replies
I am writing salesforce certified admin tomorrow.

I have a copule of questions which I have a doubt. I have marked the answer but pls let me know right or woring

1. What happens if some records do NOT meet the data validation criteria when importing data?    

A.   Import process fails only for the records with invalid data.    
B.   Import process ignores the data validation criteria.    
C.   Import process requires user authorizaton to import the invalid records.    
D.   Import process aborts when it encounters the first invalid record.    
Ans :  a

2. Users cannot save email templates in the "Unified Public Email        
    Templates" folder.

    How could a system administrator allow users to save emails to this 
    folder.

a. go to the profile of each user and check the box for Manage public templates.
b. go to the email templates and manually share each with the specific users.
c. go to the user record and check the box for Manager Public templates.
d. go to the email templates and manually share each with the profile of the specific users.

Ans : a

3.  Sales representatives at Universal containers often schedule in-
     person meetings at customer offices. Management wants to track   
     activities for this meeting category to clearly display customer 
     office meetings in the account , contact or opportunitity page 
     layouts, as well as adding this data to reports.
 
      which method should a system administrator use to solve this 
      business request? 

a. Have the user manually enter the meeting details in the description 
    field on accounts , contacts amd opportunities.
b. Add a new value to the Type field on tasks used for accounts , 
    contacts and opportunities.
c. Add a new value to the type field on accounts , contacts and 
    opportunities.
d. have the user manually enter the meeting details in the account 
    comments.

ans : b

4. Universal containers has just acquired a new company whose sales 
    team has a unique sales process with stages that are different       
    than currently set up in salesforce. To make sure the acquistions 
    turns smoothly, the Executive team does not want the new sales 
    team to have to change then process at all. 

a. Create new values for the opportunity stage field and create a new 
     sales process assigned to a custom Record Type for the new sales 
     team.
b. Create a Record type and page layout for the new sales team and 
    custom field for the new stages.
c. Create new values for the opportunity stage field and use field-level 
    security to control which teams see which fields.
d. create new values for the opportunity stage field and order them so 
    that new sales team's values are at the bottom of the picklist.

Ans : a

5.  An administrator needs to create a Sales process for a new 
      product.  
      what are three considerations for this purpose?

a. All Picklist values on the page layout must be added to the Master 
    picklist value list or be active values.
b. The record type's page layout is assigned to Users through their 
    profile assignments.
c. An opportunity record type will need to be created and assigned to 
    the sales process.
d. Adding a new value to the record Type Master Picklist value List 
    adds the value to all existing record type.
e. The record type name assignment becomes permanent upon Save 
     of a new Record type.

Ans :  a,b,d

6.Universal containers (UC) is rolling out a new approval process. As 
   the last step in the process  after an Opportunity has been 
    approved, UC wants to send a contract to its customer for 
    signature.

    What should an administrator suggest to implement the 
     functionality?

a. Check the "Send PDF" box on the approval process setup.
b. Hire a consulting firm to develop a document signing framework.
c. Install an app from the appexchange.
d. Utilize the salesforce autosign flow.

7.  which two are capabilities of the content delivery features of 
     salesforce content? 
      choose 2 answers.

a. associate the content delivery with the salesforce record.
b. password protect content deliveries that contain sensitive data.
c. Customize the URL assigned to the content delivery.
d. encrypt certain content delivery files.

ans : b , c

8. Universal containers has purchased 25 new salesforce licences.
    How many users can a system administrator create at the same 
    time on the Add Multiple Users page?

a. a maximum of 10 users
b. an unlimited numbers of users
c. a maximum of 5 users
d. a maximum of 25 users.

ans : b

Pls correct the answers if wrong.

thanks
sheila
I have a lightning data service .

I have shown the complete code I have with me.

<aura:attribute name="simpleRecord" type="Object" description="A simplified view record object to be displayed"/>
    <aura:attribute name="recordError" type="String" description="An error message"/>
 <aura:attribute name="record" type="Object" description=""/>

    <force:recordData aura:id="somecaseRecord"
                          recordId="{!v.caseId}"
                          targetError="{!v.recordError}"
                          targetRecord="{!v.record}"
                          targetFields="{!v.simpleRecord}"
                          mode="VIEW"                      
                          fields="Id,Status"/>

I have Status is a field defined in the case object and case Id is generated during the init handler.

I want to fetch the value of the status field in the controller.js

if (component.get("v.simpleRecord.Status") != "Closed")
{
 //then do some logic
}

I tried doing like this also.
if (component.get("v.record").Status  != "Closed")
{
 //then some logic I will do
}

But its not fetching the status field value 

Let me know where I am going wrong.

thanks
sheila S
I have a custom field called status__c in the case object.

This field status__c is a picklist with values like "In-Progress", "Closed" etc.

My requirement is to use a lightning data service to fetch the value of this field in the donit event of my lightning component.

In the doInit event of lightning component I will be doing like this

if (status__c != Closed)
{
    helper.callsomelogic(component,helper)
}

 <aura:attribute name="casememberError" type="String" description="Error In LDS"/>
    <aura:attribute name="casemembership" type="Object" description="Access Record with field Name Status to get the Value"/>
<aura:attribute name="recordId" type="String" description="case RecordID"/>

<force:recordData aura:id="caseRecord"
            recordId="{!v.recordId}"
            fields="Status__c"
            targetRecord="{!v.casemembership}"
            targetFields="{!v.casesimpleMembership}"
            targetError="{!v.casememberError}"/> 

Pleae let me know how I can achieve this. 
Any help is greatly appreciated.

thanks
sheila
I have a piece of code in my lightning component as follows

pCodeShortDesc = pCodeShortDesc.subtring(0,28);

this return a string like "Nebuent    Inh 300 mg"

I want to remove the two extra white spaces in the above.

Please let me know urgent how to do.

thanks
sheila
Hello

any body having latest winter19 dumps for salesforce certified administrator?

pls let me know.

thanks
sheila 
In my lightning component I am having like this.

<aura:attribute name="claimType"  type="String" default="Pharmacy" description="some pharamcy"/>

I want the default value of the attribute in the controller.js file of the component for further processing.

Please tell me how to do this.

thanks
sheila

 
I am not very good in javascript

I have a lightning component and in the controller.js file I have as shown below

var uos=claimlines.unitofservice;

when I debug this it returns a value of 30.0000

My client has told me to keep only two zeroes after the decimal point,

A working code would be greatly helpful.

thanks
sheila
 
A lightning component makes an api call to an external service and the result is an json response

I have given the json response as follows.
 
{"readClaimResponse": {

   "status":    {

      "statusCode": "0",

      "detail": "SUCCESS"
   },

   "claim":    {

      "claimIdentifier":       {

         "idSource": "63",

         "idValue": "183245438591000",

         "idType": "pharmacyclaims"

      },

      "claimType": "Pharmacy",  

      "billedAmount": "520",

      "allowedAmount": "500.4",

      "planPaidAmount": "400.32",

      "totalMemberResponsibility": "100.08",

      "paidToProvider": "400.32",

      "deductible": "0.00",

      "claimProcessedDate": "2018-11-20T20:51:37.001100",

      "claimStatus": "Final",

      "dateOfServiceBegin": "2018-10-15",

      "dateOfServiceEnd": "2018-10-15",

      "providerName": "CVS PHARMACY 16890",

      "amountCoinsurance": "100.08",

      "amountCopay": "0.00",

      "healthClaimLines": [      {

         "amountCopay": "0.00",

         "amountCoinsurance": "100.08",

         "billedAmount": "520",

         "allowedAmount": "500.4",

         "deductible": "0.00",

         "paidAmount": "400.32",

         "memberResponsibility": "100.08",

         "procedureCode": [         {

            "procedureCode": "63323087715",

            "procedureCodeDescr": "Nebupent     Inh 300mg"

         }],

         "healthClaimLineIdentifier":          {

            "idSource": "100",

            "idValue": "FDGP2KT5800+001",

            "idType": "Healthclaimline"

         },

         "dateOfServiceBegin": "2018-10-15",

         "dateOfServiceEnd": "2018-10-15",

         "unitsOfService": "30.000"

      }]

   }

}}
what I am not understanding is how to get the "claimType" value into an aura:attribute for further processing.
I need the value of "claimType" i.e Pharmacy into an aura:attribute for further processing.
Please let me know how to achieve this at the very earliest.
Like I do not have much exp in json

thanks
sheila
My requirement is to display contact records so for every contact record displayed I need a radio button beside it.

I have done like so far.
@AuraEnabled
    Public static List<Contact> showContacts()
    {
      List<Contact> conList = [select Id,Name
                                 FROM 
                                 contact
                                 Order By name LIMIT 15];
        return conList;
    }

<aura:component implements="flexipage:availableForAllPageTypes" 
                controller="MyController"
                access="global" >
	
    <aura:attribute name="contacts"
                    type="List[]"
                    access="global"/>
    
    <aura:handler name="init"
                  value="{!this}"
                  action="{!c.doInit}"/>
    
    
    <table class="slds-table slds-table--bordered slds-table--cell-buffer">
        <thead>
            <tr class="slds-text-title--caps">
                <th scope="col">
                    <div class="slds-truncate" title="ContactName">Name</div>
                </th>
                
            </tr>
        </thead>
        
        <!--table body start, 
        Iterate contact list as a <tr> 
        -->
        <tbody>
            <aura:iteration items="{!v.contacts}" 
                            var="con">
                <tr>
                    <th scope="row">
                          <ui:inputRadio label="{!v.con}" change="{!c.onRadioChange}" />
                        <div class="slds-truncate" title="{!con.Name}">{!con.Name}</div>
                   </th>
                </tr>
            </aura:iteration>
           
        </tbody>
        
    </table>
    
</aura:component>

({
	doInit : function(component, event, helper) {
        helper.queryContacts(component,event,helper);
		
	},
    
    onRadioChange : function(component, event, helper) {
         // var selected = event.getSource().get("v.con");
        //alert(selected);
      }
})

({
	queryContacts : function(component,event,helper) {
		
        var action=component.get('c.showContacts');
        
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                
                component.set("v.contacts", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);

	}
})

<aura:application extends="force:slds"
                  access="global">
    
    <c:RadioButtons/>
    
</aura:application>
I am able to display radio button for every contact name but I am able to select multiple records.
I need to fire the change event when I select one contact record.

also other than <ui:radiobutton> what other component can we use?
thanks
sheila
 
I am trying to understand how we can put an vf page inside an lightning component and send message from lightning component to vf page.
I am using the website https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html   for reference.

In my current project a similar scenario has been implemented where the vf page embedded inside the lightning component makes an api call.

so I am breaking down things and trying to understand.
sendMessageToVF.cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
	
    <aura:attribute name="message"
                    type="string"
                    default="Hello communication"
                    access="global"/>
    
    <aura:attribute name="vfHost"
                    type="string"
                    default="sheilasrivastav-dev-ed--c.na35.visual.force.com"
                    access="global"/>
    
     <lightning:input type="text" 
                     label="Message" 
                     name="Message"
                     value="{!v.message}"/>
    
    <lightning:button label="sendtoVF"
                      onclick="{!c.sendtoVF}"/>
    
    <!--the visual force page that we need to send data to-->
    <iframe aura:id="vfFrame" 
            src="{!'https://' + v.vfHost + '/apex/myvfpage'}"/>

</aura:component>


SendMessageToVFController.js

({
	sendtoVF : function(component, event, helper) {
		
        debugger;
        var message = component.get("v.message");
        
        console.log('message= '+message);
        var vfOrigin = "https://" + component.get("v.vfHost");
        
        console.log('vfOrigin= '+vfOrigin);
        
        var vfWindow = component.find("vfFrame").getElement().contentWindow;
        
        console.log('vfWindow= '+vfWindow);
        
        vfWindow.postMessage(message, vfOrigin);
	}
})


myvfpage.vfp

<apex:page >
    
    <script>
    var lexOrigin = "https://sheilasrivastav-dev-ed.lightning.force.com";
    window.addEventListener("message", function(event) {
        if (event.origin !== lexOrigin) {
            // Not the expected origin: reject message!
            return;
        }
        // Handle message
        console.log(event.data);
    }, false);
</script>
    
</apex:page>

Mainapp.app

<aura:application extends="force:slds"
                  access="global">
    
    <c:SendMessageToVFPage/>
    
</aura:application>

when I run the application I get an error as follows:

This page has an error. You might just need to refresh it. Action failed: c:SendMessageToVFPage$controller$sendtoVF [Blocked a frame with origin "https://sheilasrivastav-dev-ed.lightning.force.com" from accessing a cross-origin frame.] Failing descriptor: {c:SendMessageToVFPage$controller$sendtoVF}

I think locker service is coming into the picture but how to resolve this.

Pls let me know.

thanks
sheila
 
My requirement is to display Account and its related contacts using accordion and accordion section.

I am able to display account and when I expand account it will show Rating and Phone but Under each account I want a separate accordion to show contact firstname and contact lastname.

Here's my code
public with sharing class MyController {

    @AuraEnabled
    public static List<Account> showAccountsForAccordion()
    {
        List<Account> accList = [select Id,Name,Rating,Phone,(select firstname,lastname from contacts)
                                 FROM 
                                 Account
                                 Order By name LIMIT 4];
        return accList;
    }
}

<aura:component implements="flexipage:availableForAllPageTypes" 
                controller="MyController"
                access="global" >
	
    <aura:attribute name="accnList"
                    type="List"/>
    
    <aura:handler name="init"
                  value="{!this}"
                  action="{!c.doInit}"/>
    
    <div class="demo-only slds-grid" style="height: 150px; width: 300px; padding: 2rem;">
    <div class="slds-is-fixed">
    <div style="position: absolute; top: 1rem; left: 1rem; border: 1px solid red; background: rgb(244, 246, 249);">
    
    <lightning:accordion>
          <aura:iteration items="{!v.accnList}" 
                          var="acc">
              
              <lightning:accordionSection name="{!acc.Name}" 
                                          label="{!acc.Name}">
                  
                   <aura:set attribute="body">
                       
                        <p>Rating : {!acc.Rating}</p>
                        <p>Phone : {!acc.Phone}</p>
                      
                    </aura:set>
                  
                  </lightning:accordionSection>
              
              <aura:iteration items="{!v.accnList.contacts}" 
                                  var="con">
                  <lightning:accordionSection name="{!con.Name}" 
                                              label="{!con.Name}">
                  
                   <aura:set attribute="body">
                       
                        <p>FirstName : {!con.FirstName}</p>
                        <p>LastNamePhone : {!con.LastName}</p>
                      
                    </aura:set>
                   </lightning:accordionSection>
                       </aura:iteration>
      </aura:iteration>
      </lightning:accordion>
  </div>
</div>
         </div>
</aura:component>


({
	doInit : function(component, event, helper) {
		
        debugger;
        var action=component.get('c.showAccountsForAccordion');
        
        action.setCallback(this,function(response){
            
            debugger;
            var state = response.getState();
            console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
               
                component.set("v.accnList", response.getReturnValue());
                console.log('v.accnList='+response.getReturnValue());
              }
        });$A.enqueueAction(action);
        
	}
})

Please tell me how to achieve this.

thanks
sheila
I am tring to get my basics clear while making an api call from lightning application.

But when I debug the statement  var action=resposne.getState(), the state is ERROR
 
public class httpCalloutController {

    @AuraEnabled
    public static void getCalloutResponseContents()
    {
        Http h = new Http();
      
        HttpRequest req = new HttpRequest();
		req.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
		req.setMethod('GET');      
        
        // Send the request, and return a response
		HttpResponse res = h.send(req);
		System.debug('response:--> ' + res.getBody());
        
        
        string jsonstring=(string)JSON.deserializeUntyped(res.getBody());
        system.debug('jsonstring-->' + jsonstring);
     }
}

CalloutComponent.cmp

<aura:component implements="flexipage:availableForAllPageTypes" 
                access="global"
                controller="httpCalloutController">
    
    <aura:attribute name="response" type="string"/>
    
	<aura:attribute name="jsonoutput" type="String[]"/>
    
    <lightning:button label="Make Callout" 
                      title="Make Callout"
                      onclick="{!c.MakeCallOut}"/>

    {!jsonoutput}
    
</aura:component>

CalloutComponentController.js

({
	MakeCallOut : function(component, event, helper) {
		
        debugger;
        var action=component.get('c.getCalloutResponseContents');
        
      // action.setParams({
        //    "URL":'https://th-apex-http-callout.herokuapp.com/animals'
        //});
        
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            
          console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
               component.set("v.response", response.getReturnValue());
                console.log('v.response='+v.response);
             }
        });
 
        $A.enqueueAction(action);
    },
})

thanks
sheila​​​​​​​
I am trying to understand the basic concept of Aura.Action in lightning but stuck with an error.
ChildComp.cmp

<aura:component >
    
    <aura:attribute name="childTitle"
                    access="global"
                    default="Default Child Title"
                    type="string"/>
    
    <aura:attribute name="onParentClick"
                    type="Aura.Action"/>
    <lightning:layout>
    
    <lightning:layoutItem>
          <div class="header-column">
                    <p class="field-title" title="Child Title Is">Child Title</p>
                    <p>{!v.childTitle}</p>
                </div>
                <div>
                  <lightning:input type="text"
                                   label="Enter some value..."
                                   aura:id="inputChildTitle"
                                   disabled="true"/>
                    
                </div>
        <lightning:button label="Change My Title"
                          onclick="{!c.ChangeTitle}"/>
        
        <!-- Create a button here -->
             <lightning:button label="Enable Child TextBox"
                               onclick="{!v.onParentClick}"/>
        </lightning:layoutItem>
    </lightning:layout>
    
	
</aura:component>

ChildCompController.js

({
	ChangeTitle : function(component, event, helper) {
        component.set("v.childTitle","Changed Title From Child Itself");
	}
})


ParentComp.cmp

<aura:component >
	
  <aura:attribute name="parentTitle"
                    access="global"
                    default="Default Parent Title"
                    type="string"/>
    
     <lightning:layout>
    
    <lightning:layoutItem>
          <div class="header-column">
                    <p class="field-title" title="Parent Title Is">Parent Title</p>
                    <p>{!v.parentTitle}</p>
                </div>
                
         </lightning:layoutItem>
    </lightning:layout>
    
    <c:ChildComp aura:id="childCmp"
                  onParentClick="{!c.EnableTextBox}"/>  
</aura:component>

ParentCompController.js

({
	EnableTextBox : function(component, event, helper) {
		
        debugger;
        //Now find the textbox which is defined in child comp
        var inputChildTitle=component.find("inputChildTitle");
        
        console.log("inputChildTitle="+inputChildTitle);
        
        inputChildTitle.set("v.disabled",false);
	}
})
The error is in the statement  " inputChildTitle.set("v.disabled",false);"

Please help me 

thanks
sheila
 
I have a custom button defined in the page layout of account
when I click this button, enter the account number then it should save back to object
public with sharing class InitiateApprovalController {

    public Account acc{get;set;}
    
    public string accid;
    
    public InitiateApprovalController(ApexPages.StandardController stdcontroller) {

    accid=ApexPages.CurrentPage().getParameters().get('id');
    this.acc=(Account)stdcontroller.getRecord();
    
    acc=[select ID,Name,AccountNumber from Account where ID =:acc.ID];
       
    }
    
    public InitiateApprovalController()
    {
       acc=new Account();
         
    }

    public PageReference customsave()
    {
        try{
        system.debug('acc before update ='+acc);
            
        database.Upsert(acc);
        PageReference pr=new PageReference('/'+acc.Id);

        return pr;
        }
        catch( Exception e ){
            ApexPages.addMessages(e);
            return Null;
        }       
    }
    
}

<apex:page standardController="Account"
            extensions="InitiateApprovalController">
  
  <apex:form >
  
  <apex:pageBlock mode="edit">
            <apex:pageBlockSection title="Approvers" 
                                   id="ApproversId">
                                   
             <apex:inputField Id="name" 
                              html-placeholder="Account Name.." 
                              value="{!Account.Name}" />

             <apex:inputField Id="accnumber" 
                              html-placeholder="Account Number.." 
                              value="{!Account.AccountNumber}" />
                                 
            </apex:pageBlockSection>
            
    <apex:pageBlockButtons location="bottom" html-align="right">
    
    <apex:commandButton id="customsave1"
                        value="save"
                        action="{!customsave}"/>
                        
    </apex:pageBlockButtons>
    
     </apex:pageBlock>
  </apex:form>
    
</apex:page>
I am surprised because I am using Database.Upsert but still it is not saving to object

Can any one please let me know?

Thanks
sheila
 
I am using google crome browser and performing inline editing on lightning datatable.

I am able to display the field values but when I edit Opportunity Name and click save its not saving.

Please let me know the issue.
 
public class DataTableController {

    @AuraEnabled
    public static List<Opportunity> getOpportunities()
    {
        List<Opportunity> oppList=new List<Opportunity>();
        
        oppList=[select Name,Account.Name,StageName,CloseDate,Amount from Opportunity
                 where Amount != NULL];
        
        return oppList;
    }
    
    @AuraEnabled
    public static void updateOpportunities(List<Opportunity> oppsList){
        try
        {
            Database.update(oppsList);
            
          }
        catch(Exception ex)
        {
            system.debug(ex.getMessage());
        }
    }
}

<aura:component implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes" 
                controller="DataTableController"
                access="global">
	
        <!-- Three important parts of datatable is Key , data and columns
         so we need attribute for data and columns(metatadata)-->
    <!-- attributes -->
    <aura:attribute name="data" 
                    type="Object"/>
    
    <aura:attribute name="columns" 
                    type="List"/>
    
<aura:attribute name="updatedRecord" type="Object[]" />

    <!-- handlers-->
    <aura:handler name="init" 
                  value="{!this}" 
                  action="{!c.doInit}"/>
    
    <lightning:card title="OpportunityDatatable">
        
        <lightning:datatable aura:id="opportunitydatatable"
                             keyField="id"
                             data="{!v.data}"
                             columns="{!v.columns}"
                             onsave="{!c.handleSaveOpps}"
                             hideCheckboxColumn="true"/>
        
</lightning:card>
    
    {!updatedRecord}

</aura:component>

({
	doInit : function(component, event, helper) {
        
        helper.queryColumns(component,event,helper);
        
        helper.queryContacts(component,event,helper);
  	},
    
    handleSaveOpps: function (component, event, helper) {
        debugger;    
        var draftValues = event.getParam('draftValues');
console.log(draftValues);
        var action = component.get('c.updateOpportunities');
        action.setParams({ 
            "oppsList": draftValues
        });
        action.setCallback(this, $A.getCallback(function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                helper.fireSuccessToast(component);  
                helper.fireRefreshEvt(component);
            } else if (state === "ERROR") {
                var errors = response.getError();
                console.error(errors);
                helper.fireFailureToast(component);  
            }
        }));
        $A.enqueueAction(action);
    }
     
})


({
	queryColumns : function(component,event,helper) {
        
		  component.set('v.columns', [
            {label: 'Opp Name', fieldName: 'Name', editable : 'true', type: 'text'},
            {label: 'Acc Name', fieldName: 'AccountName', type: 'text'},
            {label: 'StageName', fieldName: 'StageName', type: 'text'},
            {label: 'CloseDate', fieldName: 'CloseDate', type: 'date'},
            {label: 'Amount', fieldName: 'Amount', type: 'currency', cellAttributes: { alignment: 'left' }} 
        ]);
	},
    
    queryContacts : function(component,event,helper) {
        
        var action=component.get('c.getOpportunities');
        
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                
                  //the following code will display the parent account name
                 var rows = response.getReturnValue();
                 for (var i = 0; i < rows.length; i++) {
                    var row = rows[i];
                    if (row.Account) row.AccountName = row.Account.Name;
                }
                //component.set("v.data", response.getReturnValue());
                 component.set("v.data", rows);
            }
        });
        $A.enqueueAction(action);
    },
    
     fireSuccessToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Success', 
            'message' : 'Opportunities updated sucessfully.' ,
            'type':'success'
        }); 
        toastEvent.fire(); 
    },
    
    fireFailureToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Failed', 
            'message' : 'An error occurred. Please contact your administrator.',
            'type':'error'
        }); 
        toastEvent.fire(); 
    },
    
    fireRefreshEvt : function(component) {
        var refreshEvent = $A.get("e.force:refreshView");
        if(refreshEvent){
            refreshEvent.fire();
        }
    }
       
})

 
I just started working on lightning datatable.

The code is working but StageName , closedate and amount values are not displayed.
 
public class DataTableController {

    @AuraEnabled
    public static List<Opportunity> getOpportunities()
    {
        List<Opportunity> oppList=new List<Opportunity>();
        
        oppList=[select name,Account.Name,StageName,CloseDate,Amount from Opportunity
                       where StageName != NULL
                       AND
                       Amount != NULL
                       order by Account.Name];
        
        return oppList;
    }
}

<aura:component implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes" 
                controller="DataTableController"
                access="global">
	
        <!-- Three important parts of datatable is Key , data and columns
         so we need attribute for data and columns(metatadata)-->
    <!-- attributes -->
    <aura:attribute name="data" 
                    type="Object"/>
    
    <aura:attribute name="columns" 
                    type="List[]"/>
    

    <!-- handlers-->
    <aura:handler name="init" 
                  value="{!this}" 
                  action="{!c.doInit}"/>
    
    <!-- the container element determine the height of the datatable -->
    <div style="height: 300px">
        
        <lightning:datatable aura:id="opportunitydatatable"
                             
                             keyField="id"
                             data="{!v.data}"
                             columns="{!v.columns}"
                             hideCheckboxColumn="true"/>
        
    </div>
</aura:component>

({
	doInit : function(component, event, helper) {
        
        helper.queryColumns(component,event,helper);
        
        helper.queryContacts(component,event,helper);
  	}
})

({
	queryColumns : function(component,event,helper) {
        
		  component.set('v.columns', [
            {label: 'Opp Name', fieldName: 'Name', type: 'text'},
            {label: 'Acc Name', fieldName: 'Name', type: 'text'},
            {label: 'StageName', fieldName: 'Stage Name', type: 'text'},
            {label: 'CloseDate', fieldName: 'CloseDate', type: 'text'},
            {label: 'Amount', fieldName: 'Amount', type: 'decimal'}  
        ]);
	},
    
    queryContacts : function(component,event,helper) {
        
        var action=component.get('c.getOpportunities');
        
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.data", response.getReturnValue());
                
            }
        });
        $A.enqueueAction(action);
    }
       
})
I need to know two things
a. what is the issue I am facing and how to resolve it
b. How many columns in total can we display in datatable

sheila
 
I am tring to get the basic right for working on force:recorddata
I want to load the record when I click any opportunity record in lightning but no record values are showing up.
<aura:component implements="flexipage:availableForAllPageTypes,
                            force:lightningQuickAction,
                            force:hasRecordId"
                             access="global">
	
    <!--define the object ion which u want to perform the operations-->
    <aura:attribute name="oppor"
                    type="Opportunity"/>

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

    <aura:attribute name="recordError" 
                    type="String" 
	                description="An error message bound to force:recordData"/>
        
    <aura:attribute name="opporRecord" 
                    type="Opportunity" 
	                description="A simplified view record object to be displayed"/>

       

    <force:recordData aura:id="forceRecordCmp"
                      recordId="{!v.recordId}"
                      targetRecord="{!v.oppor}"
                      targetFields="{!v.opporRecord}"
                      targetError="{!v.recordError}" 
                      recordUpdated="{!c.handleRecordUpdated}"
                      fields="ID,Name,StageName,Amount"/>
    
    <div class="slds-box">
    <div class="slds-text-heading_medium">
            Load Opportunity - Data Service
        </div>
        
          <div class="slds-form--stacked slds-tile">
            <div class="slds-form-element">
                <label class="slds-form-element__label"  >Name: </label>
                <div class="slds-form-element__control">
                  <ui:outputText class="slds-input" 
                    value="{!v.opporRecord.Name}" />
                </div>
            </div> 
            <div class="slds-form-element">
                <label class="slds-form-element__label" >Stage name : </label>
                <div class="slds-form-element__control">
                  <ui:outputTextArea class="slds-input"  
                    value="{!v.opporRecord.StageName}"  />
                </div>
            </div> 
              
               <div class="slds-form-element">
                <label class="slds-form-element__label" >Amount : </label>
                <div class="slds-form-element__control">
                  <ui:outputTextArea class="slds-input"  
                    value="{!v.opporRecord.Amount}"  />
                </div>
            </div> 
              
              
        </div> 
    </div>
</aura:component>

I created a new action and added the button to the page layout of opportunity object.
Now when I click any opportuntity record then I just a poup appears but I don't see any values of the selected record.

please correct me if I am doing wrong.

thanks
sheila
 
I am displaying a list of account record with a checkbox
so when the user checks a record then I need the ID of that selected record in controller for further processing.

I am using actionsupport for this but I am unable to get the ID of the selected record in controller.

Please let me know where I am going wrong and if there is a better way of doing this.
 
public class ActionSupportParamDemoController
{

    public Id targetAccountId;
    
    public Id selectedAccountId { get; set; }
    
    public ActionSupportParamDemoController(ApexPages.StandardController controller) {

    }

  public List<Account> getAccounts()
  {
    return [select ID,Name,Active__c
            from Account
            order By name
            LIMIT 10];
  }

  public PageReference handleCheckBoxChange()
  {
      system.debug('target accountid ='+targetAccountId);
      
      selectedAccountId = targetAccountId;
      
       system.debug('target accountid ='+targetAccountId);
       system.debug('selected account ID ='+selectedAccountId);
      return null;
         
  }
  
  //own method
  public Id getTargetAccountId() {
        return targetAccountId;
    }
  
  public void setTargetAccountId(Id value) {
        targetAccountId = value;
    }
}

visualforce page
<apex:page standardController="Account"
           extensions="ActionSupportParamDemoController">
         
<apex:form>

 <apex:repeat value="{!Accounts}"
                var="accn">
                
       <apex:inputCheckbox value="{!accn.Active__c}">
       <br/>
       <apex:actionSupport event="onchange"
                           action="{!handleCheckBoxChange}">
                           
                    <apex:param id="account" 
                                name="accnId" 
                                value="{!accn.ID}"
                                assignTo="{!targetAccountId}"/>
                            
       </apex:actionSupport>
       
       </apex:inputCheckbox>
       {!accn.Name}
                 
 </apex:repeat>
 {!selectedAccountId}
</apex:form>


</apex:page>

thanks
sheila
 
I need to know how to lock and unlock a record in sfdc

Please let me know frrom real time perspective what other different techniques in what scenarios it will work.

which is the best preferred?

sheila
 
Hi
I am testing my visualforce & apex coding skills .
I have implemented a extension class with standard controller to mimic the functionality of SAVE , SAVE&NEW and QUICKSAVE.
public with sharing class MimicSaveQuickSave {

    ApexPages.StandardController sController;
    
    public MimicSaveQuickSave(ApexPages.StandardController stdcontroller) {

         sController=stdcontroller;
         
    }

    public PageReference saveAndNew()
   {
   
      sController.save();
      PageReference pref=new PageReference('/003/o');
      pref.setRedirect(true);
      
      return pref;
   }
 }
<apex:page standardController="Contact" extensions="MimicSaveQuickSave">
  <apex:form >
  
    <apex:pageBlock title="My Content" mode="edit">
    
      <apex:pageBlockButtons >
      
        <apex:commandButton action="{!save}" 
                            value="Save"/>
                            
      <apex:commandButton action="{!QuickSave}" 
                            value="QuickSave"/> 

       <apex:commandButton action="{!saveAndNew}" 
                            value="SaveAndNew"/>
                            
       <apex:commandButton action="{!cancel}" 
                            value="cancel"/>

      </apex:pageBlockButtons>
      
      <apex:pageBlockSection title="My Content Section" columns="2">
        <apex:inputField value="{!contact.firstname}"/>
        <apex:inputField value="{!contact.lastname}"/>
       </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>
The SAVE &  SAVE&NEW is working but I am unable to code for QUICKSAVE
a) when I click SAVE&NEW button is it possible to redirect to the same visualforce page, so the enduser can enter the input values again.
b) how to implement QUICKSAVE functionality

Pls help me out

Thanks
sheila

 
I have a piece of code in my lightning component as follows

pCodeShortDesc = pCodeShortDesc.subtring(0,28);

this return a string like "Nebuent    Inh 300 mg"

I want to remove the two extra white spaces in the above.

Please let me know urgent how to do.

thanks
sheila
I am using google crome browser and performing inline editing on lightning datatable.

I am able to display the field values but when I edit Opportunity Name and click save its not saving.

Please let me know the issue.
 
public class DataTableController {

    @AuraEnabled
    public static List<Opportunity> getOpportunities()
    {
        List<Opportunity> oppList=new List<Opportunity>();
        
        oppList=[select Name,Account.Name,StageName,CloseDate,Amount from Opportunity
                 where Amount != NULL];
        
        return oppList;
    }
    
    @AuraEnabled
    public static void updateOpportunities(List<Opportunity> oppsList){
        try
        {
            Database.update(oppsList);
            
          }
        catch(Exception ex)
        {
            system.debug(ex.getMessage());
        }
    }
}

<aura:component implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes" 
                controller="DataTableController"
                access="global">
	
        <!-- Three important parts of datatable is Key , data and columns
         so we need attribute for data and columns(metatadata)-->
    <!-- attributes -->
    <aura:attribute name="data" 
                    type="Object"/>
    
    <aura:attribute name="columns" 
                    type="List"/>
    
<aura:attribute name="updatedRecord" type="Object[]" />

    <!-- handlers-->
    <aura:handler name="init" 
                  value="{!this}" 
                  action="{!c.doInit}"/>
    
    <lightning:card title="OpportunityDatatable">
        
        <lightning:datatable aura:id="opportunitydatatable"
                             keyField="id"
                             data="{!v.data}"
                             columns="{!v.columns}"
                             onsave="{!c.handleSaveOpps}"
                             hideCheckboxColumn="true"/>
        
</lightning:card>
    
    {!updatedRecord}

</aura:component>

({
	doInit : function(component, event, helper) {
        
        helper.queryColumns(component,event,helper);
        
        helper.queryContacts(component,event,helper);
  	},
    
    handleSaveOpps: function (component, event, helper) {
        debugger;    
        var draftValues = event.getParam('draftValues');
console.log(draftValues);
        var action = component.get('c.updateOpportunities');
        action.setParams({ 
            "oppsList": draftValues
        });
        action.setCallback(this, $A.getCallback(function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                helper.fireSuccessToast(component);  
                helper.fireRefreshEvt(component);
            } else if (state === "ERROR") {
                var errors = response.getError();
                console.error(errors);
                helper.fireFailureToast(component);  
            }
        }));
        $A.enqueueAction(action);
    }
     
})


({
	queryColumns : function(component,event,helper) {
        
		  component.set('v.columns', [
            {label: 'Opp Name', fieldName: 'Name', editable : 'true', type: 'text'},
            {label: 'Acc Name', fieldName: 'AccountName', type: 'text'},
            {label: 'StageName', fieldName: 'StageName', type: 'text'},
            {label: 'CloseDate', fieldName: 'CloseDate', type: 'date'},
            {label: 'Amount', fieldName: 'Amount', type: 'currency', cellAttributes: { alignment: 'left' }} 
        ]);
	},
    
    queryContacts : function(component,event,helper) {
        
        var action=component.get('c.getOpportunities');
        
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                
                  //the following code will display the parent account name
                 var rows = response.getReturnValue();
                 for (var i = 0; i < rows.length; i++) {
                    var row = rows[i];
                    if (row.Account) row.AccountName = row.Account.Name;
                }
                //component.set("v.data", response.getReturnValue());
                 component.set("v.data", rows);
            }
        });
        $A.enqueueAction(action);
    },
    
     fireSuccessToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Success', 
            'message' : 'Opportunities updated sucessfully.' ,
            'type':'success'
        }); 
        toastEvent.fire(); 
    },
    
    fireFailureToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Failed', 
            'message' : 'An error occurred. Please contact your administrator.',
            'type':'error'
        }); 
        toastEvent.fire(); 
    },
    
    fireRefreshEvt : function(component) {
        var refreshEvent = $A.get("e.force:refreshView");
        if(refreshEvent){
            refreshEvent.fire();
        }
    }
       
})

 
I have a piece of code in my lightning component as follows

pCodeShortDesc = pCodeShortDesc.subtring(0,28);

this return a string like "Nebuent    Inh 300 mg"

I want to remove the two extra white spaces in the above.

Please let me know urgent how to do.

thanks
sheila
A lightning component makes an api call to an external service and the result is an json response

I have given the json response as follows.
 
{"readClaimResponse": {

   "status":    {

      "statusCode": "0",

      "detail": "SUCCESS"
   },

   "claim":    {

      "claimIdentifier":       {

         "idSource": "63",

         "idValue": "183245438591000",

         "idType": "pharmacyclaims"

      },

      "claimType": "Pharmacy",  

      "billedAmount": "520",

      "allowedAmount": "500.4",

      "planPaidAmount": "400.32",

      "totalMemberResponsibility": "100.08",

      "paidToProvider": "400.32",

      "deductible": "0.00",

      "claimProcessedDate": "2018-11-20T20:51:37.001100",

      "claimStatus": "Final",

      "dateOfServiceBegin": "2018-10-15",

      "dateOfServiceEnd": "2018-10-15",

      "providerName": "CVS PHARMACY 16890",

      "amountCoinsurance": "100.08",

      "amountCopay": "0.00",

      "healthClaimLines": [      {

         "amountCopay": "0.00",

         "amountCoinsurance": "100.08",

         "billedAmount": "520",

         "allowedAmount": "500.4",

         "deductible": "0.00",

         "paidAmount": "400.32",

         "memberResponsibility": "100.08",

         "procedureCode": [         {

            "procedureCode": "63323087715",

            "procedureCodeDescr": "Nebupent     Inh 300mg"

         }],

         "healthClaimLineIdentifier":          {

            "idSource": "100",

            "idValue": "FDGP2KT5800+001",

            "idType": "Healthclaimline"

         },

         "dateOfServiceBegin": "2018-10-15",

         "dateOfServiceEnd": "2018-10-15",

         "unitsOfService": "30.000"

      }]

   }

}}
what I am not understanding is how to get the "claimType" value into an aura:attribute for further processing.
I need the value of "claimType" i.e Pharmacy into an aura:attribute for further processing.
Please let me know how to achieve this at the very earliest.
Like I do not have much exp in json

thanks
sheila
I am tring to get my basics clear while making an api call from lightning application.

But when I debug the statement  var action=resposne.getState(), the state is ERROR
 
public class httpCalloutController {

    @AuraEnabled
    public static void getCalloutResponseContents()
    {
        Http h = new Http();
      
        HttpRequest req = new HttpRequest();
		req.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
		req.setMethod('GET');      
        
        // Send the request, and return a response
		HttpResponse res = h.send(req);
		System.debug('response:--> ' + res.getBody());
        
        
        string jsonstring=(string)JSON.deserializeUntyped(res.getBody());
        system.debug('jsonstring-->' + jsonstring);
     }
}

CalloutComponent.cmp

<aura:component implements="flexipage:availableForAllPageTypes" 
                access="global"
                controller="httpCalloutController">
    
    <aura:attribute name="response" type="string"/>
    
	<aura:attribute name="jsonoutput" type="String[]"/>
    
    <lightning:button label="Make Callout" 
                      title="Make Callout"
                      onclick="{!c.MakeCallOut}"/>

    {!jsonoutput}
    
</aura:component>

CalloutComponentController.js

({
	MakeCallOut : function(component, event, helper) {
		
        debugger;
        var action=component.get('c.getCalloutResponseContents');
        
      // action.setParams({
        //    "URL":'https://th-apex-http-callout.herokuapp.com/animals'
        //});
        
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            
          console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
               component.set("v.response", response.getReturnValue());
                console.log('v.response='+v.response);
             }
        });
 
        $A.enqueueAction(action);
    },
})

thanks
sheila​​​​​​​
I have a custom button defined in the page layout of account
when I click this button, enter the account number then it should save back to object
public with sharing class InitiateApprovalController {

    public Account acc{get;set;}
    
    public string accid;
    
    public InitiateApprovalController(ApexPages.StandardController stdcontroller) {

    accid=ApexPages.CurrentPage().getParameters().get('id');
    this.acc=(Account)stdcontroller.getRecord();
    
    acc=[select ID,Name,AccountNumber from Account where ID =:acc.ID];
       
    }
    
    public InitiateApprovalController()
    {
       acc=new Account();
         
    }

    public PageReference customsave()
    {
        try{
        system.debug('acc before update ='+acc);
            
        database.Upsert(acc);
        PageReference pr=new PageReference('/'+acc.Id);

        return pr;
        }
        catch( Exception e ){
            ApexPages.addMessages(e);
            return Null;
        }       
    }
    
}

<apex:page standardController="Account"
            extensions="InitiateApprovalController">
  
  <apex:form >
  
  <apex:pageBlock mode="edit">
            <apex:pageBlockSection title="Approvers" 
                                   id="ApproversId">
                                   
             <apex:inputField Id="name" 
                              html-placeholder="Account Name.." 
                              value="{!Account.Name}" />

             <apex:inputField Id="accnumber" 
                              html-placeholder="Account Number.." 
                              value="{!Account.AccountNumber}" />
                                 
            </apex:pageBlockSection>
            
    <apex:pageBlockButtons location="bottom" html-align="right">
    
    <apex:commandButton id="customsave1"
                        value="save"
                        action="{!customsave}"/>
                        
    </apex:pageBlockButtons>
    
     </apex:pageBlock>
  </apex:form>
    
</apex:page>
I am surprised because I am using Database.Upsert but still it is not saving to object

Can any one please let me know?

Thanks
sheila
 
I am using google crome browser and performing inline editing on lightning datatable.

I am able to display the field values but when I edit Opportunity Name and click save its not saving.

Please let me know the issue.
 
public class DataTableController {

    @AuraEnabled
    public static List<Opportunity> getOpportunities()
    {
        List<Opportunity> oppList=new List<Opportunity>();
        
        oppList=[select Name,Account.Name,StageName,CloseDate,Amount from Opportunity
                 where Amount != NULL];
        
        return oppList;
    }
    
    @AuraEnabled
    public static void updateOpportunities(List<Opportunity> oppsList){
        try
        {
            Database.update(oppsList);
            
          }
        catch(Exception ex)
        {
            system.debug(ex.getMessage());
        }
    }
}

<aura:component implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes" 
                controller="DataTableController"
                access="global">
	
        <!-- Three important parts of datatable is Key , data and columns
         so we need attribute for data and columns(metatadata)-->
    <!-- attributes -->
    <aura:attribute name="data" 
                    type="Object"/>
    
    <aura:attribute name="columns" 
                    type="List"/>
    
<aura:attribute name="updatedRecord" type="Object[]" />

    <!-- handlers-->
    <aura:handler name="init" 
                  value="{!this}" 
                  action="{!c.doInit}"/>
    
    <lightning:card title="OpportunityDatatable">
        
        <lightning:datatable aura:id="opportunitydatatable"
                             keyField="id"
                             data="{!v.data}"
                             columns="{!v.columns}"
                             onsave="{!c.handleSaveOpps}"
                             hideCheckboxColumn="true"/>
        
</lightning:card>
    
    {!updatedRecord}

</aura:component>

({
	doInit : function(component, event, helper) {
        
        helper.queryColumns(component,event,helper);
        
        helper.queryContacts(component,event,helper);
  	},
    
    handleSaveOpps: function (component, event, helper) {
        debugger;    
        var draftValues = event.getParam('draftValues');
console.log(draftValues);
        var action = component.get('c.updateOpportunities');
        action.setParams({ 
            "oppsList": draftValues
        });
        action.setCallback(this, $A.getCallback(function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                helper.fireSuccessToast(component);  
                helper.fireRefreshEvt(component);
            } else if (state === "ERROR") {
                var errors = response.getError();
                console.error(errors);
                helper.fireFailureToast(component);  
            }
        }));
        $A.enqueueAction(action);
    }
     
})


({
	queryColumns : function(component,event,helper) {
        
		  component.set('v.columns', [
            {label: 'Opp Name', fieldName: 'Name', editable : 'true', type: 'text'},
            {label: 'Acc Name', fieldName: 'AccountName', type: 'text'},
            {label: 'StageName', fieldName: 'StageName', type: 'text'},
            {label: 'CloseDate', fieldName: 'CloseDate', type: 'date'},
            {label: 'Amount', fieldName: 'Amount', type: 'currency', cellAttributes: { alignment: 'left' }} 
        ]);
	},
    
    queryContacts : function(component,event,helper) {
        
        var action=component.get('c.getOpportunities');
        
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                
                  //the following code will display the parent account name
                 var rows = response.getReturnValue();
                 for (var i = 0; i < rows.length; i++) {
                    var row = rows[i];
                    if (row.Account) row.AccountName = row.Account.Name;
                }
                //component.set("v.data", response.getReturnValue());
                 component.set("v.data", rows);
            }
        });
        $A.enqueueAction(action);
    },
    
     fireSuccessToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Success', 
            'message' : 'Opportunities updated sucessfully.' ,
            'type':'success'
        }); 
        toastEvent.fire(); 
    },
    
    fireFailureToast : function(component) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({ 
            'title' : 'Failed', 
            'message' : 'An error occurred. Please contact your administrator.',
            'type':'error'
        }); 
        toastEvent.fire(); 
    },
    
    fireRefreshEvt : function(component) {
        var refreshEvent = $A.get("e.force:refreshView");
        if(refreshEvent){
            refreshEvent.fire();
        }
    }
       
})

 
I just started working on lightning datatable.

The code is working but StageName , closedate and amount values are not displayed.
 
public class DataTableController {

    @AuraEnabled
    public static List<Opportunity> getOpportunities()
    {
        List<Opportunity> oppList=new List<Opportunity>();
        
        oppList=[select name,Account.Name,StageName,CloseDate,Amount from Opportunity
                       where StageName != NULL
                       AND
                       Amount != NULL
                       order by Account.Name];
        
        return oppList;
    }
}

<aura:component implements="force:appHostable,force:hasRecordId,flexipage:availableForAllPageTypes" 
                controller="DataTableController"
                access="global">
	
        <!-- Three important parts of datatable is Key , data and columns
         so we need attribute for data and columns(metatadata)-->
    <!-- attributes -->
    <aura:attribute name="data" 
                    type="Object"/>
    
    <aura:attribute name="columns" 
                    type="List[]"/>
    

    <!-- handlers-->
    <aura:handler name="init" 
                  value="{!this}" 
                  action="{!c.doInit}"/>
    
    <!-- the container element determine the height of the datatable -->
    <div style="height: 300px">
        
        <lightning:datatable aura:id="opportunitydatatable"
                             
                             keyField="id"
                             data="{!v.data}"
                             columns="{!v.columns}"
                             hideCheckboxColumn="true"/>
        
    </div>
</aura:component>

({
	doInit : function(component, event, helper) {
        
        helper.queryColumns(component,event,helper);
        
        helper.queryContacts(component,event,helper);
  	}
})

({
	queryColumns : function(component,event,helper) {
        
		  component.set('v.columns', [
            {label: 'Opp Name', fieldName: 'Name', type: 'text'},
            {label: 'Acc Name', fieldName: 'Name', type: 'text'},
            {label: 'StageName', fieldName: 'Stage Name', type: 'text'},
            {label: 'CloseDate', fieldName: 'CloseDate', type: 'text'},
            {label: 'Amount', fieldName: 'Amount', type: 'decimal'}  
        ]);
	},
    
    queryContacts : function(component,event,helper) {
        
        var action=component.get('c.getOpportunities');
        
        action.setParams({
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.data", response.getReturnValue());
                
            }
        });
        $A.enqueueAction(action);
    }
       
})
I need to know two things
a. what is the issue I am facing and how to resolve it
b. How many columns in total can we display in datatable

sheila
 
I am tring to get the basic right for working on force:recorddata
I want to load the record when I click any opportunity record in lightning but no record values are showing up.
<aura:component implements="flexipage:availableForAllPageTypes,
                            force:lightningQuickAction,
                            force:hasRecordId"
                             access="global">
	
    <!--define the object ion which u want to perform the operations-->
    <aura:attribute name="oppor"
                    type="Opportunity"/>

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

    <aura:attribute name="recordError" 
                    type="String" 
	                description="An error message bound to force:recordData"/>
        
    <aura:attribute name="opporRecord" 
                    type="Opportunity" 
	                description="A simplified view record object to be displayed"/>

       

    <force:recordData aura:id="forceRecordCmp"
                      recordId="{!v.recordId}"
                      targetRecord="{!v.oppor}"
                      targetFields="{!v.opporRecord}"
                      targetError="{!v.recordError}" 
                      recordUpdated="{!c.handleRecordUpdated}"
                      fields="ID,Name,StageName,Amount"/>
    
    <div class="slds-box">
    <div class="slds-text-heading_medium">
            Load Opportunity - Data Service
        </div>
        
          <div class="slds-form--stacked slds-tile">
            <div class="slds-form-element">
                <label class="slds-form-element__label"  >Name: </label>
                <div class="slds-form-element__control">
                  <ui:outputText class="slds-input" 
                    value="{!v.opporRecord.Name}" />
                </div>
            </div> 
            <div class="slds-form-element">
                <label class="slds-form-element__label" >Stage name : </label>
                <div class="slds-form-element__control">
                  <ui:outputTextArea class="slds-input"  
                    value="{!v.opporRecord.StageName}"  />
                </div>
            </div> 
              
               <div class="slds-form-element">
                <label class="slds-form-element__label" >Amount : </label>
                <div class="slds-form-element__control">
                  <ui:outputTextArea class="slds-input"  
                    value="{!v.opporRecord.Amount}"  />
                </div>
            </div> 
              
              
        </div> 
    </div>
</aura:component>

I created a new action and added the button to the page layout of opportunity object.
Now when I click any opportuntity record then I just a poup appears but I don't see any values of the selected record.

please correct me if I am doing wrong.

thanks
sheila
 
I am displaying a list of account record with a checkbox
so when the user checks a record then I need the ID of that selected record in controller for further processing.

I am using actionsupport for this but I am unable to get the ID of the selected record in controller.

Please let me know where I am going wrong and if there is a better way of doing this.
 
public class ActionSupportParamDemoController
{

    public Id targetAccountId;
    
    public Id selectedAccountId { get; set; }
    
    public ActionSupportParamDemoController(ApexPages.StandardController controller) {

    }

  public List<Account> getAccounts()
  {
    return [select ID,Name,Active__c
            from Account
            order By name
            LIMIT 10];
  }

  public PageReference handleCheckBoxChange()
  {
      system.debug('target accountid ='+targetAccountId);
      
      selectedAccountId = targetAccountId;
      
       system.debug('target accountid ='+targetAccountId);
       system.debug('selected account ID ='+selectedAccountId);
      return null;
         
  }
  
  //own method
  public Id getTargetAccountId() {
        return targetAccountId;
    }
  
  public void setTargetAccountId(Id value) {
        targetAccountId = value;
    }
}

visualforce page
<apex:page standardController="Account"
           extensions="ActionSupportParamDemoController">
         
<apex:form>

 <apex:repeat value="{!Accounts}"
                var="accn">
                
       <apex:inputCheckbox value="{!accn.Active__c}">
       <br/>
       <apex:actionSupport event="onchange"
                           action="{!handleCheckBoxChange}">
                           
                    <apex:param id="account" 
                                name="accnId" 
                                value="{!accn.ID}"
                                assignTo="{!targetAccountId}"/>
                            
       </apex:actionSupport>
       
       </apex:inputCheckbox>
       {!accn.Name}
                 
 </apex:repeat>
 {!selectedAccountId}
</apex:form>


</apex:page>

thanks
sheila
 
Hi
I am testing my visualforce & apex coding skills .
I have implemented a extension class with standard controller to mimic the functionality of SAVE , SAVE&NEW and QUICKSAVE.
public with sharing class MimicSaveQuickSave {

    ApexPages.StandardController sController;
    
    public MimicSaveQuickSave(ApexPages.StandardController stdcontroller) {

         sController=stdcontroller;
         
    }

    public PageReference saveAndNew()
   {
   
      sController.save();
      PageReference pref=new PageReference('/003/o');
      pref.setRedirect(true);
      
      return pref;
   }
 }
<apex:page standardController="Contact" extensions="MimicSaveQuickSave">
  <apex:form >
  
    <apex:pageBlock title="My Content" mode="edit">
    
      <apex:pageBlockButtons >
      
        <apex:commandButton action="{!save}" 
                            value="Save"/>
                            
      <apex:commandButton action="{!QuickSave}" 
                            value="QuickSave"/> 

       <apex:commandButton action="{!saveAndNew}" 
                            value="SaveAndNew"/>
                            
       <apex:commandButton action="{!cancel}" 
                            value="cancel"/>

      </apex:pageBlockButtons>
      
      <apex:pageBlockSection title="My Content Section" columns="2">
        <apex:inputField value="{!contact.firstname}"/>
        <apex:inputField value="{!contact.lastname}"/>
       </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>
The SAVE &  SAVE&NEW is working but I am unable to code for QUICKSAVE
a) when I click SAVE&NEW button is it possible to redirect to the same visualforce page, so the enduser can enter the input values again.
b) how to implement QUICKSAVE functionality

Pls help me out

Thanks
sheila

 
I have a parent visualforce page which has 4 fields  approver_1 , approver_2 , approver_3 and approver_4 which is lookup to user.

I have added a custom button called "InitiateApprovalProcess" in the standard layout of the page
When I click this button it opens as a popup(visualforce page), I have shown the code below where I will enter the field values.
This popup (visualforce page) has save and cancel buttons.

When I click save button it saves the values to the parent, I mean the parent page should get refreshed with the values from the popup.

vf page:
=======
<apex:page standardController="MedConnect__FDA_3500A_MedWatch_Report__c" extensions="VY_InitiateApprovalProcess_Controller" lightningStylesheets="true">
<apex:includeScript value="{!$Resource.MedConnect__jquery}" />
    <apex:includeScript value="{!URLFOR($Resource.MedConnect__jquery_ui,'jquery-ui-1.10.3/ui/minified/jquery-ui.min.js')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.MedConnect__jquery_ui,'jquery-ui-1.10.3/themes/base/jquery-ui.css')}"/>
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection title="Approvers" id="ApproversId">
    <apex:inputField Id="appId1" html-placeholder="Search People..." value="{!Approver.VY_Approver1__c}" />
    <apex:inputField Id="appId2" html-placeholder="Search People..." value="{!Approver.VY_Approver2__c}" />
    </apex:pageBlockSection>
    <apex:pageBlockSection >
    <apex:inputField Id="appId3" html-placeholder="Search People..." value="{!Approver.VY_Approver3__c}" />
    <apex:inputField Id="appId4" html-placeholder="Search People..." value="{!Approver.VY_Approver4__c}" />
    </apex:pageBlockSection>
    <apex:pageBlockButtons location="bottom" html-align="right">
    <button class="btn" onclick="window.open('/{!$CurrentPage.parameters.id}', target='_self');return false;">Cancel</button>
     <apex:commandButton action="{!customSave}" value="Save" onClick="Window.Close()" onomplete="window.top.location.reload()"/>
     
    </apex:pageBlockButtons>
    </apex:pageBlock>
</apex:form>
    <script language="JavaScript" type="text/javascript">
function CloseAndRefresh(){
window.opener.location.href="/{!$CurrentPage.parameters.ID}";
      self.close();
  }
</script>
</apex:page>

apex controller of poup page
======================
public with sharing class VY_InitiateApprovalProcess_Controller
{
    public id ReportIds;
    public MedConnect__FDA_3500A_MedWatch_Report__c Approver { get; set; }
   
    public VY_InitiateApprovalProcess_Controller(ApexPages.StandardController controller) {
        ReportIds = ApexPages.CurrentPage().getParameters().get('id');
        this.Approver = (MedConnect__FDA_3500A_MedWatch_Report__c)controller.getRecord();
        Approver =[SELECT Id,VY_Approver1__c,VY_Approver2__c,VY_Approver3__c,VY_Approver4__c
                            FROM
                            MedConnect__FDA_3500A_MedWatch_Report__c WHERE Id =:ReportIds];
    }
    public VY_InitiateApprovalProcess_Controller()
    {
        Approver = new MedConnect__FDA_3500A_MedWatch_Report__c();
    }
   
    public PageReference customSave()
    {
        PageReference pr;
        try{
            database.upsert(Approver);
            //closeWindow = true;
            pr = new PageReference('/'+Approver.Id );
        }catch( Exception e ){
            ApexPages.addMessages(e);
        }
        return Null;       
    }}

I require 2 functionalities as follows

a) when user click save the popup page should close and the parent page should be refreshed with the updated field values.

b) when I click cancel button the page should close.

Please help me out with this functionality with working code, I am not very good in javascript.

Thanks
sheila


c)
 
I have a custom setting called BindValues__c which has a single field say value__c
It contains values as : A1  1   , A2  2   , A3  3  ,  A4  4 , A5  5 , A6  6 , A7 7 , A8  8 , A9  9 , A10  10 , A11  11

I have worked on a code which binds the values into a picklist as shown below , also I attached a screen shot to show my requirement.

custom setting
values

data
public class CodeGeneratorController {
    public List<SelectOption> Values { get; set; }
    
    public CodeGeneratorController() {
        getValues();
    }
    
    public void getValues() {
        Values = new List<SelectOption>();
        
        List<BindVaues__c> allValues = new List<BindVaues__c>();

        allValues=[SELECT  Name FROM BindVaues__c];
        
        for( BindVaues__c val : allValues) {
          Values.add( new SelectOption( val.Id, val.Name) );
        }
    }
}
<apex:page controller="CodeGeneratorController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:outputLabel value="Values :"/>
                  
                <apex:selectList size="1">
                    <apex:selectOptions value="{!Values}"/>
                </apex:selectList>
             </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
My requirement is I need to access values from 1 to 5 , then do some processing , then values from 6 to 11 then do some other logic.

so I need to split the custom setting values into 2 parts i. 1 to  5 and   6  to 11.
I hope I am clear.
Please let me know how I can proceed further.

Thanks
sheila
 
My understanding of application event is if two components not related to each then we can use applicaiton event to pass data.

Please correct me if wrong.

I have done a code but I am unable to pass data.
ApplicationEvent.vt

<aura:event type="APPLICATION" description="Event template">

<aura:attribute name="message"
                type="string"
                access="public"/>
    
</aura:event>


ParentComponent.cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
	
    <aura:attribute name="someattr"
                    type="string"
                    default="I am GOD"
                    access="private"/>
    
    <aura:registerEvent name="handleApplicationEvent"
                        type="c.ApplicationEvent"/>
    
    <lightning:button name="clickMe"
                      label="ClickMe"
                      onclick="{!c.HandleApplicationEvent}"/>
    
    
</aura:component>


PrentComponentController.js

({
	HandleApplicationEvent : function(component, event, helper) {
		
        debugger;
        var applnEvent=$A.get("e.c:ApplicationEvent");
        
        
        var val=component.get("v.someattr");
        console.log(val);
        
        applnEvent.setParams({"message" : val});
        
        applnEvent.fire();
     }
})


ChildComponent.cmp

<aura:component >
	
    <aura:attribute name="receivedvaluefromparent"
                    type="string"
                    access="private"/>
    
    <aura:handler event="c:ApplicationEvent"
                  action="{!c.HandleApplicationEvent}"/>
    
    <c:ParentComponent/>
    Inside the child component : {!v.receivedvaluefromparent}
    
</aura:component>


ChildComponent.js

({
	HandelApplicationEvent : function(component, event, helper) {
		
        debugger;
        var evtMessage=event.getParam("message");
        
        console.log(evtMessage);
        component.set("v.receivedvaluefromparent",evtMessage.ToString());
        
	}
})


MainApp.app

<aura:application >
    <c:ParentComponent/>
</aura:application>

I checked using debugger but value is not comoing into the child attribute from the parent.

Please let me know where I go wrong.

thanks
sheila S
 
I am working on @Future methods and quueueable apex.

we can monitor queueable job from apex jobs, get JOB ID and check the status of queueable apex job using the object AsynApexJob from workbench.

a] My question is can we do all of the above for a method marked with @future?

b] can we use database.stateful with queueable apex?

c] can we schedule a queueable job by specifying a cron string ?

c]  what is flexipage queue and how does it work..

Please elaborate in details and I request forum memebers to be specific.

thanks
sheila
Hi, I have all latest dumps of  Salesforce exams SPRING 2017 if anyone wants you can mail me at sfdcconsultant25@gmail.com

These are original questions from the certification exam and very useful to pass the exam.

I have all latest dumps of following exams
90% questions come from it

Salesforce Administrator (ADM 201)
Salesforce Sales Cloud Consultant (CON 201)
Salesforce Service Cloud Consultant
Platform Developer I
App Builder

Immediately I will send dumps latest one, as-surety which helps you to pass 

I will as surety for all latest dumps