Forum Replies Created

  • Rabn

    Member
    February 8, 2020 at 4:10 AM in reply to: What is an Audit trail in Salesforce?

    Audit trail are used to keep a track on the changes which has been made on a record for certain fields.

    Suppose you want to keep a track on opportunity stage field changes. So you enable the audit trail.

    So in this case , each time any user changes the stage , audit trail will keep the track who changed this field from what stage to what stage and when they did this change etc....

  • Apex Class:

    public class AcctController {
        @AuraEnabled
        public static List<Account> getAccnt(){
            List<Account> categeroy = [Select  Name,Industry,Phone from Account];
            return categeroy;
        } 
        }

    Lightning Component:

    <aura:component controller="AcctController ">
        <aura:attribute name="acctList" type="Account[]" />
        <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
        
        <lightning:accordion aura:id="accordion">
            <aura:iteration items="{!v.acctList}" var="acct">
                <lightning:accordionSection name="A" label="{!acct.Name}" >
                    <aura:set attribute="body">
                        
                        <table class="slds-table slds-table--bordered slds-table--cell-buffer slds-table--striped slds-max-medium-table--stacked-horizontal"
                               role="grid">
                            <thead>
                                <tr>
                                    <th class="slds-is-sortable slds-cell-wrap" scope="col">
                                        Name
                                    </th>
                                    <th class="slds-is-sortable slds-cell-wrap" scope="col">
                                        Phone
                                    </th>
                                    <th class="slds-is-sortable slds-cell-wrap" scope="col">
                                        Industry
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <aura:iteration items="{!acct.Account}" var="accnt">
                                    <tr class="slds-hint-parent">
                                        <td role="gridcell" class="slds-cell-wrap">
                                            <div class="">{!accnt.Name}</div>
                                        </td>
                                        <td role="gridcell" class="slds-cell-wrap">
                                            <div class="" data-label="Role">{!accnt.Phone}</div>
                                        </td>
                                        <td role="gridcell" class="slds-cell-wrap">
                                            <div class="" data-label="Role">{!accnt.Industry}</div>
                                        </td>
                                        
                                    </tr>
                                    
                                </aura:iteration>
                            </tbody>
                        </table>
                    </aura:set>
                </lightning:accordionSection>
            </aura:iteration>
            
        </lightning:accordion>
        
        
    </aura:component>

    Controller:

    ({
        doInit : function(component, event, helper) {
            var action = component.get("c.getAccnt");
            action.setCallback(this, function(a) {
                component.set("v.acctList", a.getReturnValue());
            });
            $A.enqueueAction(action);
        }
    })

     

  • Rabn

    Member
    February 8, 2020 at 3:50 AM in reply to: What is the use of scheduler class in Salesforce?

    Scheduler class is basically an apex class or a batch class which you want to run it at certain point of time.

    Suppose you want to send an mass email to all your contacts on the end of every month. In that case you can schedule a class which will automatically send the emails on every month end.

    For scheduling an apex class, you can do the following

    From Setup, enter Apex Classes in the Quick Find box, select Apex Classes, and then click Schedule Apex.
    Specify the name of a class that you want to schedule.
    Specify how often the Apex class is to run.For Weekly—specify one or more days of the week the job is to run (such as Monday and Wednesday).
    For Monthly—specify either the date the job is to run or the day (such as the second Saturday of every month.)

  • Rabn

    Member
    February 8, 2020 at 3:47 AM in reply to: How to use Find function in formula field in salesforce in Salesforce ?

    FIND() will return the position of the start of the string you are looking for.

    FIND('#', Name) -  returns the character position of the first # in the Name field

  • Rabn

    Member
    February 6, 2020 at 11:18 PM in reply to: How can we call a batch class from trigger in Salesforce?

    Below link will help you in calling a batch class from a trigger.

     

    https://developer.salesforce.com/forums/?id=906F0000000DBkFIAW

  • Rabn

    Member
    February 6, 2020 at 3:15 PM in reply to: In how many ways a field can be made required in Salesforce?

    A field can be made required in Different ways.

     

    • While creating a field , you can make it required
    • From the Page Layout you can make it required.
    • Validation rule can help you in making the field as required.
    • Also in code, you can make the field mandatory