You need to sign in to do that
Don't have an account?
Don Schueler 6
Package apex that references ContactShare ContactID
I have a VF Page that is used in the Partner Community to lookup a contact that they might not have access too and gain access. This works fine in my Dev org....but I had to switch Contact to Private from Controlled by Parent to both save the code AND to run the test class successfull.
So far my code works since I do an Organization query to see if my Contact is 'ControlledbyParent', if it is I don't update the ContactShare object, I just Share the Account. Note...as many might know, you can't even save your APEX with ContactShare cShare = new ContactShare(ContactId=cid, UserOrGroupId=UserInfo.getUserId(),ContactAccessLevel='Edit'); in it if you have Controlled By Parent for Contact set as your default sharing. This is the only case I am aware of in SF where a configuration setting impacts the ability to save code or run a test or include in a package. Seems wrong to me...we should be able to handle this in code and have it be OK.
THE PROBLEM NOW IS: I can't include this in my managed package....I get: Dependent class is invalid and needs recompilation: Class ApexBaseClass : Field is not writeable: ContactShare.ContactId
So I am looking for either solutions to this from a packaging standpoint OR a better way to accomplish the functionality. Thinking aloud..I guess I coud do it in AJAX using API...not that I would love it there... Looking for other alternatives.....thanks in advance.
So far my code works since I do an Organization query to see if my Contact is 'ControlledbyParent', if it is I don't update the ContactShare object, I just Share the Account. Note...as many might know, you can't even save your APEX with ContactShare cShare = new ContactShare(ContactId=cid, UserOrGroupId=UserInfo.getUserId(),ContactAccessLevel='Edit'); in it if you have Controlled By Parent for Contact set as your default sharing. This is the only case I am aware of in SF where a configuration setting impacts the ability to save code or run a test or include in a package. Seems wrong to me...we should be able to handle this in code and have it be OK.
THE PROBLEM NOW IS: I can't include this in my managed package....I get: Dependent class is invalid and needs recompilation: Class ApexBaseClass : Field is not writeable: ContactShare.ContactId
So I am looking for either solutions to this from a packaging standpoint OR a better way to accomplish the functionality. Thinking aloud..I guess I coud do it in AJAX using API...not that I would love it there... Looking for other alternatives.....thanks in advance.
Any thoughts out there???