I am facing trouble while inserting
1 share record
. When I am loggin to Admin Profile
, it is working fine without any DML exception
, but when I am login to Sales profile
, then I am facing such exception.
I checked with DescriveSObject
isCreatable
() method, I can see that Sales profile has create access on Package_Share__c
object.
This is the list I am inserting:
packageShareInsertList : (Package__Share:{UserOrGroupId=00540000000zHI5AAM, ParentId=a1I560000004iRIEAY, RowCause=PKG_Sales_Team__c, AccessLevel=Edit})
This is th DML Exception I am facing:
04:21:17.791 (3215279840)|FATAL_ERROR|System.AssertException: Assertion Failed: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, invalid row cause: []:
But Row cause
has valid value that I am sure. If it was a wrong value, then other profiles
would have thrown the same issue.
Please advise.
RowCause=PKG_Sales_Team__c
.PKG_Sales_Team__c
is the custom Apex sharing reason onPackage__c
custom object.Schema.Package__Share.RowCause.PKG_Sales_Team__c
gives you string value andRowCause
data type is string, so I think we can assign that way too. If assigning value was wring, then how it i sworking forAdmin profile
.