Forum Replies Created

Page 7 of 8
  • Hi Himanshu,

    You can use the below formula:

    CASE(MOD( StartDate__c - DATE(1985,6,24),7),

    0 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,5,5,5,6,5,1),
    1 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,4,5,4,6,5,1),
    2 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,3,4,3,5,4,6,5,1),
    3 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,2,3,2,4,3,5,4,6,5,1),
    4 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,1,3,2,4,3,5,4,6,5,1),
    5 , CASE( MOD( EndDate__c - StartDate__c ,7),1,0,2,1,3,2,4,3,5,4,6,5,0),
    6 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,2,3,3,4,4,5,5,6,5,0),
    999)
    +
    (FLOOR(( EndDate__c - StartDate__c )/7)*5)

    Thanks

  • Surbhi

    Member
    May 30, 2016 at 11:38 am in reply to: How to assign permission set in test class?

    Hi NItish,

    Please follow the below steps:

    Step 1: Insert a test user record.
    Step 2: Query your Permission Set information that you have used in class.
    Step 3: Assign the inserted user to the above queried Permission Set. For this PermissionSetAssignment object is used.
    Step 4: Initialize your class/method by running as the above inserted user.

    Thanks

  • Surbhi

    Member
    May 30, 2016 at 11:21 am in reply to: Facing Error While Creating a Formula in Formula Field

    Hi Ajit,

    Please try this in the formula field for your requirement: VALUE(Text Field).

    Thanks

  • Hi Nitish,

    As per my knowledge, unfortunately there is no way to enable option of view state for non system administrator profile.

    Thanks

  • Hi Himanshu,

    Suppose you want to override standard 'New' button with custom visualforce page on opportunity just follow below steps:

    Step-1: Search Opportunity in the quick search box.

    Step-2: Then click "Create a new custom link" from the appeared options.

    Step-3: Click on "Edit" which is next to "New" button.

    Step-4: Select radio button next to Visualforce page from "Override With" and select your page.

    Thanks

  • Surbhi

    Member
    May 30, 2016 at 5:28 am in reply to: How can i call relationship object fields in Salesforce trigger?

    Hi Naman,

    Here is the solution for what I understand from your question:

    Suppose you have a trigger on Contact and you want to access Account fields.

    trigger afterInsertContact on Contact (after insert){
    for(Contact conObj : trigger.new){
    system.debug(conObj.AccountId);
    }
    }

    For standard relationships, you can simply use the . (dot) notation and refer to the fields.
    However for a custom relationship, you need to use __c and __r.

    Thanks

  • Surbhi

    Member
    May 30, 2016 at 5:16 am in reply to: Process Builder failed to trigger a flow

    Hi Himanshu,

    This issue mainly occurs with a Process that has criteria referencing a foreign key field (cross object references). You can create a text formula field that pulls in the value of the foreign key field you are trying to reference in the Process criteria. You can use that formula in the criteria of the Process. For further details, you can also refer to below link:

    https://success.salesforce.com/issues_view?id=a1p300000008XMLAA2

    Thanks

  • Hi Ajit,

    You can get field's id by following below steps:

    Step-1 : Open detail of any custom field on any object.

    Step-2 : In the url, you can find id like (example) "00N3100000Gn6JK". That will be the id of that field. You have to use this id for URL hacking.

    Thanks

  • Surbhi

    Member
    May 27, 2016 at 5:19 pm in reply to: Database.insert(list,false) vs Database.insert(list)

    Hi Ajay,

    I can explain this with an example:

    Suppose if you are inserting 5 records. 3 of them have all the required field's values and remaining 2 records missing required field's values.

    In Salesforce, if you use Database.insert(list), it will thrown an exception and it will not insert any one of the records. But if you use Database.insert(list, false), it will insert 3 records successfully and rest 2 records(required fields missing) will not be inserted.

    Thanks

  • Surbhi

    Member
    May 27, 2016 at 5:14 pm in reply to: System.LimitException: Apex CPU time limit exceeded

    Hi Himanshu,

    Can you please elaborate your requirement or provide your code, so that I can analyse your issue as whats the actual reason behind that?

    Thanks

     

  • Surbhi

    Member
    May 27, 2016 at 5:09 pm in reply to: Can't link developer account to Trailhead. How to go about it?

    Hi Naman,

    Make sure you are using a new Developer Edition. If you are still having trouble, use the “Share Feedback” button in the footer or on the right column to send support or feature requests or other comments.

    Thanks

     

  • Surbhi

    Member
    May 26, 2016 at 2:24 pm in reply to: How to make Lead Status field read-only in a profile?

    Hi Ravi,

    There is no possibility of setting the Field Level Security of Lead Status to Read-Only. You can create a Validation Rule to hinder your users from Saving a Lead record where they have changed the Lead Status.

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 2:18 pm in reply to: Can I create a polymorphic key from a custom object?

    Hi Himanshu,

    I found an idea for the above requirement. Please find the link of idea:

    https://success.salesforce.com/ideaview?id=08730000000BqzBAAS

    To mimic the functionality by say using a custom text field, would be a rigorous customization: Custom text field, mark as "ExternalId" for indexing purpose.

    Thanks

     

  • Surbhi

    Member
    May 26, 2016 at 2:12 pm in reply to: How do I use the Tooling API to create a new Apex Trigger?

    Hi Himanshu,

    Please find the below link of blog. Its really helpful for me.

    https://www.sundoginteractive.com/blog/creating-classes-and-triggers-in-apex-using-the-tooling-api

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 12:54 pm in reply to: How can we add pageblock table columns dynamically in vf page.?

    Hi Naman,

    Page Block Tables actually support <apex:repeat> tags. Or you can use Dynamic Visualforce Components to construct the pageBlockTable, which avoids the limitation re headings when adding columns dynamically in VF alone.

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 12:48 pm in reply to: How to check null value in Salesforce Lightning Process Builder?

    Hi Naman,

    I found an idea related to your requirement. Please find below the link of idea:

    https://success.salesforce.com/ideaView?id=08730000000Dgi5AAC

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 7:00 am in reply to: How to differentiate LIST apart from HIERARCHY setting in Apex?

    Hi Piyush,

    Hierarchical Custom Settings

    1. Use this for your most of your VF/Apex config settings for stand alone apps
    2. Don’t put in settings which are environment dependent (e.g. if you have separate test server URLs that should be used in Sandbox vs. Production)
    3. Definitely, if you are storing User Preferences, Hierarchical is the way to go.

    List Custom Settings

    1. Use this if you creating config for a common piece of code that appears in different areas of Salesforce
    2. Use this when there are environmental differences such as Test server URLs vs. Production server URLs
    3. Also can be used as a simple table for frequently used data

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 6:39 am in reply to: How can I get this apex:repeat variable in javascript?

    Hi Ravi,

    Add a styleclass="" to your components, then use jQuery's selectors. You can't use Id here because it has to be set to a static item.

    Thanks

  • Hi Piyush,

    I think you require list of all objects enabled with activities in apex. The most accurate way is to loop over the list of valid target Objects of the WhatId field on the Task or Event object, as this list will change whenever you check/uncheck the "Allow Activities" checkbox on a given Object:

    Set<Schema.SObjectType> objectsWithActivitiesEnabled = new Set<Schema.SObjectType>();
    String objectNames = '';
    for (Schema.SObjectType objectType : Task.WhatId.getDescribe().getReferenceTo()) {
    objectsWithActivitiesEnabled.add(objectType);
    objectNames += '\n' + objectType;
    }

    system.debug(objectNames);

    Thanks

  • Surbhi

    Member
    May 26, 2016 at 6:29 am in reply to: How to create a opportunity converted from lead in test class?

    Hi Ravi,

    Please find below the code for creating lead and converting it to account, contact and opportunity in test class.

    Lead lead = new Lead();
    lead.FirstName='James';
    lead.LastName='Dane';
    lead.Company='Test Company';
    lead.LeadSource='GetTimely Online';
    insert lead;

    Database.LeadConvert lc = new database.LeadConvert();
    lc.setLeadId(lead.Id);

    Database.LeadConvertResult lcr = Database.convertLead(lc);

    Thanks

     

  • Surbhi

    Member
    May 26, 2016 at 6:19 am in reply to: Is there an average method for apex math

    Hi Ravi,

    Unfortunately, there is no such specific method in math class of salesforce. You can create apex method in apex class for finding the average of list of integers/decimals.

    Thanks

  • Hi Ravi,

    Can you please clarify the relationship between account and custom object ?

    But, if there is a reason that this relationship cannot be Master-Detail, then this functionality can only be accomplished through an Apex Trigger.

    Thanks

  • Hi Ravi,

    You have to work on the "FeedItem" Object. Here are the steps:

    1. Get the FeedItem, that has Type = 'ContentPost' and ParentId = AccountId.
    2. Create a new FeedItem object and copy the Body, RelatedRecordId, Title & Type fields from FeedItem record from Step 1.
    3. Set the new FeedItem from Step 2. ParentId as the AccountId you want to move attachment to.
    4. Insert FeedItem, (and delete prev. feed Item if you want to).

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 1:22 pm in reply to: How to find the reason for Insufficient Privileges?

    Hi Ravi,

    Maybe try checking the central user's access to whatever record type your unable to create. Then check at the profile and object level. Also when you try to create a share when the resource (object privacy) is already 'public read only' -- the DML throws an arbitrary exception - so also check the record is set to private.

    Thanks

  • Surbhi

    Member
    May 25, 2016 at 1:19 pm in reply to: How do you change an Opportunity's Record Type in the web UI?

    Hi Ravi,

    You can't edit the record type of the object in edit mode.

    If you go to the detail view of the page, you should see a field called record type with the link [change] next to it.

    Thanks

Page 7 of 8