Forum Replies Created

Page 7 of 12
  • PRANAV

    Member
    January 25, 2018 at 2:50 pm in reply to: Error while inserting the feedItem in Salesforce

    Hi Saloni,

    REQUIRED_FIELD_MISSING is occurred due to some of the required field is not populated with any value. So I think in your org , on this object there must be a required field that is left in your insert DML.

    You can check it once again and try to specify some value for that required field.

  • PRANAV

    Member
    January 25, 2018 at 2:46 pm in reply to: Can we mass delete reports using Salesforce Apex ?

    Hi Saloni,

    In Setup, under Data Management | Mass Delete Records, select Mass Delete Reports and configure a filter to find reports that need to be deleted.

    Reports that you delete go into the recycle bin. They aren’t permanently deleted until you clear your recycle bin.

    NOTE: 

    You can’t mass-delete reports that are scheduled or are used in dashboards or analytic snapshots.

    Hope this helps you.
     

  • PRANAV

    Member
    January 25, 2018 at 2:42 pm in reply to: What are the parameters of a clone method in Salesforce?

    Hi Saloni,

    clone(opt_preserve_id, opt_IsDeepClone, opt_preserve_readonly_timestamps, opt_preserve_autonumber)

    opt_preserve_id
    Type: Boolean
    Determines whether the ID of the original object is preserved or cleared in the duplicate. If set to true, the ID is copied to the duplicate. The default is false, that is, the ID is cleared.

    opt_IsDeepClone
    Type: Boolean
    Determines whether the method creates a full copy of the sObject field, or just a reference:
    If set to true, the method creates a full copy of the sObject. All fields on the sObject are duplicated in memory, including relationship fields. Consequently, if you make changes to a field on the cloned sObject, the original sObject is not affected.
    If set to false, the method performs a shallow copy of the sObject fields. All copied relationship fields reference the original sObjects. Consequently, if you make changes to a relationship field on the cloned sObject, the corresponding field on the original sObject is also affected, and vice-versa. The default is false.

    opt_preserve_readonly_timestamps
    Type: Boolean
    Determines whether the read-only timestamp fields are preserved or cleared in the duplicate. If set to true, the read-only fields CreatedById, CreatedDate, LastModifiedById, and LastModifiedDate are copied to the duplicate. The default is false, that is, the values are cleared.

    opt_preserve_autonumber
    Type: Boolean
    Determines whether auto number fields of the original object are preserved or cleared in the duplicate. If set to true, auto number fields are copied to the cloned object. The default is false, that is, auto number fields are cleared.

    Note: All the parameters are optional.

    Sample Code:

    Phase__c phaseObj = [SELECT Name, Milestone__c FROM Phase__c LIMIT 1];

    Phase__c phaseCopy = phaseObj.clone(false, false, false, false);

    If you insert phaseCopy, it will be the exact copy of phaseObj.

    Hope this helps you.

  • PRANAV

    Member
    January 25, 2018 at 2:36 pm in reply to: What are Sites in Salesforce?

    Hi Saloni,

    Force.com Sites enables developers to build and deploy public web sites and web applications using Force.com. These Web sites can be assigned custom domain names, letting you run your own web sites on the platform.

    Force.com Sites are built with Visualforce, and they can leverage the data, content and logic that resides in your own environment.

    Hope this clarifies your query.

  • Hi Ajay,

    If you have an after update trigger, when a field/fields are edited that trigger will fire which is the way that it needs to be. One possible issue is it's not a good idea to update the same instance inside an after update trigger. Because it cause to fire the trigger again and again(even the maximum deep can be reached).

    Hope this helps you.

  • PRANAV

    Member
    January 25, 2018 at 1:21 pm in reply to: Setup vs non-setup Visualforce Pages in Salesforce?

    Hi Manpreet,

    Setup objects are objects that are used to interact with the metadata like the User object.

    All other objects like those which are native(Standard Objects) or Custom fall into the category of Non-Setup Objects.

    I hope this clarifies.

     

  • PRANAV

    Member
    January 22, 2018 at 3:11 pm in reply to: how to handle access_token in Rest API Call with JSON in Salesforce?

    Hi Rahul,

    What I understand from your query is that you want to store some of your response data, so that you can use it for your further request. So for doing this, Either you can store these data in a Custom Object with different custom fields as per your requirements (LIKE: token_type, access_token, expires_in, etc) Or you can store this in a Custom Setting with different custom fields in it. In that way you can able store the data and easily get those data via query on that.

    And if your are doing your further code in same transaction in same class then you can handle this in your code also as by storing these response data in different variables.

    Hope this helps you.

  • Hi

    You can achieve this by over-riding the "Clone" button with a VisualForce Page. And populates the Opportunity fields as per your requirement.

    OR

    You can create your own custom button and pass your field values for pre-population of Opportunity record.

    Hope this helps you.

  • Hi Subodh,

    I think you want to know when your org Enables the Person Account. There is not a definite way to check it but you can run the below query to know when the Person Account record type is created.

    Select id,name,createdDate,SobjectType,IsPersonType FROM RecordType WHERE SobjectType='Account' AND IsPersonType=True

    As a new family of record types on Account objects is available: “person account” record types when person account is activated.

    Hope this helps you.

     

  • PRANAV

    Member
    January 19, 2018 at 2:00 pm in reply to: How can we separate the ID's based on the record type?

    Hi Mohit,

    Please try this one, it will allow you to separate ID's based on Record Type, no matter how many record types are there, this code will run perfectly for any number of record types.

    String objectAPIName = 'Account' ; //any object api
    Set<Id> setOfAccountIds = new Set<Id>{'0012800000v57PC','0012800001HtmNq','0012800000nAxd7','0012800000hVdfO'};
    Map<Id,String> mapofRecordTypeIdandName = new Map<Id,String>();
    Map<Id,Set<Id>> mapOfRecTypeIdVsAccIds = new map<Id,Set<Id>>();

    Schema.DescribeSObjectResult sobjectResult = Schema.getGlobalDescribe().get(objectAPIName).getDescribe();
    List<Schema.RecordTypeInfo> recordTypeInfo = sobjectResult.getRecordTypeInfos();
    for(Schema.RecordTypeInfo info : recordTypeInfo){
         mapofRecordTypeIdandName.put(info.getRecordTypeId(),info.getName());
    }
    system.debug('***mapofRecordTypeIdandName***'+mapofRecordTypeIdandName);
    for(Account accObj: [Select id,recordTypeId from Account where id in:setOfAccountIds]){
         if(mapOfRecTypeIdVsAccIds.containsKey(accObj.recordTypeId)){
              set<id> setofid = new set<id>(mapOfRecTypeIdVsAccIds.get(accObj.recordTypeId));
              setofid.add(accObj.id);
              mapOfRecTypeIdVsAccIds.put(accObj.recordTypeId,setofid);
         }
         else{
               mapOfRecTypeIdVsAccIds.put(accObj.recordTypeId,new set<Id>{accObj.id});
         }
    }
    system.debug('***mapOfRecTypeIdVsAccIds***'+mapOfRecTypeIdVsAccIds);

    Hope this helps you.

  • Hi Tanu,

    CLONE

    • Creates a copy of the sObject record and keep the reference.
    • Supports primitive data type.
    • Parameters are not applicable.

    DEEPCLONE

    • Generally it clone the list of object but don't hold any reference.
    • It doesn't support primitive datatype.
    • Parameter are applicable.

    Hope this helps you.

  • PRANAV

    Member
    January 19, 2018 at 12:48 pm in reply to: How to get Custom field id in Salesforce?

    Hi Tanu,

    You can get custom field id by following the below steps:

    • Login to salesforce.com
    • In the top right corner, click on Setup
    • Click on Customize, select Opportunities and then click on Fields
    • Click on the name of the custom field you want.
    • Look at your browser's address bar, you'll see something like: //ap1.salesforce.com/00N0K00000K04Ol?setupid=OpportunityFields
    • The 15 digit code that appears immediately after //ap1.salesforce.com/ is the ID of that custom field; in this case the ID of the custom field selected is 00N0K00000K04Ol

    urlhacking11

    Hope this helps you.

  • Hi Mohit,

    You can create an user but you need to query the required profile according to the requirement..! As you cannot create a profile.

    Profile profileId = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1];
    User usr = new User(LastName = 'Bhardwaj',
    FirstName='Pranav',
    Alias = 'pbhar',
    Email = '[email protected]',
    Username = '[email protected]',
    ProfileId = profileId.id,
    TimeZoneSidKey = 'GMT',
    LanguageLocaleKey = 'en_US',
    EmailEncodingKey = 'UTF-8',
    LocaleSidKey = 'en_US'
    );

    You can use the above code snippet for your test class. This may helps you to cover your apex class.

  • Hi Ajit,

    If you enable Lightning in your org then the managed packages used must be lightning ready. If not then you might not get lightning look and feel and may be some of the functionality breaks. So its better to check whether your package is lightning ready or not.

  • PRANAV

    Member
    January 19, 2018 at 9:57 am in reply to: how to do the project "suggestion box app" in trailhead?

    Hi Radhakrisna,

    Trailhead is for your own learning and enhancing your skills in this enormously growing Salesforce technology. So I would strongly recommend you to learn from it and do the tasks/quiz by own. In that way you can achieve your confidence in Salesforce and feel proud by doing it by yourself. Happy Learning.

  • PRANAV

    Member
    January 19, 2018 at 9:47 am in reply to: Is there any limitation on adding number of screens in flows?

    Hi Tanu,

    These are the present limits for visual workflow:

    Maximum number of versions per flow - 50
    Maximum number of executed elements at run time - 2,000
    Maximum number of active flows and processes per org - 500
    Maximum number of flows and processes per org - 1,000
    Maximum number of flow interviews or groups of scheduled actions (from processes) that are waiting at one time - 30,000
    Maximum number of flow interviews that are resumed or groups of scheduled actions that are executed per hour - 1,000
    Maximum number of relative time alarms defined in flow versions or schedules based on a field value in processes - 20,000

    So I think to answer your question "Maximum number of executed elements at run time - 2,000" involves all the elements.

    Hope this helps you.

  • PRANAV

    Member
    January 19, 2018 at 9:40 am in reply to: How to add field history as a related list of opportunity in vf page?

    Hi Tanu,

    You can add related list in your VF Page by using apex:detail tag.

    <apex:page standardController="Opportunity">
    <apex:detail subject="{!Opportunity.Id}" relatedList="false" title="false"/>
    </apex:page>

    OR

    You can use apex:relatedList tag. For example:

    <apex:page standardController="opportunity">
    <apex:relatedlist list="OpportunityHistories" title="Stage History"/>
    <apex:pageBlock >
    <apex:pageblocktable value="{!opportunity.Histories}" var="hist" title="opporty">
    <apex:column value="{!hist.createddate}"/>
    </apex:pageblocktable>
    </apex:pageBlock>
    </apex:page>

    Hope this helps you.

  • Hi Abhinav,

    There are two approach :

    First by using “retURL” parameter in URL of flow
    //instance.salesforce.com/flow/flowName?retURL=page_name

    and second,  if flow is used in Visualforce page then

    <apex:page>
    <flow:interview name="MyUniqueFlow" finishLocation="{!$Page.MyUniquePage}"/>
    </apex:page>

    or
    <apex:page>
    <flow:interview name="MyUniqueFlow" finishLocation="{!URLFOR('/home/home.jsp')}"/>
    </apex:page>

    Hope this helps you.

  • Hi Shariq,

    There are different ways you can refer to or instantiate a PageReference in one of the following ways:

    • Page.existingPageName
      Refers to a PageReference for a Visualforce page that has already been saved in your organization. By referring to a page in this way, the platform recognizes that this controller or controller extension is dependent on the existence of the specified page and will prevent the page from being deleted while the controller or extension exists.
    • PageReference pageRef = new PageReference('***partialURL***');
      Creates a PageReference to any page that is hosted on the Lightning platform. For example, setting 'partialURL' to '/apex/Hello' refers to the Visualforce page located at mySalesforceInstance/apex/Hello. Likewise, setting 'partialURL' to '/' + 'recordID' refers to the detail page for the specified record.
      NOTE: This syntax is less preferable for referencing other Visualforce pages than Page.existingPageName because the PageReference is constructed at runtime, rather than referenced at compile time. Runtime references are not available to the referential integrity system. Consequently, the platform doesn't recognize that this controller or controller extension is dependent on the existence of the specified page and won't issue an error message to prevent user deletion of the page.
    • PageReference pageRef = new PageReference('***fullURL***');
      Creates a PageReference for an external URL
    • You can also instantiate a PageReference object for the current page with the currentPage ApexPages method. For example: PageReference pageRef = ApexPages.currentPage();

    Hope this helps you.

  • PRANAV

    Member
    January 18, 2018 at 3:02 pm in reply to: How can i schedule jobs in Salesforce Apex Flex Queue?

    Hi Suraj,

    The Apex Flex Queue page lists all batch jobs that are in Holding status. You can view information about the job, such as the job ID, submission date, and Apex class. By default, jobs are numbered in the order submitted, starting with position 1, which corresponds to the job that was submitted first.

    When the system selects the next job from the Apex flex queue for processing, the job is moved from the flex queue to the batch job queue. You can monitor the moved job in the Apex Jobs page by clicking Apex Jobs.

    Alternatively, you can use System.FlexQueue Apex methods to reorder batch jobs in the flex queue. To test the flex queue, use the getFlexQueueOrder() and enqueueBatchJobs(numberOfJobs) methods in the System.Test class.

    Hope this helps you.

  • PRANAV

    Member
    January 17, 2018 at 10:46 am in reply to: Workflow rule with multiple actions in Salesforce

    Hi Saurabh,

    Salesforce does not support or guarantee the order of execution of workflow rules.
    The same is true for workflow actions, the order in which individual actions and types of actions are executed is not guaranteed. However, field update actions are executed first, followed by other actions.

    Also Salesforce do not guarantee that the execution of individual workflows would be the same the next time the workflow and actions are triggered.

    Hope this helps you.

  • PRANAV

    Member
    January 16, 2018 at 8:07 am in reply to: What are Nicknames in Salesforce? How do we use them?

    Hi Subhendu,

    1. Nicknames in Salesforce is used for community. Nicknames appear in place of first and last names in almost all locations in the community.
    2. You have to Enable Nickname in Community Administration by the following steps
      1. Open Community Workspaces or Community Management.
      2. Click Administration --> Preferences.
      3. Select Enable nickname display, then click Save.
    3. Enabling nickname display in your community allows more privacy and protects member identities. This protection is especially helpful in a public community where unregistered visitors can access member profiles.

    Hope this helps you.

  • PRANAV

    Member
    January 15, 2018 at 3:39 pm in reply to: How can I access Duplicate rules in Salesforce Apex code?

    Hi Ratnakar,

    The DuplicateResult class and its methods are available to organizations that use duplicate rules. DuplicateResult class represents the details of a duplicate rule that detected duplicate records and information about those duplicate records.
    So you can take help of it and for more guidance about it, you may refer the standard salesforce guide as per your usage.

    Hope this helps you.

  • PRANAV

    Member
    January 15, 2018 at 3:35 pm in reply to: How can I use encrypted field data in Salesforce Apex code?

    Hi,

    I want to add a point here, that only users with profiles that have the “View Encrypted Data” permission selected are able to view the encrypt field. May be this may helps you.

  • Hi

    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.

    Methods with the RemoteAction annotation must be static and either global or public.

    Hope this helps you.

Page 7 of 12