Hot answers tagged

14

Here is a rough sequence of queries you'd need to do this: User[] users = [SELECT ContactId,IsPortalEnabled FROM User WHERE Id = :UserInfo.getUserId()]; User usr = users[0]; Contact[] contacts = [SELECT Id, AccountId FROM Contact WHERE Id = :usr.ContactId]; Contact cont = contacts[0]; Asset[] assets = [SELECT Name, ContactId, AccountId, Description, Name, ...


13

It's RecordType.Name RecordTypes are held in separate reference table so to query the names just treat the RecordTypeId as any other lookup field :) In case you've never used the "dot notation" (the way SOQL handles relationships and things that would be JOINs in regular databases): http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/...


12

You want to create a sharing set. (taken you're using customer community) Organisation Wide-Defaults In theory, you could provide Public access for either Cases or Contacts. However, doing that would almost never make sense for an organization. Think about it — you would be providing each of your customers visibility into all Contact and Case records for ...


11

You should filter on a unique field, so I would avoid using Name. You can pull in fields like Username, Alias, etc. through your query using a Right Outer Join: SELECT Owner.Username FROM Case


11

Just check the first three digits of the OwnerId field (the key prefix for the Id). You can use a formula criterion here. Is owned by User: BEGINS([Case].OwnerId, "005") Is owned by Queue: BEGINS([Case].OwnerId, "00G")


10

You can check if any of the User- or Queue-specific polymorphic Owner fields is empty. e.g. ISBLANK(Owner:Queue.Id) will be true if the owner is a User and false if the owner is a Queue The opposite would be: ISBLANK(Owner:User.Id) More info about polymorphic fields here: https://developer.salesforce.com/blogs/developer-relations/2013/06/cross-object-...


9

The documentation for String.length() (there is no String.size()) explains that it: Returns the number of 16-bit Unicode characters contained in the String. So the number of 8 bit bytes is 2x the length of the string. (And so to fix the problem you need to truncate at 2000 characters.) PS Looks like Blob.valueOf(stringValue).size() is a better way to ...


9

I'm assuming you are using the Summer '14 version of the Force.com IDE. (The code you link to doesn't produce any errors in the earlier version I am using.) The "What's New in Summer '14" of the current Force.com IDE page includes this item (bolding added by me): Enabled syntax checking and outline view using a new parser, which can be toggled through ...


9

A tip to @guy as I didn't know about the polymorphic formulas (sheesh) Another solution is LEFT(OwnerId,3) = '00G' /* this is a queue, all Queue Sobject ids start with 00G */


8

If this is a before insert trigger, will this owner persist, or will the default case assignment owner be set as the owner anyway. Assignment rules run after triggers do. See Triggers and Order of Execution for more details. Is there a way to access the 'Assign using assignment rules' attribute from the trigger so I can assure it isn't assigned using ...


8

Finally I have fixed it...Thanks to bob_buzzard ... The case feed is enabled via the Setup -> Customize -> Cases -> Support Settings -> Enable Case Feed Actions and Feed Items. Once this is checked, users have the case feed view or regular record view based on the "Use Case Feed" setting in their profile or assigned permission set. I have just disabled ...


8

Have you tried using the SForce-Auto-Assign Assignment Rule Header? The Assignment Rule header is a request header applied when creating or updating Cases or Leads. If enabled, the active assignment rules are used. If disabled, the active assignment rules are not applied. If a valid AssignmentRule ID is provided, the AssignmentRule is applied. If the ...


8

Sure thing. You don't even need Apex. Create the following Visualforce Page and you can include it in any Page Layout you wish on the Case object. <apex:page standardController="Case"> <apex:relatedList subject="{!Case.AccountId}" list="Opportunities" /> </apex:page>


8

Note that you do not need to skip an index between substrings. Your current pattern actually loses data. When you do substring(2001, 4000), you start at character #2002. When you do substring(0, 2000), you stop at character #2000 (whose index was 1999). So you lose character #2001 whose index is 2000. This can be demonstrated simply: String text = '...


8

As an alternative to using substring, you can also use Pattern/Matcher: SObjectField[] fields = new SObjectField[] { // List your fields... Case.Response_Part1__c, Case.Response_Part2__c, Case.Response_Part3__c, Case.Response_Part4__c // ... }; Pattern p = Pattern.compile('(?s).{1,2000}'); // Read up to 2k at a time for(Case record: Trigger.new) {...


7

I'm still new to this but something that worked for me is: Go to Setup > Create > Global Actions Create a new Global Action Target object = case Record type = I set this to the kind of case I wanted to be created in the Service console Label = name it whatever you'd like. This is how it shows up in Global Actions save Go back to Site.com and open the Site ...


7

I have found instances where @lunadog's solution does not work. The most reliable way I have found is to open the Flow editor for any Flow, wait for it to load completely, then edit the URL and replace the Id of the current Flow with the Id of the Flow in question, and load the new URL. EDIT 1: I just tested this, and it looks like you should be able to use ...


7

I would recommend that you make the Record Type unavailable to all profiles. That will prevent the users from creating records with (or changing them to) that Record Type. Once that is done, in your VF controller you can query for the ID of said RT and apply it in code to the records created in the page.


7

Just use Process Builder. There is no readily apparent reason you need to use a trigger for this functionality. Navigate to Create > Workflows & Approvals > Process Builder. Click New. Fill in Process Name > New Account Case. No need to fill in API Name, it will auto-populate. You may fill in an optional Description. Click Save. Click + Add Object. ...


7

It is possible to defer sharing rule calculations, which might help if you are fairly certain sharing recalculation is the root cause. Take a look at Deferring Sharing Rule Calculations. Unfortunately: The defer sharing calculation feature isn't enabled by default. To enable it for your organization, contact Salesforce. So here are the steps you need to ...


7

A case team is simply a group of individuals working on a case; there are multiple people involved in the resolution of the case. For example, a case might need a service tech to take care of the hardware and an IT person to take care of the software, so both people need access to the case, with the case owner (perhaps a customer service representative) ...


6

In case the documentation is unclear, if you don't check "Send Email to Members," they won't be notified. Consult the following truth table. Send Email to Members [unchecked], Queue Email [blank]: Nobody is notified. All members are notified. Send Email to Members [unchecked], Queue Email [not blank]: One email address is notified. Send Email to Members [...


6

Update: You need to query a standard salesforce object CaseStatus: This object represents a value in the case status picklist. Query the CaseStatus object to retrieve the set of values in the case status picklist. Select Id, MasterLabel From CaseStatus Where IsClosed = true You nees to use this field "Status" in your SOQL query: List<Case> ...


6

If there are a lot of records (>10.000) it's best to use DataLoader to first retrieve all CaseComment record Id's, then delete based on that output file. If the amount is under 10.000, you can do the following from the 'Execute Anonymous' window in the Developer Console: delete [Select Id From CaseComment]; Optionally you could split that up into chunks ...


6

Sethu From the doc on the page: Define email addresses on your email system for case submissions. Create email routing addresses that include the addresses defined for cases. Configure your email system to forward case submissions to the Email Services Address provided to you by Salesforce. Basically, the EmailAddress field is the email address your ...


6

What actually helped, was to post into the Certification Group of the Partner Community. I got a very quick and nice response from Kari Lucio and right now they have refunded all of my prior expenses. Only waiting on the bio-reset, which should be easy, I guess. update: bio-reset is done, too. Thanks Salesforce, well done!


6

This should do it: If you have a list of Account IDs say Set<ID> acctIDs [Select Name, ID, (Select ID, CaseNumber From Cases) From Account Where ID = :acctIDs]; Update: As of 9-2-2015 The above always returns 0 records for cases. BUT if you add a LIMIT clause records are returned OR if you add a selective where clause, records are returned. Not sure ...


6

This is a pretty simple workflow rule. Criteria IsClosed = true Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria Action Field Update (Field = Closed Counter) Formula: IF(ISNULL(Closed_Counter__c), 1, Closed_Counter__c + 1)


6

The child history relationship name is called "histories". Try the following query: SELECT ID, Subject, Type, (SELECT Field, OldValue, NewValue FROM Histories) FROM Case


6

One solution would be to update the RecordType of the Case when it's Status field is updated to "Closed". You could do this using a Workflow. This record type could then use a Page Layout that has it's fields set to "Read Only" at said Page Layout level. Alternatively, you could use a Trigger to use Approval Process style locking to restrict the record ...


Only top voted, non community-wiki answers of a minimum length are eligible