Hot answers tagged

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


7

Yes you are correct .Just putting amswer into programmatic way First get the Id in URL parameter and then on page fetch using Id recId=ApexPages.CurrentPage().getparameters().get('id'); Secondly use Select statement and get the ownerId(Assuming object is Account) ID ownerId=[Select Id,ownerId from Account where Id=:recId].ownerId Update: After the ...


5

When converting leads owned by a queue, the owner must be specified. This is because accounts and contacts cannot be owned by a queue. Even if you are specifying an existing account or contact, you must still specify an owner. Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_convertlead.htm So, the ...


4

Your problem is on this line Account acc1=new Account(Name='nEW',Account__r.owner.firstname='gSS'); There is no relationship account__r.owner.firstname The relationship is account.owner.somefieldonUser and even so, when you insert an sobject, you can only instantiate fields directly on that sobject so what you need is: Account acc1=new Account(Name='...


3

Related fields in trigger context are null unless queried explicitly. Your options are to either: Query your users based on the values from OwnerId Create a formula field Owner_Name__c, which returns the text of Owner.Name, allowing to you use the formula in your trigger. I usually prefer a formula over the query, since its cheaper, and you can re-use it ...


3

First, make sure the "Public Site Guest User" has at least read permission on the Object in question; go to the Site's Public Access Settings, edit the profile, and check Read permission for the object you're trying to assign. Without this permission, they won't be able to own the record. Next, switch to Lightning. Interestingly, I can't seem to make the ...


3

So -- the values in the rows be used for insert Task.WhatId should be the Case.Id (i.e. starts with 500...) Task.WhoId should be a Contact.Id (i.e. starts with 003...) Task.OwnerId should be some User.Id (i.e. starts with 005...) What you are trying to do is upsert a task using external Ids to identify the parent (CaseNumber for the Whatid). caseNumber is ...


3

Standard behavior for transfer of ownership of an Account is to transfer all related Contacts to the new Owner, all open and closed Cases, all open Activities related to the Account, but not closed Activities. Workflow rules that update owners do not also transfer associated items. To ensure transfer of an associated item, you'd want to add them to your ...


3

This is actually an idea 'Under Product Team Review' and there seems to be fairly strong support for it so I hope this will be implemented in future as a native feature. The idea is generic so it cover opportunities, leads and other objects as well. Until then, you'll need to rely either on writing an Apex trigger/ flow which detects this change and sends a ...


3

For some time now, SFDC has recommended that one use ISBLANK(..) in lieu of ISNULL(..). As Matt Lacey describes, ISNULL behaves differently for text and lookup fields than ISBLANK. So, rewrite your expression to: NOT(ISBLANK([My_Custom_Object__c].Account__c)) && [My_Custom_Object__c].Account__c.Owner.LastName = "SurnameOfAnAccountOwner" Things are ...


3

Once ownership changes, it's entirely possible the user won't have access to the case. If you wanted to make sure they still had access, consider building a Process Builder action to add them to the Case Team for the Case. This would allow them to retain read-only or write access after the ownership change.


2

You can create a Permission Set, assign Read <Object> to the Permission Set, then assign the Permission Set to the user. Or, you can clone Standard User, assign your Standard User users to the new profile, and add Read <Object> to the new profile.


2

Better to use bind variable in SOQL. String str = 'open'; List<Case> caseList = [SELECT Status, Origin from Case WHERE OwnerId=:UserInfo.getUserID() And Status !=:str]; For dynamic query use like this: String str = 'open'; String userId = UserInfo.getUserID(); String queryStr = 'SELECT Status, Origin from Case WHERE OwnerId=:userId And Status !=...


2

You have two problems: You should use the <apex:outputField> component The actual field API Names end with Id Here is a simple demo page to illustrate how to display these fields properly: <apex:page Standardcontroller="Case"> <apex:pageBlock> <apex:pageBlockSection> <apex:outputField value="{!Case....


2

No, it isn't possible. Chatter Free/External and Chatter Plus users cannot be lead owners. Here's a list of things that Chatter Plus users can do: http://na8.salesforce.com/help/pdfs/en/salesforce_chatterplus_tipsheet.pdf (PDF)


2

Because on those object Owner field is polymorphism means it can be user or Queue. So you can't directly convert it due to that limitation because system can't decide that it is user or Queue. While on Account only user can make Owner so there you can directly access it. Here is how you can access this field // Select records based on the Owner ...


2

So, this is going to sound very dumb but the client I am working for created a custom owner field for some unknown reason and replaced the standard field with it. So the owner was getting mapped properly to the standard owner field but the custom field was the one present on the record layout.


2

When you need to traverse through a reference field, you can use a dot operator to get the related object's fields. In this case this would be Owner.CompanyName because this is a standard reference field. Similarly lets say if this would have been a custom reference field called Owner__c on Lead; with the relationship name as Owner__r, syntax to get the ...


1

You will want to change getUsersBranchInfo to return a Map<Id, Id> and allow it to accept an set of user IDs. So try something like: public with sharing class BranchService { public static Map<Id, Id> getUsersBranchInfo(Set<Id> userIds) { // Load all the users required, including their IDs for later use User ...


1

It is a kind of limitation in Salesforce. Check out this Idea:- Allow [Change] owner button to be overriden It says it would be nice to be able to override the "Change" owner button on all records. S-Controls/URL hacks etc. could maybe then be employed to modify/set checkboxes that appear on the "Change" dialogue menus to be defaulted a certain way/...


1

As the Owner field can be a polymorphic field, you can only access those fields which are common across both objects. In such cases, you can use TYPEOF in your SOQL query and select the fields based on the Owner type. SELECT [fieldList,] [TYPEOF typeOfField {WHEN whenObjectType THEN whenFieldList}[...] [ELSE elseFieldList] ...


1

I think the problem here is that User.Owner is a polymorphic field. That is it can reference either a User object or a Group object. Personally, I just do another query on User via the OwnerId field once I've checked that this Id a User object not a group. I'm interested in finding out if there's a better way of handling this. Why does Owner.Phone work ...


1

From the docs: "Fields that have a spanning relationship aren't supported by lightning:recordForm. The fields specified must be associated with the same objectApiName. A field such as Contact.Account.Ownership is a cross-object reference between the Contact object and the Account object, and can't be displayed in the form." Documentation


1

As the error suggests, the Owner field is a Name object in these scenarios. This occurs for Case and Lead Owner, any custom objects that are enabled for at least one Queue, as well as the Activity field WhoId, which can be related to a Lead or Contact. Ideally, you should get a list of the OwnerId values, then query the User or Group tables to get the parent ...


1

You can not set the Owner name directly what you can do assign the Id HistoryRecord ABC= [Select OwnerId, Owner.Name from HistoryRecord where id = 123]; HistoryRecord DEF = new HistoryRecord(); DEF.OwnerId = ABC.OwnerId;


1

"No code" solution: You could use the Declarative Lookup Rollup Summaries package. Create an integer field on the User object, and set up a real-time rollup that counts child Accounts via the OwnerId lookup. Then you can put a Workflow Rule or Process Builder on the User object that fires whenever the count field is edited to become at least 100, and have ...


1

No you can't make a "Chatter External User" as a Default Owner. Because "Chatter External User" don't have access of salesforce data. But as a workaround you can make a text field and store the Id there and make a default owner to all external records. Using this way you can keep the track of which user own the record.


1

Check the Case Owner Profile and see if it has access to User object. When using lookup fields, the user's Profile also need to have read access to the target object of that lookup field, in your case the User object.


1

I can suggest following solution: 1) Assign all records to one of the user from the group(instead of assigning it to queue). 2) Create a criteria based sharing rule to give Read/Write access to the group. 3) The team which reports to Management team should be on different profile where you can give access to create child object record but not parent.


1

When using the Owner field in an Email Template you have a few options of what to display in the email. If you would like to show the full name of the owner. You would need to use {!Opportunity.OwnerFullName}. Using just the first name would be {!Opportunity.OwnerFirstName} etc. This can be done with Last Name, ID, email and title as well.


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