Forum Replies Created

Page 7 of 8
  • Aman

    Member
    July 28, 2017 at 1:11 pm in reply to: How we retrieve metadata and its components through workBench?

    Hello Shubham,

    you can select Info  then in the drop-down select MetaData types and components in workbench.

     

    MetadataTypes

     

  • Aman

    Member
    July 28, 2017 at 1:06 pm in reply to: How to empty recycle bin using workbench?

    Hello shariq,

    you can use purge function in the Data feature of workbench.purge

  • Aman

    Member
    July 28, 2017 at 12:50 pm in reply to: How to deactivate flow through WorkBench?

    Hello Shubham,

    you can use the workbench Migration feature to deactivate flow through workbench.

    you can refer below given Link :

    https://help.salesforce.com/articleView?id=000221117&type=1

     

  • Aman

    Member
    July 27, 2017 at 9:43 am in reply to: How to query for custom object in salesforce?

    Hello Shariq,

    you can try this :

    select name,(select name from Childs1__r) from Master__c .

    you can refer this link :

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

     

  • Aman

    Member
    July 26, 2017 at 12:43 pm in reply to: Can we change the system fields of the Salesforce sObject?

    Hello Shariq,

    we can't edit the standard fields of the sobject but we can edit the fields of custom object.

  • Aman

    Member
    July 26, 2017 at 11:23 am in reply to: What is the use of Remote Action notation in Salesforce?

    Hello Shariq,

    The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript. This process is often referred to as JavaScript remoting.

    you can refer this link:

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_RemoteAction.htm

  • Aman

    Member
    July 25, 2017 at 1:08 pm in reply to: Difference between Data Import Wizard and Data Loader in Salesforce?

    Hello Shubham,

    Import Wizard:

    For simple imports of up to 50000 records.
    It supports all custom objects and only few standard objects like Account, Contact, Leads, Solution.
    It supports schedule export.
    Delete operation is not available.
    We cannot export data.
    It doesn’t require installation.
    While importing, duplicates can be ignored.
    Data Loader:

    For complex imports of any size more than 50000 records.
    It supports all standard and custom objects.
    It doesn’t support schedule export.
    Delete operation is available.
    We can export data of all custom & standard objects, and can import all custom & standard objects except User standard object.
    It requires installation.
    While importing, duplicates cannot be ignored.

  • Hello Shariq,

    The developer settings cannot be changed once they have been set. Currently, to change the namespace prefix, you would need to create a new DE org and move your components over (through an unmanaged package).

  • Aman

    Member
    July 25, 2017 at 9:34 am in reply to: What is the difference Web-to-Case and Email-to-Case?

    Web-to-Case :

    Web To Case is a means by which you can post a simple, unauthenticated web page that allows your customers. to submit cases directly to your Salesforce.com instance.This can help your organization respond to customers faster, improving your support team's productivity.

    Email-to-Case :

    Salesforce can automatically create a case when an email is sent to one of your company's email addresses, such as [email protected]. This Email-to-Case functionality auto-populates case fields from the content of each email. For example, an email subject heading becomes a case subject. Your organization can set up Email-to-Case or On-Demand Email-to-Case to efficiently resolve and correspond with customer inquiries via email. Salesforce allows you to choose one of two Email-to-Case options:

     

  • Aman

    Member
    July 21, 2017 at 1:50 pm in reply to: What is the difference between unique and external fields?

    Hello Saloni,

    External Fields:

    An external ID is a custom field that has the External ID attribute, meaning that it contains unique record identifiers from a system outside of Salesforce. When you select this option, the Data Import Wizard detects existing records in Salesforce with external IDs that match those in the import file.

    Unique Fields :
    This is a setting for the field that will prevent you from using the same value in multiple records for the unique field. So if I create a 5 character text field and make it unique, and I create a record with the value "12345" I will not be able to create another record with that same value in the unique field. If I try to do so, I will get an error saying that the value is already in use.

  • Aman

    Member
    July 21, 2017 at 1:35 pm in reply to: how to create a output link without any value?

    Hello saloni,

    you can try this

    <apex:outputlink value="#">Name</apex:outputlink>

  • Aman

    Member
    July 21, 2017 at 12:23 pm in reply to: What is Database.rollback in Salesforce?

    Hello Shariq,

    Before You Started With Database.rollback  you must knew about Database.savepoint .

    Database.savepoint :

    database.savepoint is a method which is used to define a point which can be roll back to. If any error occurs during a transaction, that contains many statements, the application will roll back to the most recent savepoint and the entire transaction will not be aborted. Any DML statement that occurs after the savepoint can be discarded, and the database can be restored to the same condition it was in at the time you generated the savepoint.

    you can refer to the following code:

    Account a = new Account(Name = 'xxx'); insert a;
    System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
    AccountNumber);

    // Create a savepoint while AccountNumber is null
    Savepoint sp = Database.setSavepoint();

    // Change the account number
    a.AccountNumber = '123';
    update a;
    System.assertEquals('123', [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
    AccountNumber);

    // Rollback to the previous null value
    Database.rollback(sp);
    System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
    AccountNumber);

  • Aman

    Member
    July 21, 2017 at 9:07 am in reply to: Can we create custom object through Salesforce apex code?

    Hello shariq,

    You can create a custom object using Metadata API

     

    CRUD-Based Metadata Development
    Use the CRUD-based metadata calls to create, update, or delete setup and configuration components for your organization or application. These configuration components include custom objects, custom fields, and other configuration metadata. The metadata calls mimic the behavior in the Salesforce user interface for creating, updating, or deleting components. Whatever rules apply there also apply to these calls.

    Metadata calls are different from the core, synchronous API calls in the following ways:Metadata API calls are available in a separate WSDL. To download the WSDL, log into Salesforce, from Setup, enter APIin the Quick Find box, then select API and click the Download Metadata WSDL link.
    After logging in, you must send Metadata API calls to the Metadata API endpoint, which has a different URL than the SOAP API. Retrieve the metadataServerUrl from the LoginResult returned by your SOAP API login() call. For more information about the SOAP API, see the SOAP API Developer's Guide.
    Metadata calls are either synchronous or asynchronous. CRUD calls are synchronous in API version 30.0 and later, and similar to the API core calls the results are returned in a single call. In earlier API versions, create, update, and delete are only asynchronous, which means that the results are not immediately returned in one call.
    There are synchronous metadata calls that map to the corresponding core SOAP API synchronous calls.createMetadata() maps to the create() SOAP API call.
    updateMetadata() maps to the update() SOAP API call.
    deleteMetadata() maps to the delete() SOAP API call.

     

  • Aman

    Member
    July 20, 2017 at 1:38 pm in reply to: What is Content Document in Salesforce?

    Hello Shariq,

    Content Document Represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files.This object is available in API versions 17.0 and later for Salesforce CRM Content. This object is available in API version 21.0 and later for Salesforce Files.

    Supported Calls
    delete(), describeLayout()describeSObjects(), query(), retrieve(), search(), undelete(), update()

    you may refer to

    https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm

  • Hello Shariq,

    Regardless of what kind of action you’re going to create, the first thing you need to determine is whether it should be object-specific or global. This decision should be based on whether you need your action to be explicitly tied to an object, and where you want the action to display.
    Let’s go over the differences.

    Object-Specific Actions
    You create object-specific actions in the context of the object. From the management settings for the object for which you want to create an action, go to Buttons, Links, and Actions. You can add an object-specific action only to page layouts for that object.

    There are five types of object-specific actions.Object-specific create actions create records that are automatically associated with related records. For example, you add an object-specific action on the Account object that creates contacts. If a user creates a contact with that action on the detail page for the Acme account, that new contact is automatically associated with Acme.
    Object-specific update actions make it easy for users to edit records. You can define the fields that are available for update.

    Object-specific Log a Call actions let users enter notes about calls, meetings, or other interactions that are related to a specific record.
    Object-specific custom actions invoke Lightning components, Visualforce pages, or canvas apps that let users interact with or create records that have a relationship to an object record. The Visualforce page for an object-specific custom action must include the standard controller for the relevant object. For example, use the standard contact controller to create a custom action that lets users import a contact’s Twitter profile and add that information to a contact record.
    Send email actions, available only on cases, give users access to a simplified version of the Case Feed Email action on Salesforce1.

    Global Actions
    You create global actions in a different place in Setup than you create object-specific actions. To create a global action, from Setup, enter Actions in the Quick Find box, then select Global Actions. They’re called global actions because they can be put anywhere actions are supported.

    Global create actions enable users to create object records, but the new record has no relationship with other records.

    Add Log a Call actions to global layouts to let users record call details. For example, users can log calls from global pages in Salesforce Classic such as the Home page and the Chatter tab, or in Salesforce1 from the Feed or Groups pages. In Lightning Experience, Log a Call actions on global layouts display in the Global Actions menu.

    Use a Visualforce page, Lightning component, or a canvas app to create global custom actions for tasks that don’t require users to use records that have a relationship to a specific object.

  • Aman

    Member
    July 19, 2017 at 1:33 pm in reply to: Can we make nested page block table in Salesforce?

    Hello Shariq,

    yes ,we can make nested Page block table. you can refer to the below given visualforce Page and Apex class.

    visualforce Page

    <apex:page controller="SearchAccountCon" tabStyle="Account">
    <apex:form >
    <apex:pageMessages />
    <apex:inputText value="{!searchString}" />
    <apex:commandButton value="search" action="{!search}"/>
    <apex:pageBlock >
    <apex:pageBlockTable value="{!acct}" var="acc">
    <apex:column value="{!acc.Id}" />
    <apex:column value="{!acc.description}" />
    <apex:column >
    <apex:pageBlockTable value="{!acc.contacts}" var="c">
    <apex:column value="{!c.Id}"/>
    <apex:column value="{!c.LastName}"/>
    </apex:pageBlockTable>
    </apex:column>
    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Apex class

    public class SearchAccountCon {
    public static String searchString {get; set; }
    public static List<Account> acct{get;set;}

    public static void search(){
    try{
    acct= Database.query('Select Name, description,(select id, Name,LastName From Contacts) From Account WHERE Name LIKE \'%'+searchString+'%\' Limit 100');
    system.debug('ddd'+acct);
    }
    catch(Exception e){
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter Account site'));
    }
    }

    }

     

     

  • Hello Shariq,

    apex:commandLink:
    A link that executes an action defined by a controller, and then either refreshes the current page, or navigates to a different page based on the PageReference variable that is returned by the action. An <apex:commandLink> component must always be a child of an <apex:form> component.

    eg.
    <apex:commandLink action="{!save}" value="Save" id="theCommandLink"/>

    apex:outputLink:
    A link to a URL. This component is rendered in HTML as an anchor tag with an href attribute. Like its HTML equivalent, the body of an <apex:outputLink> is the text or image that displays as the link. To add query string parameters to a link, use nested<apex:param> components.

    eg.
    <apex:outputLink value="https://www.salesforce.com" id="theLink">www.salesforce.com</apex:outputLink>

  • Aman

    Member
    July 19, 2017 at 1:09 pm in reply to: what is the use of webservice method in Salesforce?

    Hello Saloni,

    Apex class methods can be exposed as custom SOAP Web service calls. This allows an external application to invoke an Apex Web service to perform an action in Salesforce. Use the webService keyword to define these methods. For example:

    global class MyWebService {
    webService static Id makeContact(String lastName, Account a) {
    Contact c = new Contact(lastName = 'Weissman', AccountId = a.Id);
    insert c;
    return c.id;
    }
    }

    A developer of an external application can integrate with an Apex class containing webService methods by generating a WSDL for the class. To generate a WSDL from an Apex class detail page:
    1. In the application from Setup, enter “Apex Classes” in the Quick Find box, then select Apex Classes.
    2. Click the name of a class that contains webService methods.
    3. Click Generate WSDL.

     

  • Aman

    Member
    July 18, 2017 at 2:12 pm in reply to: How to add images to lightning salesforce page?

    Hello Shariq,

    $Resource
    The $Resource global value provider lets you reference images, style sheets, and JavaScript code you’ve uploaded in static resources.
    Using $Resource lets you reference assets by name, without worrying about the gory details of URLs or file paths. You can use $Resource in Lightning components markup and within JavaScript controller and helper code.

    Using $Resource in Component Markup
    To reference a specific resource in component markup, use $Resource.resourceName within an expression.resourceName is the Name of the static resource. In a managed packaged, the resource name must include the package namespace prefix, such as $Resource.yourNamespace__resourceName. For a stand-alone static resource, such as an individual graphic or script, that’s all you need. To reference an item within an archive static resource, add the rest of the path to the item using string concatenation. Here are a few examples.

    <aura:component>
    <!-- Stand-alone static resources -->
    <img src="{!$Resource.generic_profile_svg}"/>
    <img src="{!$Resource.yourNamespace__generic_profile_svg}"/>

    <!-- Asset from an archive static resource -->
    <img src="{!$Resource.SLDSv2 + '/assets/images/avatar1.jpg'}"/>
    <img src="{!$Resource.yourNamespace__SLDSv2 + '/assets/images/avatar1.jpg'}"/>
    </aura:component>

     

     

  • Aman

    Member
    July 18, 2017 at 2:02 pm in reply to: Can we mass delete reports using Salesforce Apex ?

    Hello Saloni,

    As of now there is no such functionality exists in Salesforce.

  • Hello Saloni,

    Visualforce components are page-centric and most of the work is done on the server. Lightning is designed from the component up, rather than having the concept of a page as its fundamental unit. Lightning Components are client-side centric, which makes them more dynamic and mobile friendly.

    Lightning was designed to follow an App-Centric model. This essentially means that it has been designed to create self-contained components that build on top of each other. To put this in perspective, with Visualforce you would send an interaction to the Salesforce server and then update the entire page. However, with Lightning, you can send an interaction to the Salesforce servers and then update a specific component. This has huge implications for performance and for the fluid motion of a UI. This allows us to design UIs that are inherently responsive to the user interactions, meaning we update the things the user is interacting with and everything else remains untouched.

     

  • Aman

    Member
    July 18, 2017 at 5:19 am in reply to: What is sharing class in Salesforce?

    Hello Raghav,

    Apex generally runs in system context; that is, the current user's permissions, field-level security, and sharing rules aren’t taken into account during code execution.

    Because these rules aren't enforced, developers who use Apex must take care that they don't inadvertently expose sensitive data that would normally be hidden from users by user permissions, field-level security, or organization-wide defaults (OWD in Salesforce). They should be particularly careful with Web services, which can be restricted by permissions, but execute in system context once they are initiated.

    Most of the time, system context provides the correct behavior for system-level operations such as triggers and Web services that need access to all data in an organization. However, you can also specify that particular Apex classes should enforce the sharing rules that apply to the current user

  • Aman

    Member
    July 17, 2017 at 2:21 pm in reply to: How to lock record using SOQL in Salesforce?

    Hello Saloni,

    In Apex, you can use FOR UPDATE to lock sObject records while they’re being updated in order to prevent race conditions and other thread safety problems.
    While an sObject record is locked, no other client or user is allowed to make updates either through code or the Salesforce user interface. The client locking the records can perform logic on the records and make updates with the guarantee that the locked records won’t be changed by another client during the lock period. The lock gets released when the transaction completes.

    To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement. For example, the following statement, in addition to querying for two accounts, also locks the accounts that are returned
    Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];

    While the records are locked by a client, the locking client can modify their field values in the database in the same transaction. Other clients have to wait until the transaction completes and the records are no longer locked before being able to update the same records. Other clients can still query the same records while they’re locked.

     

     

  • Hello Shariq,

    trigger AddNameAcc on Contact (after update,after insert)
    {
    List<contact> con = [SELECT Id,LastName, Account.Name, Account.Id FROM Contact WHERE Account.Id != null AND Id IN : Trigger.new] ;
    List<Account> acc = new List<Account>();
    for(Contact s : con)
    {
    Account a = new Account();
    a.Id = s.AccountId;
    a.Name = s.Account.Name+s.LastName;
    System.debug('aaa'+a.Id);
    acc.add(a);
    }
    update acc;
    }

  • Aman

    Member
    July 17, 2017 at 12:09 pm in reply to: What is recursive trigger in salesforce

    Hello Absar,

    Avoid recursive trigger in salesforce using static variable

    Recursion occurs when same code is executed again and again. It can lead to infinite loop and which can result to governor limit sometime. Sometime it can also result in unexpected output.

    It is very common to have recursion in trigger which can result to unexpected output or some error. So we should write code in such a way that it does not result to recursion. But sometime we are left with no choice.

    For example, we may come across a situation where in a trigger we update a field which in result invoke a workflow. Workflow contains one field update on same object. So trigger will be executed two times. It can lead us to unexpected output.

    Another example is our trigger fires on after update and it updates some related object and there is one more trigger on related object which updates child object. So it can result too infinite loop.

    To avoid these kind of situation we can use public class static variable.

    In RecursiveTriggerHandler class, we have a static variable which is set to true by default.

    public class RecursiveTriggerHandler{
    public static Boolean isFirstTime = true;
    }

    In following trigger, we are checking if static variable is true only then trigger runs. Also we are setting static variable to false when trigger runs for first time. So if trigger will try to run second time in same request then it will not run

    trigger SampleTrigger on Contact (after update){

    Set<String> accIdSet = new Set<String>();

    if(RecursiveTriggerHandler.isFirstTime){
    RecursiveTriggerHandler.isFirstTime = false;

    for(Contact conObj : Trigger.New){
    if(conObj.name != 'SFDC'){
    accIdSet.add(conObj.accountId);
    }
    }

    // Use accIdSet in some way
    }
    }

     

Page 7 of 8