You need to sign in to do that
Don't have an account?
RedSales
How to Update a User & Set a Reference ID to empty
Hi,
Within ym user object I have reference fields such as "Approval Manager ". This field is a refence to the user object & by entereing a user id it displays the user's name as the manager.
I wish to set this value to empty using APEX code if data I retrieve (from a source external to SFDC) indicates no Approval Manager is provided. I receive an error saying I'm assigning an invalid ID
my 2 lines of code are
usr.Approval_Manager__c='';
update usr;
Does anyone know if I can set this to blank threfore?
Thanks
no need to put assign blank '' into manager field , just assign null to it like following :-
usr.Approval_Manager__c=null;
update usr;
it should work, the issue with your code is the manager is a lookup to user not a text field so it will not allow to assign string in the id field.
Cheers
Hemant
All Answers
put a try catch block:
no need to put assign blank '' into manager field , just assign null to it like following :-
usr.Approval_Manager__c=null;
update usr;
it should work, the issue with your code is the manager is a lookup to user not a text field so it will not allow to assign string in the id field.
Cheers
Hemant